【问题标题】:how to degrade cassandra cluster to standalone如何将 cassandra 集群降级为独立集群
【发布时间】:2023-05-01 08:18:01
【问题描述】:

我已经设置了具有两个节点 node1 和 node2 的 cassandra 集群。 node1 是种子节点。

我想从集群中停用 node2。

系统认证配置

KEYSPACE system_auth WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '2'}  AND durable_writes = true;

我已经从下面更改了我的键空间 my_data 的配置

KEYSPACE my_data WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '2'}  AND durable_writes = true;

KEYSPACE my_data WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '1'}  AND durable_writes = true;

更改配置后,我对system_authmy_data 进行了全面修复。

使用nodetool -h node2 -pw somepassword -u someuser decommission 停用 node2 后,通过 cqlsh 连接到 node1 时出现以下错误。

Connection error: ('Unable to connect to any servers', {'node1': AuthenticationFailed('Failed to authenticate to node1: Error from server: code=0100 [Bad credentials] message="org.apache.cassandra.exceptions.UnavailableException: Cannot achieve consistency level QUORUM"',)})

我正在使用相同的凭据,但无法登录。您能否建议更改正确的配置以及执行此操作的过程?

【问题讨论】:

  • 我在这里看到两种可能性:您尝试登录的用户没有完全复制到所有节点(也许您在更改 SYSTEM_AUTH 上的 RF=2 之前创建了用户并且修复从未运行),并且您停用了具有数据的节点,或者您的 CL 高于身份验证数据的节点数。我几乎认为这是第一个。无论如何,如果它是第一个(您取消的节点有数据,而其余节点没有),那么您可以在 dse.yaml 中禁用身份验证(假设 dse,但不确定),然后“修复”用户(更改用户..)。你用的是 dse 还是 apache?

标签: cassandra datastax datastax-enterprise cassandra-3.0 cqlsh


【解决方案1】:
  1. 停用 node2 后,我已删除身份验证以 Cassandra 服务器重启了服务器。
  2. 这让我可以连接到 Cassandra,之后我将 system_auth 密钥空间拓扑更改为 SimpleStrategy,replication_factor 为 1。然后我修复了 system_auth 密钥空间
  3. 然后重新启动 Cassandra 服务器并再次修复 system_auth 密钥空间。
  4. 现在我可以使用用户名和密码进行连接了。

移除认证过程

authenticator: AllowAllAuthenticator
authorizer: AllowAllAuthorizer

命令:-

nodetool -h nodetool -pw somepassword -u someuser decommission
nodetool repair system_auth

【讨论】: