Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

getting Couchbase::Error::Timeout

1 reply [Last post]
  • Login or register to post comments
Mon, 02/04/2013 - 11:44
abhish_gl
Offline
Joined: 01/31/2013
Groups: None

I am trying to write a small ruby program to connect to couchbase server and create a document. I am able to connect to couchbase server but when I try to do a get/set/touch I get a timeout error - (Couchbase::Error::Timeout)

sample:
--------------------------------------
require 'rubygems'
require 'couchbase'
c = Couchbase.connect(:hostname=>'localhost',:port=>8091,:username => 'Administrator', :password=>'password', :bucket=>'test')
puts c.name
c.touch("foo")
c.disconnect
--------------------------------------------

output:
test
load_couchbase.rb:10:in `touch': failed to touch value (key="foo", error=0x17) (Couchbase::Error::Timeout)
from load_couchbase.rb:10:in `'

Any clue to get past this error?

thanks.

Top
  • Login or register to post comments
Thu, 02/07/2013 - 10:29
scalabl3
Offline
Joined: 07/18/2012
Groups:

I see a few problems here, one the :username => should be the bucket name. Second, if you didn't set a SASL password for the test bucket, then password is not required, otherwise it should match. You can check the connection with c.connected? method. Couchbase::Error::Timeout typically indicates either that you are not connected or that for some network connectivity issue it reached the timeout. Also you don't seem to be setting the data first.

puts c.connected?

c.set("foo", "value", :ttl => 30) # => set key-value and 30 second expiration

c.touch("foo") # => touch the key with default expiration (which is 0, meaning no expiration, unless you change it in the connect method or explicitly)

c.touch("foo", :ttl => 60) # => change to 60 second expiration

Also you don't need to call c.disconnect explicitly, that is handled implicitly already.

Reply to this thread if you need anything else...

__________________

@scalabl3
Technical Evangelist
Couchbase Inc.
 

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker