2. Create a local cluster
Create a local cluster
To create a 1-node cluster with a replication factor (RF) of 1, run the following command.
$ docker run -d --name yugabyte -p7000:7000 -p9000:9000 -p5433:5433 -p9042:9042\
yugabytedb/yugabyte:latest bin/yugabyted start\
--daemon=false
In the preceding docker run
command, the data stored in YugabyteDB doesn't persist across container restarts. To make YugabyteDB persist data across restarts, add a volume mount option to the docker run command.
First, create a ~/yb_data
directory:
$ mkdir ~/yb_data
Next, run docker with the volume mount option:
$ docker run -d --name yugabyte \
-p7000:7000 -p9000:9000 -p5433:5433 -p9042:9042 \
-v ~/yb_data:/home/yugabyte/yb_data \
yugabytedb/yugabyte:latest bin/yugabyted start \
--base_dir=/home/yugabyte/yb_data --daemon=false
Clients can now connect to the YSQL and YCQL APIs at localhost:5433
and localhost:9042
respectively.
Check cluster status
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5088ca718f70 yugabytedb/yugabyte "bin/yugabyted start…" 46 seconds ago Up 44 seconds 0.0.0.0:5433->5433/tcp, 6379/tcp, 7100/tcp, 0.0.0.0:7000->7000/tcp, 0.0.0.0:9000->9000/tcp, 7200/tcp, 9100/tcp, 10100/tcp, 11000/tcp, 0.0.0.0:9042->9042/tcp, 12000/tcp yugabyte
Check cluster status with Admin UI
Under the hood, the cluster you have just created consists of two processes: YB-Master which keeps track of various metadata (list of tables, users, roles, permissions, and so on), and YB-TServer which is responsible for the actual end user requests for data updates and queries.
Each of the processes exposes its own Admin UI that can be used to check the status of the corresponding process, and perform certain administrative operations. The yb-master Admin UI is available at http://localhost:7000 and the yb-tserver Admin UI is available at http://localhost:9000. To avoid port conflicts, you should make sure other processes on your machine do not have these ports mapped to localhost
.
Overview and YB-Master status
The YB-Master home page shows that you have a cluster (or universe) with a replication factor of 1, a single node, and no tables. The YugabyteDB version is also displayed.
The Masters section highlights the 1 YB-Master along with its corresponding cloud, region, and zone placement.
YB-TServer status
Click See all nodes to go to the Tablet Servers page, which lists the YB-TServer along with the time since it last connected to the YB-Master using regular heartbeats.