如何在 Cassandra DB 中创建第一个用户 [英] How do you create the first user in Cassandra DB

查看:37
本文介绍了如何在 Cassandra DB 中创建第一个用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 cassandra 数据库中创建第一个用户?

How does one create the first user in a cassandra database?

我试过了:

CREATE USER username WITH PASSWORD "";

它说:

Bad Request: Only superusers are allowed to perform CREATE USER queries

但在此尝试之前我从未创建过用户,那么如何在 cassandra 数据库中创建第一个用户?

But I have never created a user before this attempt, so how do you create the first user in a cassandra database?

这看起来有点奇怪,因为它就像是先有鸡还是先有蛋的问题,但人们使用 Cassandra,所以我相信一定有解决方案.

This seems a little strange because it's like a chicken and egg problem, but people use Cassandra so I am sure there must be a solution somewhere.

推荐答案

启用身份验证和授权后,您可以像这样以默认 Cassandra 管理员用户身份登录(到本地 Cassandra 实例):

Once you have enabled Authentication and Authorization, you can log-in (to your local Cassandra instance) as the default Cassandra admin user like this:

./cqlsh localhost -u cassandra -p cassandra

如果您在 Windows Server 上运行 Cassandra,我相信 您需要调用它使用 Python:

If you are running Cassandra on a Windows Server, I believe you need to invoke it with Python:

python cqlsh localhost -u cassandra -p cassandra

进入后,您的首要任务应该是创建另一个超级用户帐户.

Once you get in, your first task should be to create another super user account.

CREATE USER dba WITH PASSWORD 'bacon' SUPERUSER;

接下来,将当前 Cassandra 超级用户的密码设置为其他东西是一个非常好的主意……最好是长而难以理解的东西.有了新的超级用户,您就不再需要默认的 Cassandra 帐户了.

Next, it is a really good idea to set the current Cassandra super user's password to something else...preferably something long and incomprehensible. With your new super user, you shouldn't need the default Cassandra account again.

ALTER USER cassandra WITH PASSWORD 'dfsso67347mething54747long67a7ndincom4574prehensi562ble';

有关更多信息,请查看这篇 DataStax 文章:DataStax Enterprise 和 Apache Cassandra 中的内部身份验证和授权安全快速浏览

For more information, check out this DataStax article: A Quick Tour of Internal Authentication and Authorization Security in DataStax Enterprise and Apache Cassandra

这篇关于如何在 Cassandra DB 中创建第一个用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆