![](/img/trans.png)
[英]Connecting to a cluster of cassandra nodes using Cassandra Ruby client
[英]connecting to cassandra nodes on a datastax cluster on EC2 Ruby on Rails
我創建了一個具有2個cassandra節點,2個搜索節點和2個Analytics節點的datastax cassandra Enterprise集群。
除了我無法從外部連接到其他所有內容以外,其他所有內容似乎都可以正常工作。 如果我在node0服務器上,我可以運行cassandra-cli並連接到端口9160上的cassandra節點,但是當我嘗試使用datastax-rails gem進行連接時,我得到了“沒有活動的服務器”,我也嘗試了datastax devCenter,它試圖連接到本地端口9042,但也無法正常工作。 我真的很困惑,感謝您的幫助。
所以經過一番挖掘,我發現了一些問題
1. Port 9160 is connected and I can connect to it from telnet node0_ip 9160
2. when I run rake ds:migrate, I get No live servers in node0_ip
3. I tried to connect to 'cassandra' gem instead from IRB and tried
a. client = Cassandra.new('example', 'node0_ip:9160')
b. client.insert(:users, "5", {'screen_name' => "buttonscat4"})
I got a similar error with ThriftClient::NoServersAvailable: No live servers but this time with all the IPs of all the nodes in the cluster
4. I tried adding "client.disable_node_auto_discovery!" and I was able to connect and add stuff using 'cassandra' Gem.
5. I also found on https://github.com/cassandra-rb/cassandra/issues/171 that I need to change your server to bind on a non-loopback address but have no idea what does that mean
現在的問題是
聽起來您需要在端口9160上向外部打開EC2安全組。特別是您的node0
使用的安全組。
您可以在此處找到有關它們的更多信息:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
我遇到了同樣的錯誤,並通過使用disable_node_auto_discovery使它正常工作!
您可以在此方法的文檔中看到它說:“當cassandra群集在與您用來連接的IP地址不同的ip地址上進行內部通信時,這非常有用。通常,集群將通過Amazon發行的本地ip地址進行通信,但是從外部EC2連接的任何客戶端都需要使用公共ip。”
http://rdoc.info/github/cassandra-rb/cassandra/master/Cassandra:disable_node_auto_discovery !
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.