Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra nodetool could not resolve '127.0.0.1': unknown host

I am very new to cassandra. Just started exploring.

I am running a single node cassandra server & facing a problem in seeing status of the cassandra using nodetool command.

I have hostname configured on my VM as myMachineIP cass1 in /etc/hosts

and

I configured my cassandra_instal_path/conf/cassandra.yaml file with listen_address, rpc_address as localhost and clustername as casscluster

(also tried with my hostname which is cass1 as listen_address/rpc_address)

Not sure what is the reason why i am not able to get statususing nodetool command.

$ nodetool

Cannot resolve '127.0.0.1': unknown host

$ nodetool -host 127.0.0.1

Cannot resolve '127.0.0.1': unknown host

$ nodetool -host cass1

Cannot resolve 'cass1': unknown host

But i am able to connect to cassandra-cli

console output:

Connected to: "casscluster" on 127.0.0.1/9160
Welcome to Cassandra CLI version 1.2.8

Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.

my /etc/hosts looks like:

127.0.0.1       localhost.localdomain   localhost.localdomain   localhost4      localhost4.localdomain4 localhost       cass1

::1     localhost.localdomain   localhost.localdomain   localhost6      localhost6.localdomain6 localhost       cass1


[myMachineIP]  cass1

what could be the reason why i am not able to run nodetool?

Please help.

like image 544
devThoughts Avatar asked Oct 03 '22 22:10

devThoughts


2 Answers

try setting actual IP address in listen_address, rpc_address than localhost

like image 192
Mata Avatar answered Nov 11 '22 21:11

Mata


Let me share my experience with the same problem and a different solution. The root of my problem was that I had changed in cassandra-env.sh the following property:

JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=mynode-00"

To enable the connection through rmi. But my problem was that I'd mispelled the name of the host. After fixing that I was able to connect.

I hope this helps someone!

like image 21
gfournier Avatar answered Nov 11 '22 19:11

gfournier