參考http://zhaoyanblog.com/archives/307.html
修改cassandra.yaml配置文件
把默認的
authenticator: AllowAllAuthenticator
改成
authenticator: PasswordAuthenticator
如果你需要登陸進去以后查看修改權限之類,需要修改
authorizer: AllowAllAuthorizer
為
authorizer: CassandraAuthorizer
啟動cassandra
cql連接,cassandra是默認賬戶和密碼
./cqlsh -u cassandra -p cassandra ip port
創建用戶
CREATE USER myusername WITH PASSWORD 'mypassword' SUPERUSER ;
這里用戶有兩種,一個是superuser,一種是nosuperuser
cqlsh退出以后,用新用戶登陸
drop user cassandra;
注意,如果是集群模式,只需要在一台機器上配置就可以了,會自動同步過去