Chapter 9. Using VoltDB in a Cluster


VoltDB Home » Documentation » Using VoltDB

Chapter 9. Using VoltDB in a Cluster

It is possible to run VoltDB on a single server and still get all the advantages of parallelism because VoltDB creates multiple partitions on each server. However, there are practical limits to how much memory or processing power any one server can sustain.

One of the key advantages of VoltDB is its ease of expansion. You can increase both capacity and processing (i.e. the total number of partitions) simply by adding servers to the cluster to achieve almost linear scalability. Using VoltDB in a cluster also gives you the ability to increase the availability of the database — protecting it against possible server failures or network glitches.

This chapter explains how to create a cluster of VoltDB servers running a single database. It also explains how to expand the cluster when additional capacity or processing power is needed. The following chapters explain how to increase the availability of your database through the use of K-safety and database replication, as well as how to enable security to limit access to the data.

9.1. Starting a Database Cluster

As described in Chapter 3, Starting the Database, starting a VoltDB cluster is similar to starting VoltDB on a single server — you use the same commands. Starting a single server database, you simply use the voltdb create command by itself. Or, to customize database features, you can specify a deployment file as well.

To start a cluster you must:

  • Specify the number of nodes in the cluster in the deployment file using the hostcount attribute:

    <cluster  hostcount="5" />
  • Choose one of the nodes as the lead or "host" node and specify that node using the --host argument on the start command

  • Issue the start command on all nodes of the cluster

For example, if you are creating a new five node cluster and choose node server3 as the host, you would issue a command like the following on all five nodes:

$ voltdb create --host=server3 --deployment=deployment.xml

To restart a cluster using commands logs or automatic snapshots, you repeat this process replacing the create action with recover:

$ voltdb recover --host=server3 --deployment=deployment.xml

In both cases you choose one node, any node, to act as the leader for initiating the cluster. Once the database cluster is running the leader's special role is complete and all nodes are peers.