Cassandra 4.1 与 Ubuntu 20.04 不兼容吗?

问题描述 投票:0回答:2

我无法连接到我的nodecluster,我的nodetool状态当前被拒绝,我正在使用Cassandra 4.1,但无法尝试使用127.0.0.1在本地主机的cassandra.yaml中进行编辑,还可以编辑我的cassandra-env.sh以进行公共名称重命名它与 localhost 也不起作用,所以我决定降级到 4.0.7,并且完美运行,无需更改 cassandra.yaml 的参数以及 cassandra-env.sh

工具

  1. 卡桑德拉 4.1
  2. 操作系统:Ubuntu 20.04
  3. Java版本:openjdk版本“11.0.17”2022年10月18日OpenJDK运行时 环境(build 11.0.17+8-post-Ubuntu-1ubuntu220.04)OpenJDK 64 位服务器 VM(内部版本 11.0.17+8-post-Ubuntu-1ubuntu220.04,混合 模式)

这里是我的nodetool状态中的代码错误

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

也在我的 cqlsh 中不起作用,只显示这样

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")})

我很绝望,但尝试安装另一个版本意味着从4.1降级到4.0.7(我让purge删除所有我的cassandra 4.1文件,从头开始安装4.0.7),然后viola对cassandra中的参数没有任何改变.yaml 也是 cassandra-env.sh 但与我当前的上述工具完美配合

Cassandra 4.1 仍然不兼容 Ubuntu 20.04 吗?

更新23-01-2023 22:10 pm

这是我再次尝试安装 cassandra 4.1 时的代码,无需编辑任何内容,只需再次全新安装

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")})

更新2023年1月23日 22:16 我尝试访问 2 件事

netstat -tnlp
并展示这个

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

并且还输入

sudo lsof -nPi -sTCP:LISTEN
将显示此

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)
cassandra cqlsh nodetool
2个回答
1
投票

我可以确认 Cassandra 4.1 适用于最新版本的 Ubuntu,包括 20.04 LTS 和 22.04 LTS。

我在安装/运行开箱即用的 Cassandra 4.1 时没有遇到任何问题。您没有指定复制问题的步骤,因此我假设您所做的只是执行 Cassandra 4.1 的全新安装。无论如何,我按照官方网站上记录的安装 Cassandra 说明进行操作,结果就成功了。

无论如何,我安装了与您相同版本的 Java 11:

openjdk version "11.0.17" 2022-10-18

零配置更改

安装 Cassandra 4.1 后无需更改任何配置,我可以按预期运行

nodetool
命令:

$ 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

我还可以使用

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>

配置IP地址

为了复制您所做的事情,我用我的测试机器的 IP 地址更新了

cassandra.yaml

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

启动 Cassandra 后,我再次能够按预期运行

nodetool
命令:

$ 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

我还可以使用

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>

结论

您无法连接到集群的最可能原因是 Cassandra 未在节点上运行。您可以使用

lsof
netstat
等 Linux 实用程序轻松验证它:

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

您需要检查 Cassandra

system.log
以获取有关其为何未运行的线索。

如果您在

listen_address
中指定了 IP 地址,请确保您还使用相同的 IP 地址更新种子列表,否则 Cassandra 将关闭,因为它无法与种子进行八卦。干杯!


👉 请将鼠标悬停在 标签上,然后单击

Watch tag
按钮来支持 Apache Cassandra 社区。 🙏谢谢!


0
投票

我建议您不要在不受支持的 Ubuntu 版本上安装 Cassandra。 Cassandra 4 和 3 仅在 16.04~18.04 上受支持。我在Ubuntu 22.04上安装了Cassandra 3.11.3,发现严重的性能问题,与相同配置的Ubuntu 16.04相比,读写性能差了好几倍。

以下是测试:

  • 两个虚拟机,2c4G,20G SSD
  • 一个安装了 Ubuntu 22.04,另一个安装了 Ubuntu 16.04,两者都安装了 Cassandra 3.11.3 作为二进制文件(我还测试了 docker 安装,性能也有好几倍的差异)

测试命令:

  • cassandra-stress write n=1000000 -graph file=docker-write-graph 标题=“docker-write”
  • cassandra-stress read n=1000000 -graph file=binary-read-graph 标题=“二进制读取”

结果:

写:

在ubuntu16.04上写 在ubuntu22.04上写

阅读 在ubuntu16.04上阅读 在ubuntu22.04上阅读

如您所见,Ubuntu 22.04 与 Ubuntu 16.04 相比,无论是在阅读还是写作方面都有很大的不同。

虽然我测试的不是你使用的Ubuntu 20.04,但是你可以自己尝试一下。您可以使用docker快速部署一个进行测试。

© www.soinside.com 2019 - 2024. All rights reserved.