yb-docker-ctl
is a simple command line interface for administering local Docker clusters. It manages the yb-master
and containers to perform the necessary administration.
$ wget https://raw.githubusercontent.com/yugabyte/yugabyte-db/master/bin/yb-docker-ctl && chmod +x yb-docker-ctl
Help command
Use the —help option to see all the commands supported.
$ ./yb-docker-ctl -h
usage: yb-docker-ctl [-h] {create,status,destroy,add_node,remove_node} ...
Yugabyte Docker Container Control
{create,status,destroy,add_node,remove_node}
Commands
create Create Yugabyte Cluster
status Check Yugabyte Cluster status
destroy Destroy Yugabyte Cluster
remove_node Stop a Yugabyte Cluster Node
optional arguments:
-h, --help show this help message and exit
- Create a 3 node local cluster with replication factor 3.
Note that the create command pulls the latest yugabytedb/yugabyte
image at the outset in case the image is not yet downloaded or is not the latest.
$ ./yb-docker-ctl create
- Create a 5 node local cluster with replication factor 5.
The number of nodes created with the initial create command is always equal to the replication factor in order to ensure that all the replicas for a given tablet can be placed on different nodes. With the and remove_node commands the size of the cluster can thereafter be expanded or shrinked as necessary.
$ ./yb-docker-ctl create --rf 5
Check cluster status
$ ./yb-docker-ctl status
PID Type Node URL Status Started At
11632 tserver yb-tserver-n2 http://172.19.0.6:9000 Running 2017-11-28T23:32:59.874963849Z
11535 tserver yb-tserver-n1 http://172.19.0.5:9000 Running 2017-11-28T23:32:59.444064946Z
11231 master yb-master-n2 http://172.19.0.3:9000 Running 2017-11-28T23:32:58.403788411Z
11133 master yb-master-n1 http://172.19.0.2:9000 Running 2017-11-28T23:32:57.905097927Z
Add a new node to the cluster. This will start a new yb-tserver process and give it a new node_id
for tracking purposes.
$ ./yb-docker-ctl add_node
Remove a node
Remove a node from the cluster by executing the following command. The command takes the node_id of the node to be removed as input.
$ ./yb-docker-ctl remove_node --help
usage: yb-docker-ctl remove_node [-h] node
positional arguments:
node_id Index of the node to remove
optional arguments:
-h, --help show this help message and exit
Example
$ ./yb-docker-ctl remove_node 3
Stopping node :yb-tserver-n3
Upgrade container image
Upgrade the YugabyteDB image to the latest version.