cassandra nodetool : Failed to connect to '127.0.0.1:7199'
Asked Answered
C

5

5

i installed cassandra 3.11.3-1 on centos7 & vmware

i didn't have error while installing cassandra. i started cassandra and faced this logs.

[root@localhost ~]# service cassandra start
Starting cassandra (via systemctl):                        [  OK  ]

[root@localhost ~]# systemctl status cassandra
cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled)
Active: deactivating (stop) (Result: exit-code) since 2018-08-02 15:15:45 
KST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 10366 ExecStart=/etc/rc.d/init.d/cassandra start (code=exited, 
status=0/SUCCESS)
Main PID: 10450 (code=exited, status=3);         : 10478 (cassandra)
Tasks: 2
CGroup: /system.slice/cassandra.service
         └─control
            ├─10478 /bin/bash /etc/rc.d/init.d/cassandra stop
            └─10549 sleep 0.5

 02 15:15:39 localhost.localdomain systemd[1]: Starting LSB: distributed 
 stora....
 02 15:15:39 localhost.localdomain su[10376]: (to cassandra) root on none
 02 15:15:41 localhost.localdomain cassandra[10366]: Starting Cassandra: OK
 02 15:15:41 localhost.localdomain systemd[1]: Started LSB: distributed 
 storag....
  02 15:15:45 localhost.localdomain systemd[1]: cassandra.service: main 
 process...D
 02 15:15:45 localhost.localdomain su[10489]: (to cassandra) root on none
 02 15:15:45 localhost.localdomain cassandra[10478]: Shutdown Cassandra: 
 bash: …
 Hint: Some lines were ellipsized, use -l to show in full.

it means 'cassandra starting is ok' right? but when i check the node status like this "nodetool status"

then i met this logs.

    "] nodetool status" 
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 
Connection refused)

so i searched a lot on google. i found some information. so i tried this.

  1. edit cassandra-env.sh "JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"
  2. expend memory size : 1GB -> 2GB

but i still faced same error.

someone help me please.

------------- system.log ----------------------------------

INFO [main] 2018-08-02 15:15:44,866 YamlConfigurationLoader.java:89 - Configuration location: file:/etc/cassandra/default.conf/cassandra.yaml

ERROR [main] 2018-08-02 15:15:45,043 CassandraDaemon.java:708 - Exception encountered during startup: Invalid yaml: file:/etc/cassandra/default.conf/cassandra.yaml Error: while scanning a simple key; could not found expected ':'; in 'reader', line 601, column 1:

Set listen_address OR listen_i ...

Copperas answered 2/8, 2018 at 6:45 Comment(5)
what your system logs say ?Hemielytron
Adding to Payals comment. The system.log is usually available in /usr/share/cassandra/logs or /var/log/cassandra.Bonnet
@Hemielytron i added system.log aboveCopperas
It says something is wrong in your cassandra.yaml file, can you paste your cassandra.yaml file and full error message from system.log file.Hemielytron
Active: deactivating (stop) (Result: exit-code) since 2018-08-02 15:15:45 seems it's not running.Twirp
I
7

First, you need to make sure that the activated version of OpenJDK should be openjdk-8-jdk. If you have multiple versions of OpenJDK on your machine, then you could follow this tutorial to set a default version (in this case openjdk-8-jdk).

Then, you need to check the status of cassandra service again. The result for activating cassandra service should be as following

enter image description here

After that, you can follow this instruction to modify JVM_OPTS in /etc/cassandra/cassandra-env.sh. In my case, I do not need to follow 2nd step. Finally, when checking status of a node, you should see the result as following

enter image description here

Ieshaieso answered 22/9, 2018 at 13:3 Comment(1)
The above answer didn't completely get it working for me. I had to update permissions for Cassandra. I followed this answer here(askubuntu.com/questions/999834/…) and it go it working. Look for the comment by me(Daniel Blythe) for more info or enter commands sudo chown -R $USER:$GROUP /var/lib/cassandra/ and sudo chown -R $USER:$GROUP /var/log/cassandra/ then $ cassandra on its own presumably to start Cassandra. Then nodetools status and it should work/connectRochette
F
1

The cassandra service takes some time to start. After the install, check whether the service has started by using

service  --status-all 

and you will see something like this

 [ + ]  cassandra
 [ - ]  dbus
 [ ? ]  hwclock.sh
 [ ? ]  kmod
 [ - ]  ntp
 [ - ]  procps
 [ - ]  rsync
 [ - ]  udev
 [ - ]  x11-common

if you see a - sign instead of a + sign next to cassandra, it would mean that service has not yet started. you can start it by issuing this command

service cassandra restart

keep checking the status until you get the a +. Now you should be able to execute the nodetool command

nodetool status

and now you should get the desired result, someething like this

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack 
UN  127.0.0.1  84.76 KiB  16      100.0%            7615cf7e-14cc-4475-bf46-ceeb122b6a12  rack1

this worked for me

Faceoff answered 19/8, 2021 at 12:16 Comment(0)
C
1

When I checked this "systemctl status cassandra" I could see Active: failed as seen below

● cassandra.service - LSB: distributed storage system for structured data Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled) Active: failed (Result: signal) since Fri 2022-01-07 02:28:07 UTC; 10min ago Docs: man:systemd-sysv-generator(8) Main PID: 8239 (code=killed, signal=KILL)

So I changed below parameter in cassandra-env.sh

JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=localhost"

After I changed the parameter I could see this

[root@ip-172-31-28-163 default.conf]# systemctl status cassandra ● cassandra.service - LSB: distributed storage system for structured data Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled) Active: active (running) since Fri 2022-01-07 02:47:27 UTC; 12min ago Docs: man:systemd-sysv-generator(8)

Be sure to do this as root user. Be careful as well

Chara answered 7/1, 2022 at 3:2 Comment(0)
H
0

Check in the file cassandra-env.sh (/etc/cassandra/cassandra-env.sh) if the parameters system_memory_in_mb and system_cpu_cores values is configured acoording your machine capabilites

Henbit answered 5/7, 2021 at 1:0 Comment(0)
S
-1

Another solution. In my case I was installing Cassandra 41x with older Java 8 Version which caused an issue and in case to solve this I installed new Java 11. Just provision right version of Java.

Sovereign answered 25/10, 2022 at 19:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.