Running multiple HMaster instances on the same hardware does not make
sense in a production environment, in the same way that running a pseudo-
distributed cluster does not make sense for production. This step is offered for
testing and learning purposes only.
The HMaster server controls the HBase cluster. You can start up to 9 backup HMaster servers,
which makes 10 total HMasters, counting the primary. To start a backup HMaster, use the local-
master-backup.sh. For each backup master you want to start, add a parameter representing the
port offset for that master. Each HMaster uses two ports (16000 and 16010 by default). The port
offset is added to these ports, so using an offset of 2, the backup HMaster would use ports 16002
and 16012. The following command starts 3 backup servers using ports 16002/16012,
16003/16013, and 16005/16015.
$ ./bin/local-master-backup.sh start 2 3 5
To kill a backup master without killing the entire cluster, you need to find its process ID (PID).
The PID is stored in a file with a name like /tmp/hbase-USER-X-master.pid. The only contents of
the file is the PID. You can use the kill -9 command to kill that PID. The following command
will kill the master with port offset 1, but leave the cluster running:
$ cat /tmp/hbase-testuser-1-master.pid |xargs kill -9
7. Start and stop additional RegionServers
The HRegionServer manages the data in its StoreFiles as directed by the HMaster. Generally, one
HRegionServer runs per node in the cluster. Running multiple HRegionServers on the same
system can be useful for testing in pseudo-distributed mode. The local-regionservers.sh
command allows you to run multiple RegionServers. It works in a similar way to the local-
master-backup.sh command, in that each parameter you provide represents the port offset for
an instance. Each RegionServer requires two ports, and the default ports are 16020 and 16030.
Since HBase version 1.1.0, HMaster doesn’t use region server ports, this leaves 10 ports (16020 to
16029 and 16030 to 16039) to be used for RegionServers. For supporting additional
RegionServers, set environment variables HBASE_RS_BASE_PORT and
HBASE_RS_INFO_BASE_PORT to appropriate values before running script local-
regionservers.sh. e.g. With values 16200 and 16300 for base ports, 99 additional RegionServers
can be supported, on a server. The following command starts four additional RegionServers,
running on sequential ports starting at 16022/16032 (base ports 16020/16030 plus 2).
$ .bin/local-regionservers.sh start 2 3 4 5
To stop a RegionServer manually, use the local-regionservers.sh command with the stop
parameter and the offset of the server to stop.
$ .bin/local-regionservers.sh stop 3
12