首页 文章

couchbase java身份验证失败问题

提问于
浏览
1

我在couchbase bucket 'SAMPLE'里面创建了json文档'test',它是远程的 . couchbase的URL是http://testcouch.employee.com:8091/index.html - IP是124.10.0.2

沙发用户名:helloUser

沙发密码:helloUser

Connection.java

static CouchbaseEnvironment couchbaseEnvironment = DefaultCouchbaseEnvironment.builder()
        .queryTimeout(10000)
        .build();

    static Cluster cluster = CouchbaseCluster.create(couchbaseEnvironment,"http://testcouch.employee.com");

    static Bucket bucket = cluster.openBucket("SAMPLE","helloUser++");

尝试连接时遇到以下错误:

警告:[null] [KeyValueEndpoint]:无法连接到 endpoints ,重试延迟32 MILLISECONDS:com.couchbase.client.core.endpoint.kv.AuthenticationException:com.couchbase.client.core.endpoint.kv上的身份验证失败.KeyValueAuthHandler.checkIsAuthed(KeyValueAuthHandler.java:288)at com.couchbase.client.core.endpoint.kv.KeyValueAuthHandler.channelRead0(KeyValueAuthHandler.java:173)

2 回答

  • 3

    我得到了同样的错误 . 从UI创建存储桶时,没有选项可以在存储桶级别定义“密码”(v community 5.0.0) .

    相反,我创建了一个用户,并在目标存储桶上给他管理权 . 在菜单中选择安全性,然后在顶部右侧“添加用户”

    指定集群对象上的密码不在 openBucket

    Cluster cluster = CouchbaseCluster.create(couchbaseEnvironment,"http://testcouch.employee.com");
    couchBaseCluster.authenticate("helloUser", "helloUser++");
    Bucket bucket = cluster.openBucket("SAMPLE","");
    
  • 1

    cluster.openBucket 调用的密码是您在创建存储桶时指定的密码 .

    您似乎正在使用Couchbase Web控制台密码 .

    如果您不记得创建存储桶密码,请尝试从呼叫中删除密码 .

相关问题