1
votes

I installed Cassandra DB on my Ubuntu VM1 and also installed on other VM Ubuntu VM2. MY question is:

How to initialize multi node cluster (single data-center) on my VM's?

I also changed my Cassandra.yaml like below:

  1. IP default to IP system seed , listen_address.
  2. cluster_name: 'MyDigitalOceanCluster'
  3. initial_token: 0
  4. seed_provider:
  5. seeds: "198.211.50.0"
  6. listen_address: 198.211.50.0
  7. rpc_address: 0.0.0.0
  8. endpoint_snitch: RackInferringSnitch

After the changes I received this message:

Connection error: ('Unable to connect to any servers', {'127.0.0.1': 
error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: 
Connection refused")})
1
How are you seeing that error? From cqlsh?Aaron
Just wondering, because an IP address should really be specified with cqlsh. Also, the seeds: parameter should have both IP addresses (in a 2 node cluster, I'd make them both seed nodes).Aaron

1 Answers

2
votes

Aaron has pretty much given you the answers but for what it's worth set the following in cassandra.yaml:

  • num_tokens: 16 or if you prefer to specify tokens, make sure you pick tokens which are balanced
  • listen_address: private_ip
  • rpc_address: public_ip (or same IP if your VM only has 1 NIC)
  • set seeds to the IP of both nodes (1 of the nodes is sufficient but 2 is preferred)
  • endpoint_snitch: GossipingPropertyFileSnitch is recommended and almost always the right choice (see my reasons here https://community.datastax.com/questions/8887/)

When connecting with cqlsh, you need to specify the node's client IP (rpc_address) otherwise it will default to localhost (127.0.0.1). For example:

$ cqlsh 198.211.50.0

Cheers!