我现在正在运行一个节点。我正在尝试为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"',)})
我已尝试投放nodetool repair
,但它说:Replication factor is 1. No repair is needed for keyspace 'system_auth'
我该如何解决这个问题?
答案 0 :(得分:8)
我设法解决了这个问题。
我必须先运行ALTER KEYSPACE system_auth WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
,因为之前设置为{'class': 'NetworkTopologyStrategy', 'DC1': '1', 'DC2': '1'}
,即使它是单节点群集。
这就是为什么它无法达到QUORUM。
答案 1 :(得分:5)
用户'cassandra'默认情况下始终在system_auth中使用QUORUM。尝试创建一个不同的用户(作为超级用户),你的问题应该消失。
原因是您不能在单个节点cluser上使用QUORUM,请参阅Igors Anwser。
答案 2 :(得分:2)
在1节点(或2节点)配置中,QUORUM是不可能的,不需要修复(因为它用于修复节点之间的数据不一致)
答案 3 :(得分:2)
请遵循以下步骤:
由于将 system_auth 先前设置为{'class':'NetworkTopologyStrategy','DC1':'1','DC2':'1'},所以发生了该问题是一个单节点群集。
答案 4 :(得分:1)
在Cassandra.yaml
文件中,将身份验证切换回authenticator: AllowAllAuthentication
,并确保authorizer: AllowAllAuthorizer
也被设置。这将允许您再次使用cqlsh。连接前将不再检查身份验证。进入cqlsh后,请按照其他答案将所需的复制降低到较低的级别。
答案 5 :(得分:0)
对我来说,解决此问题的方法是进入cqlsh shell,使用遇到问题的键空间,然后运行命令CONSISTENCY QUORUM
答案 6 :(得分:0)