how to connect cassandra from local to EC2 instances

流过昼夜 提交于 2019-12-12 09:20:20

问题


I installed cassandra cluster in ec2 its working correctly. but when i try to connect the cassandra from code using php_cassa lib. its throwing error like "no server available"

the follow code its am working.

'ec2-public-ip address', 'port' => 9160); $conn = new Connection('CookieDB', $servers); $column_family = new ColumnFamily($conn, 'User'); $column_family->insert('row_key', array('username'=>'PHPCASSA')); $value = $column_family->get('row_key'); print_r($value); ?>

is there anything am doing wrong

thanks in advance


回答1:


sounds like you didn't edit rpc_address in cassandra.yaml to listen on the public interface instead of localhost.




回答2:


  1. Goto EC2 Management Console
  2. Click on Security Groups under Network and Security on the left menu
  3. Select your Security Group associated with your instance and click on Inbound Tab
  4. Find out what is the source for ALL Port (Service). If the source is sg-xxxxxxxx, then delete the same.
  5. Add a new rule by selecting the below options: Create a new rule: All Traffic Source: 0.0.0.0/0
  6. Add Rule and click on Apply Rule changes
  7. To verify if you are able to connect to Cassandra server, run the cassandra client from your local machine like below:

cassandra-cli -host ec2-XX-XXX-XX-XXX.us-west-2.compute.amazonaws.com -port 9160



来源:https://stackoverflow.com/questions/5297752/how-to-connect-cassandra-from-local-to-ec2-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!