Cassandra - 无法达到一致性等级QUORUM

J D*_*Del 7 cassandra

我目前正在运行一个节点.我正在尝试为Cassandra启用密码身份验证.

我正在关注本指南:http://cassandra.apache.org/doc/latest/operating/security.html#password-authentication

我会注意到我没有改变system_auth复制,因为它是一个单节点集群.

我编辑cassandra.yaml使用authenticator: PasswordAuthenticator.

然后我重新启动cassandra并尝试了命令cqlsh -u cassandra -p cassandra,但这给了我错误:

Connection error: ('Unable to connect to any servers',
{'127.0.0.1': AuthenticationFailed(u'Failed to authenticate to 127.0.0.1: 
code=0100 [Bad credentials] message="org.apache.cassandra.exceptions.
UnavailableException: Cannot achieve consistency level QUORUM"',)})
Run Code Online (Sandbox Code Playgroud)

我试过跑,nodetool repair但它说:Replication factor is 1. No repair is needed for keyspace 'system_auth'

我该如何解决这个问题?

J D*_*Del 11

我设法解决了这个问题.

我必须ALTER KEYSPACE system_auth WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };{'class': 'NetworkTopologyStrategy', 'DC1': '1', 'DC2': '1'}以前设置的那样运行,即使它是单节点集群.

这就是它无法达到QUORUM的原因.

  • 如果无法连接到cqlsh,如何运行ALTER KEYSPACE? (5认同)
  • 只需在 cassandra.yaml 中更改为 `authenticator:AllowAllAuthenticator` 并无需凭据即可登录。 (2认同)

小智 8

请按照以下步骤操作:

  1. 将/etc/cassandra/cassandra.yaml 文件中的身份验证器设置为AllowAllAuthenticator
  2. 重新启动 cassandra sudo 服务 cassandra restart
  3. 运行以下命令 cqlsh ALTER KEYSPACE system_auth WITHreplication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
  4. 现在再次将身份验证器更改回PasswordAuthenticator
  5. 重新启动 cassandra sudo 服务 cassandra restart
  6. 现在您将可以使用以下命令登录 cqlsh -u cassandra -p cassandra

由于之前将system_auth设置为 {'class': 'NetworkTopologyStrategy', 'DC1': '1', 'DC2': '1'},因此出现了此问题,即使它是单节点集群。


Man*_*nke 5

http://docs.datastax.com/en/datastax_enterprise/4.8/datastax_enterprise/sec/secConfiguringInternalAuthentication.html

默认情况下,用户“ cassandra”始终在system_auth中使用QUORUM。尝试创建其他用户(以超级用户身份),您的问题应该消失了。

原因是您不能在单个节点cluser上拥有QUORUM,请参见Igors Anwser。