【问题标题】:How to create an Index of a bucket which is having password authentication in Couchbase server through cbq?如何通过 cbq 在 Couchbase 服务器中创建具有密码身份验证的存储桶的索引?
【发布时间】:2016-10-03 17:04:21
【问题描述】:

如何通过cbq在Couchbase服务器中创建一个具有密码认证的桶的索引?

bucketName,password上创建主索引;

不工作?

【问题讨论】:

  • 能否更正问题标题中 Couchbase 的拼写?

标签: node.js couchbase n1ql


【解决方案1】:

假设您的存储桶名称是 bucket1,存储桶上的密码是 abc123。

这就是我们在 cbq 会话中使用 cbq 创建索引/查询该存储桶的方式。 (正如 Gerald 建议的那样,使用 \SET 命令)

cbq> \SET -creds bucket1:abc123;
cbq> create primary index on bucket1;
cbq> select * from bucket1 where ..... ;
....

如果您正在启动 cbq,那么您还可以执行以下操作。 (正如 Gerald 上面建议的那样,使用 -c 或 --credentials 选项)

# ./cbq -c="bucket1:abc123" -e=http://<ur ip>:8091
cbq> create primary index on bucket1;
....

存储桶名称是存储桶用户名。如果要传入或设置管理员凭据,则使用 -u。

【讨论】:

    【解决方案2】:

    如果您使用 Couchbase 4.5,您可以在 4.5 cbq shell 中传递存储桶凭据。见http://developer.couchbase.com/documentation/server/current/tools/cbq-shell.html

    您可以使用 -c 或 --credentials 命令行选项,也可以在 shell 中运行 \SET -creds。

    最后,您的索引语句将是

    CREATE PRIMARY INDEX ON `bucketName`;
    

    cbq shell 负责为您传递凭据。

    【讨论】:

    • 我是沙发新手。执行以下命令 \set bucketname bucketusername:password; .但抛出语法错误。您能告诉我如何将 \SET 用于特定的存储桶吗?
    • 继续修正问题标题中的拼写,然后我们将从那里开始。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-05
    • 2021-05-14
    • 2018-03-28
    • 2012-09-13
    • 1970-01-01
    • 1970-01-01
    • 2016-02-17
    相关资源
    最近更新 更多