YugaByte YugaByte
PRODUCT
YugaByte DB Enterprise Edition Compare
SOLUTIONS

Use Cases

Distributed OLTP Apps Fast Data Infrastructure

Deployment Options

Microservices & Containers Multi-Region & Multi-Cloud

Roles

App Development Cloud Operations

Industries

Software-as-a-Service Financial Services Internet of Things E-Commerce
DOCS
Install Explore Develop FAQ
RESOURCES

Meet Us

Events Online Talks

Request Help

GitHub Forum Gitter
ABOUT
Team Careers In the News Contact Us
BLOG
Download

Docs

  • Introduction
    • Overview
    • Core Features
    • Benefits
  • Quick Start
    • 1. Install YugaByte DB
    • 2. Create Local Cluster
    • 3. Test Cassandra API
    • 4. Test Redis API
    • 5. Run Sample Apps
  • Explore
    • 1. Linear Scalability
    • 2. Fault Tolerance
    • 3. ACID Transactions
    • 4. Secondary Indexes
    • 5. Auto Sharding
    • 6. Auto Rebalancing
    • 7. Tunable Reads
  • Develop
    • Client Drivers
      • Java
      • NodeJS
      • Python
    • Learn
      • 1. SQL vs NoSQL
      • 2. Data Modelling
      • 3. ACID Transactions
      • 4. Aggregations
      • 5. Batch Operations
    • Ecosystem Integrations
      • Apache Spark
      • JanusGraph
      • KairosDB
    • Real World Examples
      • E-Commerce App
      • IoT Fleet Management
  • Deploy
    • Private DC
    • Kubernetes
      • Local SSD
    • Public Clouds
      • Amazon Web Services
      • Google Cloud Platform
      • Microsoft Azure
    • Enterprise Edition
      • 1. Initial Setup
      • 2. Install Admin Console
      • 3. Configure Cloud Providers
  • Manage
    • Enterprise Edition
      • Create Universe
      • Edit Universe
      • Edit Config Flags
      • Upgrade Universe
      • Delete Universe
    • Diagnostics Reporting
  • Troubleshoot
    • Troubleshooting Overview
    • Cluster Level Issues
      • Cassandra Connection Issues
      • Redis Connection Issues
    • Node Level Issues
      • Check Processes
      • Inspect Logs
      • System Stats
    • Enterprise Edition
      • Troubleshoot Universes
  • Architecture
    • Basics
      • Single Node
      • Universe, YB-TServer, YB-Master
      • Sharding
      • Replication
      • Persistence
      • Query Layer
      • Acknowledgements
    • Core Functions
      • Universe Creation
      • Table Creation
      • Write IO Path
      • Read IO Path
      • High Availability
    • Transactions
      • Isolation Levels
      • Single Row Transactions
      • Distributed Transactions
      • Transactional IO Path
  • Comparisons
    • Apache Cassandra
    • MongoDB
    • Redis
    • Azure Cosmos DB
    • Google Cloud Spanner
    • Apache HBase
  • API Reference
    • Apache Cassandra
      • ALTER TABLE
      • CREATE INDEX
      • CREATE KEYSPACE
      • CREATE TABLE
      • CREATE TYPE
      • DROP KEYSPACE
      • DROP TABLE
      • DROP TYPE
      • USE
      • INSERT
      • SELECT
      • UPDATE
      • DELETE
      • TRANSACTION
      • TRUNCATE
      • Simple Value
      • Subscript
      • Function Call
      • Operator Call
      • BLOB
      • BOOLEAN
      • MAP
      • FROZEN
      • INET
      • Integer
      • Non-integer
      • TEXT
      • Date & Time
      • UUID & TIMEUUID
    • Redis
      • APPEND
      • AUTH
      • CONFIG
      • DEL
      • ECHO
      • EXISTS
      • FLUSHALL
      • FLUSHDB
      • GET
      • GETRANGE
      • GETSET
      • HDEL
      • HEXISTS
      • HGET
      • HGETALL
      • HKEYS
      • HLEN
      • HMGET
      • HMSET
      • HSET
      • HSTRLEN
      • HVALS
      • INCR
      • MGET
      • MSET
      • ROLE
      • SADD
      • SCARD
      • SET
      • SETRANGE
      • SISMEMBER
      • SMEMBERS
      • SREM
      • STRLEN
      • TSADD
      • TSGET
      • TSRANGEBYTIME
      • TSREM
      • TSCARD
      • TSLASTN
      • ZADD
      • ZCARD
      • ZRANGEBYSCORE
      • ZREM
      • ZREVRANGE
  • Admin Reference
    • yb-ctl
    • yb-docker-ctl
    • docker-compose
    • yb-master
    • yb-tserver
  • FAQs
    • Product
    • Architecture
    • Enterprise Edition
    • Cassandra API
Admin Reference

yb-docker-ctl

    • Download
    • Help command
    • Create cluster
    • Check cluster status
    • Add a node
    • Remove a node
      • Help
      • Example
    • Destroy cluster
    • Upgrade container image

yb-docker-ctl is a simple command line interface for administering local Docker clusters. It manages the yb-master and yb-tserver containers to perform the necessary administration.

Download

$ mkdir ~/yugabyte && cd ~/yugabyte
$ wget https://downloads.yugabyte.com/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

positional arguments:
  {create,status,destroy,add_node,remove_node}
                        Commands
    create              Create YugaByte Cluster
    status              Check YugaByte Cluster status
    destroy             Destroy YugaByte Cluster
    add_node            Add a new YugaByte Cluster Node
    remove_node         Stop a YugaByte Cluster Node

optional arguments:
  -h, --help            show this help message and exit

Create cluster

  • Create a 3 node local cluster with replication factor 3.

Each of these initial nodes run a yb-tserver process and a yb-master process. Note that the number of yb-masters in a cluster has to equal to the replication factor for the cluster to be considered as operating normally and the number of yb-tservers is equal to be the number of nodes.

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
docker run --name yb-master-n1 --privileged -p 7000:7000 --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --master_addresses=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-master-n1:7100
Adding node yb-master-n1
docker run --name yb-master-n2 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --master_addresses=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-master-n2:7100
Adding node yb-master-n2
docker run --name yb-master-n3 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-master --fs_data_dirs=/mnt/disk0,/mnt/disk1 --master_addresses=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-master-n3:7100
Adding node yb-master-n3
docker run --name yb-tserver-n1 --privileged -p 9000:9000 -p 9042:9042 -p 6379:6379 --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-tserver-n1:9100
Adding node yb-tserver-n1
docker run --name yb-tserver-n2 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-tserver-n2:9100
Adding node yb-tserver-n2
docker run --name yb-tserver-n3 --privileged --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=yb-master-n1:7100,yb-master-n2:7100,yb-master-n3:7100 --rpc_bind_addresses=yb-tserver-n3:9100
Adding node yb-tserver-n3
PID        Type       Node                 URL                       Status          Started At          
11818      tserver    yb-tserver-n3        http://172.19.0.7:9000    Running         2017-11-28T23:33:00.369124907Z
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
11350      master     yb-master-n3         http://172.19.0.4:9000    Running         2017-11-28T23:32:58.899308826Z
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
  • 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 add_node 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

Get the status of the local cluster including the URLs for the admin UIs for the YB-Master and YB-TServer.

$ ./yb-docker-ctl status
PID        Type       Node                 URL                       Status          Started At          
11818      tserver    yb-tserver-n3        http://172.19.0.7:9000    Running         2017-11-28T23:33:00.369124907Z
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
11350      master     yb-master-n3         http://172.19.0.4:9000    Running         2017-11-28T23:32:58.899308826Z
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 node

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
docker run --name yb-tserver-n4 --net yb-net --detach yugabytedb/yugabyte:latest /home/yugabyte/yb-tserver --fs_data_dirs=/mnt/disk0,/mnt/disk1 --tserver_master_addrs=04:7100,04:7100,04:7100 --rpc_bind_addresses=yb-tserver-n4:9100
Adding node yb-tserver-n4

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.

Help

$ ./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

Destroy cluster

The command below destroys the cluster which includes deleting the data directories.

$ ./yb-docker-ctl destroy

Upgrade container image

The command below upgrades the YugaByte DB image to the latest version.

$ docker pull yugabytedb/yugabyte
yb-ctl
docker-compose
YugaByte

SUBSCRIBE TO NEWS

The latest news, tips, blog posts, and resources.

Copyright © 2017-2018 YugaByte, Inc. All rights reserved.

Apache and Apache Cassandra are trademarks of the Apache Software Foundation in the United States and/or other countries. Redis and the Redis logo are the trademarks of Salvatore Sanfilippo in the United States and other countries. No endorsement by these organizations is implied by the use of these marks.