hibari / clus

Cluster is a simple tool for installing, configuring, and bootstrapping a cluster of nodes - primarily Hibari nodes.
Other
5 stars 4 forks source link

USING THE HIBARI "CLUSTER" TOOL

"Cluster" is a simple tool for installing, configuring, and bootstrapping a cluster of Hibari nodes. Before using this tool, you must:

For guidance on these tasks, see the "Getting Started" chapter in your Hibari Application Developer's Guide. (http://hibari.github.com/hibari-doc/hibari-app-developer-guide.en.html)

This README describes how to configure the Cluster tool, and how to use it to install, start, and stop a Hibari cluster. The information in this README is also available in the "Getting Started" chapter in your Hibari Application Developer's Guide.

NOTE: The Cluster tool should meet the needs of most users. However, this tool's "target node" recipe is currently Linux-centric (e.g. useradd, userdel, ...). Patches and contributions for other OS and platforms are welcome. For non-Linux deployments, the Cluster tool is rather simple so installation can be done manually by following the tool's recipe.

==== Configuring the Cluster Installer Tool

The Cluster tool requires some basic configuration information that indicates how you want your Hibari cluster to be set up. You will create a simple text file that specifies your desired configuration, and then later use the file as input when you run the Cluster tool.

It's simplest to create the file in the same working directory in which you downloaded the cluster tool. You can give the file any name that you want; for purposes of these instructions we will use the file name hibari.config.

Below is a sample hibari.config file. The file that you create must include all of these parameters, and the values must be formatted in the same way as in this example (with parentheses and quotation marks as shown). Parameter descriptions follow the example file.


ADMIN_NODES=(dev1 dev2 dev3) BRICK_NODES=(dev1 dev2 dev3) BRICKS_PER_CHAIN=2

ALL_NODES=(dev1 dev2 dev3) ALL_NETA_ADDRS=("10.181.165.230" "10.181.165.231" "10.181.165.232") ALL_NETB_ADDRS=("10.181.165.230" "10.181.165.231" "10.181.165.232") ALL_NETA_BCAST="10.181.165.255" ALL_NETB_BCAST="10.181.165.255" ALL_NETA_TIEBREAKER="10.181.165.1"

ALL_HEART_UDP_PORT="63099" ALL_HEART_XMIT_UDP_PORT="63100"

For more detail on network monitoring configuration settings, see the partition-detector's OTP application source file (https://github.com/hibari/partition-detector/raw/master/src/partition_detector.app.src).

CAUTION: In a production setting, Network A and Network B should be physically different networks and network interfaces. However, for testing and development purposes the same physical network can be used for Network A and Network B (as in the sample configuration file above).

As final configuration steps, on each Hibari node:


10.181.165.230 dev1.your-domain.com dev1 10.181.165.231 dev2.your-domain.com dev2 10.181.165.232 dev3.your-domain.com dev3

==== Installing Hibari

From your installer node, logged in as the installer user, take these steps to create your Hibari cluster:

  1. In the working directory in which you downloaded the Cluster tool and created your cluster configuration file, place a copy of the Hibari tarball package and md5sum file:

$ cd working-directory $ ls -1 clus hibari-X.Y.Z-DIST-ARCH-WORDSIZE-md5sum.txt hibari-X.Y.Z-DIST-ARCH-WORDSIZE.tgz hibari.config $

  1. Create the "hibari" user on all Hibari nodes:

$ for i in dev1 dev2 dev3 ; do ./clus/priv/clus.sh -f init hibari $i ; done hibari@dev1 hibari@dev2 hibari@dev3

NOTE: If the "hibari" user already exists on the target nodes, the -f option will forcefully delete and then re-create the "hibari" user.

  1. Install the Hibari package on all Hibari nodes, via the newly created "hibari" user:

$ ./clus/priv/clus-hibari.sh -f init hibari hibari.config hibari-X.Y.Z-DIST-ARCH-WORDSIZE.tgz hibari@dev1 hibari@dev2 hibari@dev3

NOTE: By default the Cluster tool installs Hibari into /usr/local/var/lib on the target nodes. If you prefer a different location, before doing the install open the clus.sh script (in your working directory, under /clus/priv/) and edit the CT_HOMEBASEDIR variable.

=== Starting and Stopping a Multi-Node Hibari Cluster

You can use the Cluster installer tool to start and stop your multi-node Hibari cluster, working from the same node from which you managed the installation process. Note that in each of the Hibari commands in this section you'll be referencing the name of the Cluster tool configuration file that you created during the installation procedure.

==== Starting and Bootstrapping the Hibari Cluster

  1. Change to the working directory in which you downloaded the Cluster tool, then start Hibari on all Hibari nodes via the "hibari" user:

$ cd working-directory $ ./clus/priv/clus-hibari.sh -f start hibari hibari.config hibari@dev1 hibari@dev2 hibari@dev3

  1. If this is the first time you've started Hibari, bootstrap the system via the "hibari" user:

$ ./clus/priv/clus-hibari.sh -f bootstrap hibari hibari.config hibari@dev1 => hibari@dev1 hibari@dev2 hibari@dev3

The Hibari bootstrap process starts Hibari's Admin Server on the first eligible admin node and creates a single table "tab1" serving as Hibari's default table. For information about creating additional tables, see "Creating New Tables" in the Hibari Application Developer's Guide.

NOTE: If bootstrapping fails due to "another_admin_server_running" error, please stop the other Hibari cluster(s) running on the network; or reconfigure the Cluster tool to assign Hibari heartbeat listener ports that are not in use by another Hibari cluster or other applications and then repeat the cluster installation procedure.

==== Verifying the Hibari Cluster

Do these simple checks to verify that Hibari is up and running.

  1. Confirm that you can open the "Hibari Web Administration" page:

$ your-favorite-browser http://dev1:23080

  1. Confirm that you can successfully ping each of your Hibari nodes:

$ ./clus/priv/clus-hibari.sh -f ping hibari hibari.config hibari@dev1 ... pong hibari@dev2 ... pong hibari@dev3 ... pong

==== Stopping the Hibari Cluster

Stop Hibari on all Hibari nodes via the "hibari" user:

$ cd working-directory $ ./clus/priv/clus-hibari.sh -f stop hibari hibari.config ok ok ok hibari@dev1 hibari@dev2 hibari@dev3