Search code examples
dockersqlcmdvoltdb

Connection to voltdb within container fails with connection refused


According to the information on docker hub (https://hub.docker.com/r/voltdb/voltdb-community/) I was able to start the three nodes after adding the nodenames to my /etc/hosts file. Commands I executed:

docker pull voltdb/voltdb-community:latest

docker network create -d bridge voltLocalCluster
docker run -d -P -e HOST_COUNT=3 -e HOSTS=node1,node2,node3 --name=node1 --network=voltLocalCluster voltdb/voltdb-community:latest
docker run -d -P -e HOST_COUNT=3 -e HOSTS=node1,node2,node3 --name=node2 --network=voltLocalCluster voltdb/voltdb-community:latest
docker run -d -P -e HOST_COUNT=3 -e HOSTS=node1,node2,node3 --name=node3 --network=voltLocalCluster voltdb/voltdb-community:latest
docker exec -it node1 bash

sqlcmd
> Output:
Unable to connect to VoltDB cluster
    localhost:21212 - Connection refused

According to log files the voltdb has started and is running normally. Does anyone have an idea why the connection is refused?


Solution

  • You have to follow the given example and fix your HOSTS argument.

    It should be HOSTS=node1,node2,node3 instead of yours, thus you let your service know about all nodes in cluster.