问题
After we upgrade to Rails 3.2.8 with Ruby 1.9.3 (from 1.8.7), our Couchbase client could no longer access our AWS cluster (Couchbase 1.8 Community Edition).
1.9.3p194 :011 > c = Couchbase.new("http://ec2-184-169-237-63.us-west-1.compute.amazonaws.com:8091")
=> #<Couchbase::Bucket:0x007fe12d9e6c98 "http://ec2-184-169-237-63.us-west-1.compute.amazonaws.com:8091/pools/default/buckets/default/" default_format=:document, default_flags=0x0, quiet=false, connected=true, timeout=2500000>
1.9.3p194 :012 > c.get("hello")
Couchbase::Error::Timeout: failed to get value (key="hello", error=0x16)
from (irb):12:in `get'
from (irb):12
from /Users/playmeshinc/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /Users/playmeshinc/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /Users/playmeshinc/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
On the admin panel, we cannot even see any request reaching the server.
However, if we use the memcache protocol on port 11211, everything works well. If we try the same code and same call on our local couchbase cluster (OSX), things works just fine.
Any idea what might have happened? Is that because the Ruby Couchbase client is not compatible with AWS or Ruby 1.9.3?
回答1:
Actually I figured out, that's because moxi client on AWS would return internal ips which are not accessible to external machines, that's why it timed out when I was testing from outside.
回答2:
Gem is definitely compatible with EC2 and 1.9.3. What version of couchbase gem are you using? and what version of libcouchbase? Sounds like the culprit might be rvm or something else. I recommend trying to gem uninstall, and reinstall. Also make sure libcouchbase is up to date.
来源:https://stackoverflow.com/questions/12117746/client-timeout-on-aws-couchbase-cluster-after-upgrading-to-ruby-1-9-3