Lad*_*odi 2 authentication cassandra
如何在不更改源代码的情况下重置默认的Cassandra凭据?
我检查过类似的问题,例如如何重置丢失的Cassandra管理员用户的密码?.我有三个Datastax Cassandra 2.0.8节点集群,我正在尝试实现身份验证.我在所有节点中设置了cassandra.yaml并重新启动它们.问题是我仍然无法登录到cqlsh.
我还尝试在cqlsh中为cassandra用户重置密码(我已禁用身份验证):
update system_auth.credentials set salted_hash='$2a$10$vbfmLdkQdUz3Rmw.fF7Ygu6GuphqHndpJKTvElqAciUJ4SZ3pwquu' where username='cassandra';
Run Code Online (Sandbox Code Playgroud)
在日志中有关于创建cassandra超级用户的信息.我检查了密钥空间system_auth,它包括凭据,权限和用户.凭证列系列确实包含用户cassandra:
cqlsh> use system_auth;
cqlsh:system_auth> select * from credentials;
username | options | salted_hash
-----------+---------+---------------------------------------------------------- ----
cassandra | null | $2a$10$vbfmLdkQdUz3Rmw.fF7Ygu6GuphqHndpJKTvElqAciUJ4SZ3pw quu
(1 rows)
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试时:
./cqlsh -u cassandra -p cassandra
Run Code Online (Sandbox Code Playgroud)
我得到例外,该用户不存在,但我没有权限创建一个.
cql.cassandra.ttypes.AuthenticationException: AuthenticationException(why="User cassandra doesn't exist - create it with CREATE USER query first")
Run Code Online (Sandbox Code Playgroud)
我不确定,但上面使用的哈希很可能随每个版本而变化,并且可能特定于Cassandra的特定版本.考虑到这一点,你可以(在理论上)在VM中安装相同的版本,然后查询该机器的system_auth.credentialscassandra用户salted_hash.如果不是你上面提到的问题,我从来没有想过尝试过.
否则,下一个选项将起作用.
在每个节点上,cd直到您的data目录,然后执行:
$ mv system_auth system_auth_20140814
重启每个节点.
只要验证器仍然设置(在你的cassandra.yaml中)使用PasswordAuthenticator,Cassandra将system_auth使用默认的Cassandra超级用户重建密钥空间,你可以使用它cqlsh来重新进入.
$ ./cqlsh -u cassandra -p cassandra
Connected to MyCluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.0-rc5-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh>
Run Code Online (Sandbox Code Playgroud)
笔记:
mv)system_auth目录rm.system_auth密钥空间.默认情况下,system_auth复制因子仅为1.| 归档时间: |
|
| 查看次数: |
10729 次 |
| 最近记录: |