18080(Optional: Used to view the management stack as it comes up)
Note: Currently, Docker for Windows and Docker for Mac are not supported.
Prepare the nodes that will be used in the HA setup. These nodes should meet the same requirements as a single node setup of Rancher. (Optional) Pre-pulling the
rancher/server image onto the Rancher nodes.
Currently, our HA setup supports 3 cluster sizes.
Note: The nodes can be split between data centers connected with high speed low latency links within a region, but should not be attempted acrosss larger geographic regions. If you choose to split the nodes within a region, Zookeeper is used in our HA setup and requires a quorum to stay active. If you split the nodes between data centers, you will only be able to survive the region with the fewest nodes going down.
On one of the nodes, launch a Rancher server that will be used to generate the HA startup scripts. This script generating Rancher server will connect to the external MySQL database and populate the database schema. It will be used to bootstrap the HA deployment process. Eventually, the Rancher server container used in this step will be replaced with a HA configured Rancher server.
$ sudo docker run -d -p 8080:8080 \ -e CATTLE_DB_CATTLE_MYSQL_HOST=<hostname or IP of MySQL instance> \ -e CATTLE_DB_CATTLE_MYSQL_PORT=<port> \ -e CATTLE_DB_CATTLE_MYSQL_NAME=<Name of Database> \ -e CATTLE_DB_CATTLE_USERNAME=<Username> \ -e CATTLE_DB_CATTLE_PASSWORD=<Password> \ -v /var/run/docker.sock:/var/run/docker.sock \ rancher/server
Note: Please be patient with this step, initialization may take up to 15 minutes to complete.
# The version would be whatever was used in Step 4
$ sudo docker pull rancher/server
http://<server_IP>:8080. Under Admin -> High Availability, there will be a confirmation that Rancher server has successfully connected to an external database. If this is not set up correctly, please repeat steps 1 and 4 in the previous section.
For each node that you want in HA, use the startup script to launch Rancher server on all nodes. The script will start a Rancher server container that connects to the same external MySQL database created earlier.
Note: Please ensure that you have stopped the script generating Rancher server container after you generate the
rancher-ha.shlaunch script. Otherwise, if you try to launch the HA script on the same node, there will be a port conflict and the HA node will fail to start.
Navigate to the IP or hostname of the external load balancer that you provided earlier and used in the Host Registration URL when generating the configuration scripts. Please note that it will take a couple of minutes before the UI is available as Rancher. If your UI doesn’t become available, view the status of the management stack.
Note: If you are using AWS, you will need to specify the IP of the hosts that you are adding into Rancher. If you are adding a custom host, you can specify the public IP in the UI and the command to launch Rancher agent will be editted to specify the IP. If you are adding a host through the UI, after the host has been added into Rancher, you will need to ssh into the host to re-run the custom command to re-launch Rancher agent so that the IP is correct.