适应于cassandra2.0以上的版本
1、首先修改配置文件 cassandra.yaml
把默认的authenticator: AllowAllAuthenticator运行所有人登录设置为用密码登录:
authenticator: PasswordAuthenticator
2、登录cassandra创建用户
使用默认账户登录cassandra
在bin目录下执行
./cqlsh -ucassandra -pcassandra
创建用户
CREATE USER myusername WITH PASSWORD 'mypassword' SUPERUSER ;
3、使用新用户登录
删除默认帐号:
DROP USER cassandra ;
4、java使用用户名密码访问cassandra
Cluster cluster = Cluster.builder()
.addContactPoint("192.168.22.161")
.withCredentials("myusername", "mypassword")
.build();
Cassandra设置用户名和密码指南
本文介绍了在Cassandra 2.0以上版本中如何设置用户名和密码,包括修改cassandra.yaml配置文件,使用PasswordAuthenticator,创建用户,以及通过新用户登录和删除默认账户的步骤。
1050

被折叠的 条评论
为什么被折叠?



