How to setup Docker for Percona ClusterControl and add exist_MySQL
In myprevious postI showed you how to setup Percona XtraDB Cluster 5.6 on Docker. This time I will show you how to setup Percona ClusterControl and add the existing Percona XtraDB Cluster 5.6 that we’ve managed to setup from the previous post.
Let us note the following details about our existing containers:
- 172.17.0.2 dockerpxc1
- 172.17.0.3 dockerpxc2
- 172.17.0.4 dockerpxc3
- 172.17.0.5 dockerccui-test
A quick tip for everyone who has followed my previous blog on setting up Percona XtraDB Cluster 5.6 on Docker: I did not install OpenSSH on the Docker instances on purpose and relied on ‘docker attach’ command to be able to get into each container. For this case however, we will need to install openssh-server in each container and make sure SSH is running as well as setup SSH key access for the Percona ClusterControl container to SSH into each Percona XtraDB Cluster node.
Create the Percona ClusterControl UI Docker container
We will need to create a docker container manually instead of building a container from a Dockerfile since we can’t run the ClusterControl installation non-interactively.
root@Perconallc-Support / # docker run --name dockerccui-test -p 80 -i -t ubuntu:12.04 bash
root @ Perconallc - Support / # docker run --name dockerccui-test -p 80 -i -t ubuntu:12.04 bash |
Notice that I had to add ‘-p 80′ to expose port 80 to the host network so we can access the Percona ClusterControl UI from a web browser, we will use Ubuntu 12.04 docker image. I will show you how to check the port that was dynamically allocated on the host network.
I would recommend to run ‘apt-get upgrade’ and ‘apt-get dist-upgrade’ just to make sure we have the latest software packages installed. Install wget and lsb-release packages since these are needed in the next steps.
Download and run the Percona ClusterControl installer and follow instructions on the prompt.
root@Perconallc-Support / # chmod +x install-cc.shroot@Perconallc-Support / # ./install-cc.sh
root @ Perconallc - Support / # chmod +x install-cc.sh root @ Perconallc - Support / # ./install-cc.sh |
The installer will give you several options, one of which is to install Percona Server as Percona ClusterControl’s backend database, I’d highly recommend to choose ‘Yes’. If everything goes well you will need to continue setup of the Percona ClusterControl on the web browser. If you missed installing lsb-release earlier then you will get an error midway through the installation, but you can always install lsb-release package and re-run the installation.
To identify the exposed port on the host’s side we will need to verify it:
root@Perconallc-Support / # docker inspect dockerccui-test | grep HostPort"HostPort": "49154""HostPort": "49154"
root @ Perconallc - Support / # docker inspect dockerccui-test | grep HostPort "HostPort" : "49154" "HostPort" : "49154" |
As we can see, port 49154 was dynamically allocated to the host network and mapped to port 80 on the docker instance. You may explicitly set the port mapping on the host network ‘-p {hostPort}:{containerPort}’, please consult official Docker documentation for further reading.
Setup Percona ClusterControl on the web browser
We can now access the Percona ClusterControl user interface through http://{Host}:49154/clustercontrol. Use the username (in email form) that you indicated during the installation and the default password ‘admin’ to log in.
We should see the following page after successfully logging in:
Percona ClusterControl Wizard
Select ‘Add an existing cluster’ and click Next then follow further instructions to get to the next page:
Add existing cluster
If all goes well you will be seeing the Database Clusters and can view your cluster nodes.
Percona ClusterControl UI on Docker container with Percona XtraDB Clusters 5.6 with each node on docker containers
Summary
In this blog I showed you how to setup Percona ClusterControl on Docker and adding an existing cluster to ClusterControl.
* Create a Docker container for Percona ClusterControl
* Download Percona ClusterControl and installed it
* Added existing Percona XtraDB Cluster on the Percona ClusterControl UI
* Profit!
You may also read the following blogs related to Percona ClusterControl:
- How to create a new Percona XtraDB Cluster with ClusterControl
- How to add an existing Percona XtraDB Cluster to Percona ClusterControl
For those who are new to Docker and containerization you may read through Patrick Galbraith’s blog series about Docker.
上一篇: JS怎样让元素沿着抛物线轨迹运动