Forum: Building VoltDB Applications

Post: How to run two nodes on the same host?

How to run two nodes on the same host?
vertleyb
Nov 18, 2010
Hi all,

Is it possible to run more than one node on the same host? Where do I specify port?

Thanks,
Arkadiy
re: How to run two nodes on the same host?
tcallaghan
Nov 18, 2010
Arkadiy,

You can run multiple VoltDB processes on the same physical server. Keep in mind that we cannot guarantee k-safety in that configuration so you should do so with your k-factor = 0 or in a non-production environment.

You need to startup your servers with unique client ports (on each server) which can be set by starting VoltDB with the "port" command line argument, as in:
$ java -Xmx2048m -Djava.library.path=~/voltdb-1.2.01/voltdb/ \
org.voltdb.VoltDB  catalog mycatalog.jar deployment deployment.xml \
port 12345



More information is available in our documentation at ServerConfigServerPort

-Tim
OK, thanks. How do I supply
vertleyb
Nov 18, 2010
Arkadiy,

You can run multiple VoltDB processes on the same physical server. Keep in mind that we cannot guarantee k-safety in that configuration so you should do so with your k-factor = 0 or in a non-production environment.

You need to startup your servers with unique client ports (on each server) which can be set by starting VoltDB with the "port" command line argument, as in:



OK, thanks.

How do I supply leader's port in the deployment.xml? :?
re: How to run two nodes on the same host?
tcallaghan
Nov 19, 2010
OK, thanks.

How do I supply leader's port in the deployment.xml? :?


You supply each VoltDB server process a port when you start them, the port you are providing is the on that clients will use to connect to the server. There is another port that VoltDB uses for servers to communicate with each other, VoltDB automatically selects a unique port for this purpose.
So, if you wanted to start two servers you'd do the following in one ssh session on a server (since port is not supplied VoltDB uses the default of 21212):

$ java -Xmx512m -Djava.library.path=~/voltdb-1.2.03/voltdb/ org.voltdb.VoltDB catalog mycatalog.jar deployment deployment.xml

Then on the same server you'd start another VoltDB server process using (this process would be listening for client connections on 12345:

$ java -Xmx512m -Djava.library.path=~/voltdb-1.2.03/voltdb/ org.voltdb.VoltDB catalog mycatalog.jar deployment deployment.xml port 12345

In this configuration (if this was your entire cluster), you'd need to make sure your deployment.xml contains hostcount="2" and sitesperhost= the number of partitions you want for each process.

-Tim
but then, who is the leader
vertleyb
Nov 19, 2010
You supply each VoltDB server process a port when you start them, the port you are providing is the on that clients will use to connect to the server. There is another port that VoltDB uses for servers to communicate with each other, VoltDB automatically selects a unique port for this purpose.
So, if you wanted to start two servers you'd do the following in one ssh session on a server (since port is not supplied VoltDB uses the default of 21212):...-Tim


Thanks. What I still don't understand how VoltDB determines who is the leader. The "leader" parameter in deployment.xml contains the host only, which is same for all nodes...

What am I missing?
re: How to run two nodes on the same host?
tcallaghan
Nov 19, 2010
Thanks. What I still don't understand how VoltDB determines who is the leader. The "leader" parameter in deployment.xml contains the host only, which is same for all nodes...

What am I missing?


Oh.

The "leader" parameter in deployment.xml is there so everyone knows where to "check-in" on startup (they all have to check-in with the leader). The first VoltDB process on the leader node uses a known/fixed port to listen for connections from other servers in your cluster. Everyone is connecting to the leader node on that port.

-Tim
If you starting multiple volt
rbetts
Nov 19, 2010
If you starting multiple volt processes on one host, and that host is configured to be the cluster setup leader, each process will attempt to bind to the leader port. The first will win and become the leader. The remaining processes will fail to bind and will attempt to connect as non-leader nodes.

Once setup is complete, the choice of leader is irrelevant - it is just a simplification for cluster setup.

*--Ryan.
RE: If you starting multiple volt
vertleyb
Nov 19, 2010
If you starting multiple volt processes on one host, and that host is configured to be the cluster setup leader, each process will attempt to bind to the leader port. The first will win and become the leader. The remaining processes will fail to bind and will attempt to connect as non-leader nodes.

Once setup is complete, the choice of leader is irrelevant - it is just a simplification for cluster setup.

*--Ryan.


OK, thanks.
bshaw
Apr 5, 2017
For anyone looking at this thread - the instructions for running multiple copies of VoltDB on the same server have changed. This thread contains up to date instructions:

https://forum.voltdb.com/forum/voltdb-discussions/managing-voltdb/1258-scale-voltdb-on-a-numa-machine?1593-Scale-Voltdb-on-a-NUMA-machine=