Start YB-Masters
This section covers deployment for a single region or data center in a multi-zone/multi-rack configuration. Note that single zone configuration is a special case of multi-zone where all placement-related flags are set to the same value across every node.
For instructions on running a single cluster across multiple data centers or 2 clusters in 2 data centers, refer to Multi-DC deployments.
For information about YB-Master, refer to YB-Master service.
Example scenario
- Create a six-node cluster with replication factor of
3
.- YB-Master server should run on only three nodes, the YB-TServer server should run on all six nodes.
- Assume the three YB-Master private IP addresses are
172.151.17.130
,172.151.17.220
and172.151.17.140
. - Cloud will be
aws
, region will beus-west
, and the three AZs will beus-west-2a
,us-west-2b
, andus-west-2c
. Two nodes will be placed in each AZ in such a way that one replica for each tablet (aka shard) gets placed in any one node for each AZ.
- Multiple data drives mounted on
/home/centos/disk1
,/home/centos/disk2
.
Run YB-Master servers with command line flags
The number of nodes in a cluster running YB-Masters must equal the replication factor.
Run the yb-master server on each of the three nodes as follows.
$ ./bin/yb-master \
--master_addresses 172.151.17.130:7100,172.151.17.220:7100,172.151.17.140:7100 \
--rpc_bind_addresses 172.151.17.130:7100 \
--fs_data_dirs "/home/centos/disk1,/home/centos/disk2" \
--placement_cloud aws \
--placement_region us-west \
--placement_zone us-west-2a \
>& /home/centos/disk1/yb-master.out &
The number of comma-separated addresses in --master_addresses
should equal the replication factor.
You can specify multiple directories using the --fs_data_dirs
flag. Replace the --rpc_bind_addresses
value with the private IP address of the host, and set the placement_cloud
, placement_region
, and placement_zone
values appropriately. For single zone deployment, use the same value for the placement_zone
flag.
TP
Highly accurate clocks can be configured by specifying --time_source=clockbound
. Requires system configuration.
For the full list of configuration flags, see the YB-Master reference.
Run YB-Master servers with configuration file
Alternatively, you can also create a master.conf
file with the following flags and then run yb-master with the --flagfile
option as shown below. For each YB-Master server, replace the --rpc-bind-addresses
configuration flag with the private IP address of the YB-Master server.
--master_addresses=172.151.17.130:7100,172.151.17.220:7100,172.151.17.140:7100
--rpc_bind_addresses=172.151.17.130:7100
--fs_data_dirs=/home/centos/disk1,/home/centos/disk2
--placement_cloud=aws
--placement_region=us-west
--placement_zone=us-west-2a
$ ./bin/yb-master --flagfile master.conf >& /home/centos/disk1/yb-master.out &
Verify health
Make sure all the three YB-Masters are now working as expected by inspecting the INFO log. The default logs directory is always inside the first directory specified in the --fs_data_dirs
flag.
$ cat /home/centos/disk1/yb-data/master/logs/yb-master.INFO
You can see that the three YB-Masters were able to discover each other and were also able to elect a Raft leader among themselves (the remaining two act as Raft followers).
For the masters that become followers, you will see the following line in the log.
I0912 16:11:07.419591 8030 sys_catalog.cc:332] T 00000000000000000000000000000000 P bc42e1c52ffe4419896a816af48226bc [sys.catalog]: This master's current role is: FOLLOWER
For the master that becomes the leader, you will see the following line in the log.
I0912 16:11:06.899287 27220 raft_consensus.cc:738] T 00000000000000000000000000000000 P 21171528d28446c8ac0b1a3f489e8e4b [term 2 LEADER]: Becoming Leader. State: Replica: 21171528d28446c8ac0b1a3f489e8e4b, State: 1, Role: LEADER
Next step
Now you are ready to start the YB-TServers.