【问题标题】:Unable to create role with cassandra 4无法使用 cassandra 4 创建角色
【发布时间】:2022-01-06 22:13:54
【问题描述】:

我以默认 cassandra 用户身份登录时尝试在 Cassandra 中创建角色,但弹出此错误:

[root@node1 ~]# cqlsh -u admin -p admin@123
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 4.0.1 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
admin@cqlsh> CREATE ROLE cassweb WITH PASSWORD = 'Cassweb@1234' AND SUPERUSER = true AND LOGIN = true;
Unauthorized: Error from server: code=2100 [Unauthorized] message="Only superusers can create a role with superuser status"

我还应该注意,我已在 cassandra.yaml 文件中将 authenticator: AllowAllAuthenticator 更改为 authenticator: PasswordAuthenticatorauthorizer: AllowAllAuthorizerauthorizer: CassandraAuthorizer 并在进行这些更改后重新启动了 Cassandra 服务,但错误仍然弹出。

【问题讨论】:

  • 只是一个观察,但 Cassandra 并没有要求它或 cqlsh 以“root”用户身份运行。事实上,创建一个特殊的“cassandra”用户应该是您部署过程的一部分。

标签: cassandra roles cql


【解决方案1】:

我之前看到过该错误消息,它可能是由超出报告的内容引起的。

我还应该注意到我已经更改了...在 cassandra.yaml 文件中

为了彻底起见,请在settings 虚拟表上运行此查询,并确保您得到类似的结果:

> SELECT * FROM system_views.settings
  WHERE name IN ('authenticator','authorizer');

 name          | value
---------------+-----------------------
 authenticator | PasswordAuthenticator
    authorizer |   CassandraAuthorizer

以默认 cassandra 用户身份登录

因此,当我查看您上面的输出时,您的用户名似乎是“admin”,而这不是默认用户。

尝试在system_auth 表上运行此查询:

> SELECT role,is_superuser FROM system_auth.roles;

如果您的用户不是超级用户,那么它将无法创建另一个超级用户。

您可能必须尝试将新用户创建为 cassandra/cassandra 用户。

【讨论】:

    猜你喜欢
    • 2016-02-26
    • 2019-06-08
    • 2015-10-27
    • 2020-10-30
    • 2015-11-05
    • 2016-03-25
    • 2021-12-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多