Is Cassandra 4.1 not compatible with Ubuntu 20.04?

387 Views Asked by At

I can't make connection into my nodecluster, my nodetool status is currenty refused, i am using Cassandra 4.1 but not working trying edit in cassandra.yaml for localhost using 127.0.0.1 also edit my cassandra-env.sh for public name rename it with localhost too is also not working, so i decided to downgrade into 4.0.7 and working perfectly nothing to change into parameter of cassandra.yaml also cassandra-env.sh

Tools

  1. Cassandra 4.1
  2. Operating system : Ubuntu 20.04
  3. Java version : openjdk version "11.0.17" 2022-10-18 OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu220.04) OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu220.04, mixed mode)

here the code error in my nodetool status

root@myserver:/etc/cassandra# nodetool status
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused (Connection refused)'.

also in my cqlsh not working, only show like this

root@myserver:/etc/cassandra# cqlsh 161.97.96.126 9042
Connection error: ('Unable to connect to any servers', {'161.97.96.126:9042': ConnectionRefusedError(111, "Tried connecting to [('161.97.96.126', 9042)]. Last error: Connection refused")})

i was desperate, but try to install another version means downgrade from 4.1 to 4.0.7 (i make purge remove all my cassandra 4.1 file, installing from the beginning for 4.0.7), then viola nothing to change for the parameter in cassandra.yaml also cassandra-env.sh but works perfectly with my current tools above

Is Cassandra 4.1 is still not compatible with Ubuntu 20.04?

update 23-01-2023 22:10 pm

here my code when i try again installing cassandra 4.1 without edit anything, just fresh install again

root@myvps:~# sudo service cassandra status
● cassandra.service - LSB: distributed storage system for structured data
     Loaded: loaded (/etc/init.d/cassandra; generated)
     Active: active (running) since Mon 2023-01-23 14:49:41 CET; 8s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1644739 ExecStart=/etc/init.d/cassandra start (code=exited, status=0/SUCCESS)
      Tasks: 24 (limit: 9479)
     Memory: 2.2G
     CGroup: /system.slice/cassandra.service
             └─1644848 /usr/bin/java -ea -da:net.openhft... -XX:+UseThreadPriorities -XX:+HeapDumpOnOutOfMemoryError -X>

Jan 23 14:49:41 myvps.contaboserver.net systemd[1]: Starting LSB: distributed storage system for structured data...
Jan 23 14:49:41 myvps.contaboserver.net systemd[1]: Started LSB: distributed storage system for structured data.

root@myvps:~# sudo service cassandra status
● cassandra.service - LSB: distributed storage system for structured data
     Loaded: loaded (/etc/init.d/cassandra; generated)
     Active: active (exited) since Mon 2023-01-23 14:49:41 CET; 31s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1644739 ExecStart=/etc/init.d/cassandra start (code=exited, status=0/SUCCESS)

Jan 23 14:49:41 myvps.contaboserver.net systemd[1]: Starting LSB: distributed storage system for structured data...
Jan 23 14:49:41 myvps.contaboserver.net systemd[1]: Started LSB: distributed storage system for structured data.
root@myvps:~# nodetool version
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused (Connection refused)'.
root@myvps:~# cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': ConnectionRefusedError(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

Update 23-01-2023 22:16 PM i try accessing 2 thing netstat -tnlp and show this

root@myvps:~# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      537/redis-server 12
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      598/nginx: master p
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      447/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      534/sshd: /usr/sbin
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      578/postgres
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      598/nginx: master p
tcp6       0      0 ::1:6379                :::*                    LISTEN      537/redis-server 12
tcp6       0      0 :::80                   :::*                    LISTEN      598/nginx: master p
tcp6       0      0 :::22                   :::*                    LISTEN      534/sshd: /usr/sbin
tcp6       0      0 ::1:5432                :::*                    LISTEN      578/postgres
tcp6       0      0 :::443                  :::*                    LISTEN      598/nginx: master p

and also type sudo lsof -nPi -sTCP:LISTEN will show this

root@myvps:~# sudo lsof -nPi -sTCP:LISTEN
COMMAND   PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 447 systemd-resolve   13u  IPv4  18529      0t0  TCP 127.0.0.53:53 (LISTEN)
sshd      534            root    3u  IPv4  18387      0t0  TCP *:22 (LISTEN)
sshd      534            root    4u  IPv6  18389      0t0  TCP *:22 (LISTEN)
redis-ser 537           redis    6u  IPv4  20184      0t0  TCP 127.0.0.1:6379 (LISTEN)
redis-ser 537           redis    7u  IPv6  20185      0t0  TCP [::1]:6379 (LISTEN)
postgres  578        postgres    5u  IPv6  20704      0t0  TCP [::1]:5432 (LISTEN)
postgres  578        postgres    6u  IPv4  20705      0t0  TCP 127.0.0.1:5432 (LISTEN)
nginx     598            root    6u  IPv6  18878      0t0  TCP *:443 (LISTEN)
nginx     598            root    7u  IPv4  18879      0t0  TCP *:443 (LISTEN)
nginx     598            root    8u  IPv4  18880      0t0  TCP *:80 (LISTEN)
nginx     598            root    9u  IPv6  18881      0t0  TCP *:80 (LISTEN)
nginx     601        www-data    6u  IPv6  18878      0t0  TCP *:443 (LISTEN)
nginx     601        www-data    7u  IPv4  18879      0t0  TCP *:443 (LISTEN)
nginx     601        www-data    8u  IPv4  18880      0t0  TCP *:80 (LISTEN)
nginx     601        www-data    9u  IPv6  18881      0t0  TCP *:80 (LISTEN)
nginx     602        www-data    6u  IPv6  18878      0t0  TCP *:443 (LISTEN)
nginx     602        www-data    7u  IPv4  18879      0t0  TCP *:443 (LISTEN)
nginx     602        www-data    8u  IPv4  18880      0t0  TCP *:80 (LISTEN)
nginx     602        www-data    9u  IPv6  18881      0t0  TCP *:80 (LISTEN)
nginx     603        www-data    6u  IPv6  18878      0t0  TCP *:443 (LISTEN)
nginx     603        www-data    7u  IPv4  18879      0t0  TCP *:443 (LISTEN)
nginx     603        www-data    8u  IPv4  18880      0t0  TCP *:80 (LISTEN)
nginx     603        www-data    9u  IPv6  18881      0t0  TCP *:80 (LISTEN)
nginx     604        www-data    6u  IPv6  18878      0t0  TCP *:443 (LISTEN)
nginx     604        www-data    7u  IPv4  18879      0t0  TCP *:443 (LISTEN)
nginx     604        www-data    8u  IPv4  18880      0t0  TCP *:80 (LISTEN)
nginx     604        www-data    9u  IPv6  18881      0t0  TCP *:80 (LISTEN)
2

There are 2 best solutions below

1
Erick Ramirez On

I can confirm that Cassandra 4.1 works on the latest versions of Ubuntu including 20.04 LTS and 22.04 LTS.

I didn't run into any issues installing/running Cassandra 4.1 out-of-the-box. You didn't specify the steps to replicate the problem so I'm assuming all you've done is perform a fresh installation of Cassandra 4.1. In any case, I followed the Installing Cassandra instructions documented in the official website and it just worked.

For what it's worth, I installed the same version of Java 11 as you:

openjdk version "11.0.17" 2022-10-18

Zero config change

After installing Cassandra 4.1 with NO configuration changes, I am able to run nodetool commands as expected:

$ nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load        Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  104.37 KiB  16      100.0%            0a7969a9-0d00-42f1-a574-87dfde5e3e7d  rack1
$ nodetool version
ReleaseVersion: 4.1.0

I am also able to connect to the cluster with cqlsh:

Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.1.0 | Cassandra 4.1.0 | CQL spec 3.4.6 | Native protocol v5]
Use HELP for help.
cqlsh>

Configure IP addresses

In an attempt to replicate what you did, I updated cassandra.yaml with the IP address of my test machine:

seed_provider:
  - class_name: org.apache.cassandra.locator.SimpleSeedProvider
    parameters:
      - seeds: "10.1.2.3:7000"
listen_address: 10.1.2.3
rpc_address: 10.1.2.3

After starting Cassandra, I am again able to run nodetool commands as expected:

$ nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address   Load     Tokens  Owns (effective)  Host ID                               Rack
UN  10.1.2.3  136 KiB  16      100.0%            0a7969a9-0d00-42f1-a574-87dfde5e3e7d  rack1

I am also able to connect to the cluster with cqlsh:

$ cqlsh 10.1.2.3
Connected to Test Cluster at 10.1.2.3:9042
[cqlsh 6.1.0 | Cassandra 4.1.0 | CQL spec 3.4.6 | Native protocol v5]
Use HELP for help.
cqlsh>

Conclusion

The most likely reason you're not able to connect to your cluster is that Cassandra is not running on the node. You can easily verify it with Linux utilities like lsof and netstat:

$ sudo lsof -nPi -sTCP:LISTEN
$ netstat -tnlp

You will need to check the Cassandra system.log for clues as to why is it is not running.

If you specified an IP address in listen_address, make sure that you also update the seeds list with the same IP address otherwise Cassandra will shutdown because it is unable to gossip with the seeds. Cheers!


Please support the Apache Cassandra community by hovering over the tag then click on the Watch tag button. Thanks!

0
xianzhe On

I recommend that you do not install Cassandra on an unsupported version of Ubuntu. both Cassandra 4 and 3 are only supported on 16.04~18.04. I installed Cassandra 3.11.3 on Ubuntu 22.04, and found serious performance issues, compared to Ubuntu 16.04 with the same configurations, the performance of read and write is several times worse.

Here are the tests:

  • Two VMs, 2c4G, 20G SSD
  • One with Ubuntu 22.04 installed, the other with Ubuntu 16.04, both with Cassandra 3.11.3 installed as a binary (I also tested a docker install, again with a several-fold difference in performance)

Test command:

  • cassandra-stress write n=1000000 -graph file=docker-write-graph title="docker-write"
  • cassandra-stress read n=1000000 -graph file=binary-read-graph title="binary-read"

Result:

write:

write on ubuntu16.04 write on ubuntu16.04 write on ubuntu22.04 write on ubuntu22.04

read read on ubuntu16.04 read on ubuntu16.04 read on ubuntu22.04 read on ubuntu22.04

As you can see, Ubuntu 22.04 is much different from Ubuntu 16.04, both in terms of reading and writing.

Although the one I tested is not the Ubuntu 20.04 you are using, you can try it yourself. You can use docker to quickly deploy one for testing.