如何访问新容器中的 Cassandra docker 卷?

发布于 2025-01-13 11:38:36 字数 226 浏览 3 评论 0原文

更新我的 Cassandra docker 容器后,出现以下错误:

CassandraDaemon.java:911 - 致命配置错误 org.apache.cassandra.exceptions.ConfigurationException:无法将令牌数量从 256 更改为 16

我正在使用 cassandra:最新图像,并且可能更新了其版本,之后每次我尝试再次运行它时,服务器都会关闭。有什么想法吗?

After update my Cassandra docker container it raised the following error:

CassandraDaemon.java:911 - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Cannot change the number of tokens from 256 to 16

I am using cassandra:latest image, and probably its updated its version, and after that the server shutdown every time I try to run it again. Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云柯 2025-01-20 11:38:36

用户在 https://community.datastax.com/questions/13536/ 我在这里重新发布我的答案。


我们不建议将 Cassandra 容器更新到较新的版本。 Cassandra 4.0+ 预先配置了 一个新的默认 16 个虚拟节点 (CASSANDRA-13701):

num_tokens: 16

旧版本的 Cassandra 默认值为 256。一旦 Cassandra 加入集群,就无法更改分配给节点的令牌数量(即使是单个节点) - 节点集群)。正如您已经发现的,更改分配的令牌将阻止 Cassandra 启动。

您需要编辑 cassandra.yaml 才能允许 Cassandra 启动。如果您将容器命名为 cassandra

$ docker ps -a
CONTAINER ID  IMAGE      COMMAND  CREATED  STATUS  PORTS              NAMES
788db79a03d3  cassandra  ...      ...      Up      7000-7001/tcp,...  cassandra

您可以使用以下命令查看 cassandra 容器的配置:

$ docker inspect cassandra

您将看到配置目录设置为:

                "CASSANDRA_CONF=/etc/cassandra",

制作配置文件的本地副本:

$ docker cp cassandra:/etc/cassandra/cassandra.yaml .

编辑本地副本,然后复制容器的修改版本为:

$ docker cp cassandra.yaml cassandra:/etc/cassandra/cassandra.yaml

干杯!

The user asked the same question on https://community.datastax.com/questions/13536/ and I'm re-posting my answer here.


We do not recommend updating a Cassandra container to a newer version. Cassandra 4.0+ is pre-configured with a new default of 16 virtual nodes (CASSANDRA-13701):

num_tokens: 16

Older versions of Cassandra had a default of 256. It is not possible to change the number of tokens allocated to a node once Cassandra has joined a cluster (even for single-node clusters). As you have already discovered, changing the allocated tokens will prevent Cassandra from starting.

You will need to edit the cassandra.yaml in order to allow Cassandra to start. Provided you named your container cassandra:

$ docker ps -a
CONTAINER ID  IMAGE      COMMAND  CREATED  STATUS  PORTS              NAMES
788db79a03d3  cassandra  ...      ...      Up      7000-7001/tcp,...  cassandra

you can view the cassandra container's configuration with:

$ docker inspect cassandra

and you will see that the configuration directory is set to:

                "CASSANDRA_CONF=/etc/cassandra",

Make a local copy of the configuration file:

$ docker cp cassandra:/etc/cassandra/cassandra.yaml .

Edit your local copy then copy the modified version to the the container with:

$ docker cp cassandra.yaml cassandra:/etc/cassandra/cassandra.yaml

Cheers!

墨洒年华 2025-01-20 11:38:36

Cassandra允许最小令牌数量为256,因此只需将cassandra.yaml中的num_tokens修改为256或更高的值,然后重新启动Cassandra

Cassandra allow the min token number is 256, so just modify num_tokens to 256 or higher value in cassandra.yaml, then restart Cassandra

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文