- The number of nodes in a cluster running YB-Masters must equal the replication factor.
- The number of comma-separated addresses present in
master_addressesshould also equal the replication factor.
- For running a single cluster across multiple data centers or 2 clusters in 2 data centers, refer to the Multi-DC deployments section.
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.
- Create a six-node cluster with replication factor of
3. - YB-Master server should run on only three nodes, but as noted in the next section, the YB-TServer server should run on all six nodes. - Assume the three YB-Master private IP addresses are
126.96.36.199. - Cloud will be
aws, region will be
us-west, and the three AZs will be
us-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
Run YB-Master servers with command line flags
yb-master server on each of the three nodes as shown below. Note how multiple directories can be provided to the
--fs_data_dirs flag. Replace the
--rpc_bind_addresses value with the private IP address of the host as well as the set the
placement_zone values appropriately. For single zone deployment, use the same value for the
$ ./bin/yb-master \ --master_addresses 188.8.131.52:7100,184.108.40.206:7100,220.127.116.11:7100 \ --rpc_bind_addresses 18.104.22.168: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 &
For the full list of configuration flag), 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=22.214.171.124:7100,126.96.36.199:7100,188.8.131.52:7100 --rpc_bind_addresses=184.108.40.206: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 &
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
$ 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
TipRemember to add the command with which you launched
yb-masterto a cron to restart it if it goes down.
Now you are ready to start the YB-TServers.