Can't run nodetool on my vagrant virtual cassandra cluster

435 views Asked by At

Basically I'm trying to run a simple two node virtual cassandra cluster to experiment with. I'm trying to set it up so all I need to do is run vagrant up and have cassandra up and running.

I've managed to get the actual cluster working (I know this because in one node I create a keyspace and table and inserted a value into it which I was able to access from the other node) but I can't seem to get nodetool to work.

When I run

nodetool -h 192.168.10.11 -p 7000 status

I get the error

nodetool: Failed to connect to '192.168.10.11:7000' - SocketException: 'Connection reset'.

The reason I've changed ports around is to avoid port collisions. (So I changed the jmx_port to 7000 for one node and 7001 for another, I also changed the rpc_port and native_transport_port so that each node is using a unique port)

2

There are 2 answers

0
vicg On BEST ANSWER

Ok I figured out what I needed to fix to get nodetool working.

Firstly you don't need to modify the jmx port setting at all. You also don't need to expose it as a forwarded_port.

Now on how to actually get it working:

In cassandra-env.sh there is a line that is commented out that says:

#JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<hostname>

Uncomment this line and put either the hostname or ip of the node you want nodetool to connect from or the node you want to connect to. Simple as that.

0
Michael Hegner On

For people who still have problems to get Cassandra running on vagrant using Ubuntu, I want to share my shell script what install Java8 and Cassandra. Maybe it helps:

# Update Packages
sudo apt-get update
# sudo apt-get upgrade -y

# Install necassary software
sudo apt-get install software-properties-common python-software-properties debconf-utils curl --assume-yes

# Installing the Oracle Java Virtual Machine
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get install oracle-java8-set-default -y 

# Installing Cassandra
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
sudo apt-get update
sudo apt-get install dsc22=2.2.7-1 cassandra=2.2.7 -y
sudo apt-get install cassandra-tools=2.2.7 -y
sudo chmod 750 /var/run/cassandra
# Configure hostname or ip for nodetool
sudo sed -i 's@# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"@JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"@' /etc/cassandra/cassandra-env.sh
sleep 10

# Status Cassandra And Oracle Java Version
java -version
sudo service cassandra status
sudo nodetool status