AttentionThis page documents an earlier version. Go to the latest (v2.2)version.
- For any cluster, the number of nodes on which the YB-Masters need to be started on must equal the replication factor.
- The number of comma seperated addresses present in
master_addressesshould also equal the replication factor.
Let us assume the following.
- We want to create a a 4 node cluster with replication factor
3. - We would need to run the YB-Master process on only three of the nodes say
node-c- Let us assume their private IP addresses are
- We have multiple data drives mounted on
This section covers deployment for a single region/zone (or a single datacenter/rack). Execute the following steps on each of the instances.
Run yb-master with command line params
yb-masterbinary on each of the nodes as shown below. Note how multiple directories can be provided to the
--fs_data_dirsflag. For each yb-master, replace the rpc bind address flag with the private IP of the host running the yb-master.
For the full list of flags, see the yb-master Reference.
$ ./bin/yb-master \ --master_addresses 126.96.36.199:7100,188.8.131.52:7100,184.108.40.206:7100 \ --rpc_bind_addresses 220.127.116.11 \ --fs_data_dirs "/home/centos/disk1,/home/centos/disk2" \ >& /home/centos/disk1/yb-master.out &
Run yb-master with conf file
- Alternatively, you can also create a
master.conffile with the following flags and then run the
--flagfileoption as shown below. For each yb-master, replace the rpc bind address flag with the private IP of the host running the yb-master.
--master_addresses=18.104.22.168:7100,22.214.171.124:7100,126.96.36.199:7100 --rpc_bind_addresses=188.8.131.52 --fs_data_dirs=/home/centos/disk1,/home/centos/disk2
$ ./bin/yb-master --flagfile master.conf >& /home/centos/disk1/yb-master.out &
- Make sure all the 3 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 3 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 we are ready to start the yb-tservers.