我正在尝试使用 Spring data 2.2.8 版本连接到安装在 Linux 服务器上的 couchbase。我们的沙发床 db 是企业版 5.0.0 版本 2873。
有集群用户 ID 和密码,我无法从 AbstractCouchbaseConfiguration 方法传递并收到 401 错误(协议(protocol) HTTP 的未知响应状态:401)。
但是当我尝试使用以下代码使用 java sdk 时,我能够成功连接。
Cluster cluster = CouchbaseCluster.create(“servername”);
cluster.authenticate(“userid”, “password”);
Bucket bucket = cluster.openBucket(“bucket”);
你能帮我理解我对 Spring 数据做错了什么吗?
最佳答案
只需创建一个与存储桶同名的用户并在那里设置密码,如 I also answered in this other post .
正如那里提到的,文档应该涵盖这一点,如果有任何令人困惑的地方,请单击“反馈”按钮并提供可以改进的内容!
https://developer.couchbase.com/documentation/server/5.0/security/security-authorization.html https://developer.couchbase.com/documentation/server/5.0/security/concepts-rba-for-apps.html https://developer.couchbase.com/documentation/server/5.0/security/security-resources-under-access-control.html
关于spring-boot - 抽象Couchbase配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46955161/