Available as of v1.0.1
18080(Optional: Used to view the management stack as it comes up)
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:v1.0.2 image onto the Rancher nodes.
Currently, our HA setup supports 3 cluster sizes.
* 1 Node: Not really HA
* 3 Nodes: Any one host can fail
* 5 Nodes: Any two hosts can fail
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:v1.0.2
Note: Please be patient with this step, initialization may take up to 15 minutes to complete.
(Optional) Pre-pulling the
rancher/server:v1.0.2 image onto the Rancher nodes. While the initialization is taking place for the script generating Rancher server, you can pre-pull images onto your nodes that will be used in the setup.
# The version would be whatever was used in Step 4 $ sudo docker pull rancher/server:v1.0.2
http://<server_IP>:8080. Under Admin -> HA, 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.
/var/lib/rancher/etc/ssl/ca.crtin the host with
400permissions and then run the registration command. The registration command will automatically be created to use the management certificate.
Once you have added all the hosts into your environment, your HA setup is complete and you can start launching services in the UI, launching templates from the Rancher Catalog or start using rancher-compose to launch services.
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.