1

I have two Ubuntu 16.04 nodes on which I installed Cassandra 3.11.3 with java version "1.8.0_181". I want to merge these two nodes into a Cassandra cluster. Their intern ips are 172.16.10.20 and 172.16.10.30.

on each /etc/cassandra/cassandra.yaml file I modified the following lines:

cluster_name: 'my_cluster'
- seeds: "172.16.10.20,172.16.10.30"
listen_address: XXXX
rpc_address: XXXX

where XXXX is respectively the intern ip of the current node.

I then restart Cassandra on each node

sudo service cassandra restart

and check that Cassandra runs :

sudo service cassandra status

 cassandra.service - LSB: distributed storage system for structured data
 Loaded: loaded (/etc/init.d/cassandra; generated)
 Active: active (running) since Wed 2018-08-08 00:31:42 UTC; 3s ago
 Docs: man:systemd-sysv-generator(8)

and the cluster

nodetool status


Datacenter: dc1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address       Load       Tokens       Owns (effective)  Host ID                               Rack
UN  172.16.10.20  190.11 KiB  256          100.0%            84dded4c-c74e-45f4-9481-ff837fec229d  rack1
UN  172.16.10.30  265.06 KiB  256          100.0%            4695fef4-70c7-46b2-a0bd-8b752fe5beb6  rack1

Everything is up and normal.

I want to connect now to Cassandra:

cqlsh

and get:

Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

Some googling later, I want to start cassandra by hand

cassandra

and get (among a huge message):

ERROR [main] 2018-08-07 23:02:51,365 CassandraDaemon.java:708 - Port already in use: 7199; nested exception is: 
java.net.BindException: Address already in use (Bind failed)

It looks like the port 7199 is already in use. I kill the corresponding pid, change in /etc/cassandra/cassandra-env.sh the JMX_PORT to 7200... same issue, the port is said to be in use, plus the error

00:33:06,236 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - openFile(/var/log/cassandra/system.log,true) call failed. java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)

I have changed the permission, but the error remains. At this point of the story I am running out of ideas. What I am trying to achieve seem pretty straighforward so I guess others must have run into a similar issue.

Aaron
  • 55,518
  • 11
  • 116
  • 132
Xavier Prudent
  • 1,570
  • 3
  • 25
  • 54
  • This link might be helpful https://stackoverflow.com/questions/29121904/cassandra-cqlsh-connection-refused – Laxmikant Aug 08 '18 at 03:24
  • try specifying the rpc_address and native_transport_value while running cqlsh – Laxmikant Aug 08 '18 at 03:25
  • Kill the Cassandra process, revert the change you for JMX_PORT set it back to 7199. Start Cassandra freshly. then use "cqlsh 9042 – Payal Aug 08 '18 at 06:48

1 Answers1

1

The nodetool status output says it all here. You had everything running just fine. So revert any changes in terms of port usage.

As your nodetool status reveals that your node IPs are 172.16.10.20 and 172.16.10.30, try running cqlsh and providing one of those IPs. cqlsh tries to connect to 127.0.0.1 by default, which will not work in a plural node cluster.

cqlsh 172.16.10.20 -u yourusername -p yourpassword

Note: You can omit -u and -p if you don't have auth enabled. But if that's true, then you should really change your cluster to enable auth.

Aaron
  • 55,518
  • 11
  • 116
  • 132
  • 1
    That's quite important to know when dealing with several nodes. So nodetool is the command to trust when wondering the cluster is up and normal. Thank you Aaron. – Xavier Prudent Aug 08 '18 at 21:36