Docker Swarms across hosts Cluster Setup

solved problem

  1. We want to build multiple physical entities in the cluster or virtual machine, rather than a machine.
  2. Due to the use of windows10 + VirtualBox, and install linux series system in VirtualBox, and card reader of the document "docker-machine create --driver virtualbox myvm1" of

Built environment

Stands: 2019.8.16
equipment system: windows10
virtualization software: VirtualBox
virtual system: Ubuntu 18.04 LTS

Reference blog

The following blog grateful for the help provided in problem solving
JerryWangSAP --- error message This computer does not have VT-X
/ AMD-v enabled up the road --- Docker across hosts four docker-machine communication

background

Why would I think to build to build a cluster across multiple physical entity host or virtual machine it? There are two reasons: a single piece of equipment performance limits, and disaster recovery. The first reason is well understood, a single equipment operator force is limited. The point to consider is not the disaster recovery service down in the container, but the physical disaster areas. Domestic 99.99% reliability of cloud service providers from time to time news often hear of the accident, but the situation on two or more cloud services at the same time of the accident it?

Theoretical analysis, to 99.99% as the standard, this figure at first glance is a kind of infallible feeling, but actually doing, is a year of downtime: 52.56 minutes if the service simultaneously on two suppliers on it? Theory of downtime a year two cloud service providers at the same time as a result of downtime: 0.31 seconds. Of course, this is just a theory, but in this theory, when the same budget, purchase distribution in host two or more cloud service providers would not be a better choice?

Thinking

Swarms Docker document in part by "docker-machine create --driver virtualbox myvm1" command in the host system to create a virtual node, but within the command system in ubuntu this is already created by the virtual machine is unable to perform successfully, see the JerryWang Blog. There are many ways to solve this problem, replace the virtual machine software, dual system, Mac so feasible, but subject to certain objective reasons, and you want to try to build a cluster across hosts, so a bit Solution: VirtualBox virtual out 3 sets ubuntu system: A, B, C. Wherein the A array equivalent operating system tutorial, B, C tutorial equivalent to the host operating system in the two nodes. Through the Unicom A, B, C be achieved in the course where the same effect is also achieved across hosts set up the cluster.

Specific steps

  1. Pre-installed docker (see official website tutorial!) In the host A, B, C only ssh server virtual machines can be installed. (Where B, C can be a cloud service provider hosting)
  2. The following instruction fetch IP addresses B, C of the virtual machine.

    ifconfig // If a message is too long to use ifconfig >> output output large files using vim open view

  3. B, C permit the direct use ssh host configuration root account: in the / etc / ssh / sshd_config file, add

    PermitRootLogin yes

  4. Execute the following command to generate the key file A (beginning of this step all operations are completed only in A)

    ssh-keygen

  5. Copy the public key to B, C

    Copy-IP-ID SSH
    // performed twice, is replaced with an IP IP B, C of
    Docker Swarms across hosts Cluster Setup

  6. Use what command to verify the configuration is successful

    ssh IP // After the successful launch of the logout login

  7. The following instructions in A to B, C installation docker. (A link is also established with the B, C) of

    // docker document here before and did not require the installation of docker-machine, common official documentation installation
    // This command needs to be performed twice, once using IP B, C's, NodeName official documents were named for: myvm1, myvm2, here I named docker1, docker2
    Docker-Machine -d the Create the Generic --generic-ip-address = IP NodeName
    Docker Swarms across hosts Cluster Setup

  8. Use the following command to check whether the connection setup complete

    docker-machine ls
    Docker Swarms across hosts Cluster Setup

explain

  1. The effect of the above steps can be implemented independently or multiple physical hosts virtual machines located in different platforms to achieve the connection, but also the following two instructions equivalent official documents, subsequent follow-up may be seamless Course
    docker-machine create --driver virtualbox myvm1
    docker-machine create --driver virtualbox myvm2
  2. About IP, if like me scene (except with a fixed IP host and cloud servers) is not recommended to spend time configuring a static IP in the LAN, as required under enabled) after /etv/netplan(ubuntu17.04 the configuration file to configure the subnet mask, gateway and DNS server and so on, it is prone to error. Spend time are not cost effective, IP There may change, but I practice, the evening perfectly adequate to complete the exercise.
  3. Why do we need to modify the configuration file ssh B, C in? Since not use the root account to log ssh default, we are of the conventional process using the account you have created, such as: ubuntu login, and then use sudo su to root account, but in this scenario requires the need to open this login. (After all, we do not need to go to the cumbersome operation node host)

postscript

The net effect following
Docker Swarms across hosts Cluster Setup
completion of the document effect docker all get-star tutorial below
Docker Swarms across hosts Cluster Setup

The last recommended a k8s contrast with Docker Swarms articles Kumar Ankit - Kubernetes Docker vs. the Swarm: A Complete Guide Comparison

Guess you like

Origin blog.51cto.com/13852791/2431147