2016-07-13 2 views
1

Couchbase DB 서버 트로프 couchbase gem에 연결하고 싶습니다.Ruby : Couchbase에 연결

require 'couchbase' 
c = Couchbase.connect('http://<server>:<port>/pools/default/buckets/auth') 

오류가 발생합니다 :

*** Couchbase::Error::BucketNotFound Exception: bootstrap error, The bucket requested does not exist 

다음 코드는 (couchbase python package)와 함께 작동 : 내가 연결 문자열 couchbase://<server>/auth을 사용하여 루비에서 연결하는 방법을

from couchbase.bucket import Bucket 
c = Bucket('couchbase://<server>/auth') 

?

답변

0

custom 경우 버킷을 지정할 필요 : 내가 파이썬에서 연결할 때`

Couchbase.connect("http://<server>:8091/pools/default", :bucket => 'auth') 
2

내 컴퓨터에서 볼 수 있습니다.

# ruby --version 
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux] 

# gem --version 
1.3.7 

# gem list --local 

*** LOCAL GEMS *** 

connection_pool (2.2.0) 
couchbase (1.3.14) 
multi_json (1.12.1) 
yaji (0.3.5) 

# cat test.ruby 
require 'couchbase' 
c = Couchbase.connect('http://localhost:8091/pools/default/buckets/BUCKETNAME') 
puts c.get('test123') 


# cbc get test123 -U couchbase://localhost/BUCKETNAME 
test123    CAS=0x8f1269ea6014, Flags=0x0. Size=17 
{"hello":"there"} 

# ruby -rubygems test.ruby 
[WARNING] MultiJson is using the default adapter (ok_json). We recommend loading a different JSON library to improve performance. 
hellothere 

이것은 내 Couchbase 노드 중 하나에 있습니다. 나는 BUCKETNAME 버킷라고하고는 키 "test123"와 문서의 내용이있는 문서입니다 포함

{ 
    "hello": "there" 
} 
+0

그러나 Bucket ('couchbase : // /auth')'- 루비에서 동일한 서버에 연결할 때'Couchbase.connect (http : // : /pools/default/buckets/auth)' 'Couchbase :: Error :: Auth : bootstrap error, Authentication failed. '오류가 발생했습니다. 잘못된 사용자 이름/암호 조합을 제공했을 수 있습니다. ' 두 라이브러리 모두 동일한 웹 관리 포트 - 8091을 사용했습니다. –