Couchbase 401 未经授权

Couchbase 401 Unauthorized

我有一个生产集群 运行 Couchbase Community Edition,它已经 运行 3 年多了。今天开始发了:

[appserver1 root]$ bundle exec ruby cbtest.rb 

/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/couchbase-1.3.15/lib/couchbase/bucket.rb:146:in `continue': failed to execute HTTP request, Success (Not an error) (key="/pools/default/buckets/markets/ddocs", status="401" (Unauthorized), error=0x00) (Couchbase::Error::HTTP)
    from /opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/couchbase-1.3.15/lib/couchbase/bucket.rb:146:in `design_docs'
    from cbtest.rb:3:in `<main>'

然而,在另一台相同的服务器上

[appserver2 root]$ bundle exec ruby cbtest.rb 

[appserver2 root]$ 

这是脚本代码:

require 'couchbase'

@client = Couchbase.new(:node_list => ['172.19.4.22'], :bucket => 'markets')

@client.design_docs

我决定跟踪这个过程,我能找到的唯一区别是 Authorization: Basic 0g-- 出现在失败的交易中,但没有出现在后续的交易中。

这超出了我的范围,因为它正在研究 couchbase 代码。

非常感谢

事实证明 libcouchbase2-core-2.7.4 对授权机制做了一些更改,这些更改不适用于我当前版本的 ruby​​gem 'couchbase'。

回滚到 2.7.3 解决了这个问题。

在此处查看更新日志

https://github.com/couchbase/libcouchbase/blob/master/RELEASE_NOTES.markdown

作为解决方法,您现在应该明确传递用户凭据。它也是在 Couchbase Server 5 的准备工作中完成的,其中身份验证和安全性总体上得到了很大改进。

require 'couchbase'
@client = Couchbase.new(:node_list => ['172.19.4.22'], :bucket => 'markets',
                        :username => 'markets')
@client.design_docs