0
votes

I need to build a Cassandra cluster for my company, I use apache-cassandra-2.1.12-bin.tar.gz downloaded form official website.

I have three machines:

192.168.0.210;

192.168.0.209;

192.168.0.208;

I changed the cassandra.yaml for each one.

Step1: On 192.168.0.210:

   listen_address: 192.168.0.210  

   seeds: 192.168.0.210  

Step2: On 192.168.0.209:

   listen_address: 192.168.0.209

   seeds: 192.168.0.210

Step3: On 192.168.0.208:

   listen_address: 192.168.0.208

   seeds: 192.168.0.210   

I searched online, some people also changed rpc_address, while some people not. When I changed rpc_address to 0.0.0.0, then run ./cassandra ,it shows:

Fatal configuration error

org.apache.cassandra.exceptions.ConfigurationException: 
If rpc_address is set to a wildcard address (0.0.0.0), then you must set 
broadcast_rpc_address to a value other than 0.0.0.0     

so I changed broadcast_rpc_address to 1.2.3.4, then run ./cassandra, it shows

 ERROR 05:49:42 Fatal configuration error
 org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml
at      org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:120) ~[apache-cassandra-2.1.12.jar:2.1.12]
at  org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:84) ~[apache-cassandra-2.1.12.jar:2.1.12]
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:161) ~[apache-cassandra-2.1.12.jar:2.1.12]
at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:136) ~[apache-cassandra-2.1.12.jar:2.1.12]
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:168) [apache-cassandra-2.1.12.jar:2.1.12]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:562) [apache-cassandra-2.1.12.jar:2.1.12]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:651) [apache-cassandra-2.1.12.jar:2.1.12]
Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping; expected <block end>, but found BlockMappingStart;  in 'reader', line 455, column 2:
 broadcast_rpc_address: 1.2.3.4
 ^
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:570) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.Yaml.load(Yaml.java:412) ~[snakeyaml-1.11.jar:na]
at org.apache.cassandra.config.YamlConfigurationLoader.logConfig(YamlConfigurationLoader.java:126) ~[apache-cassandra-2.1.12.jar:2.1.12]
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:104) ~[apache-cassandra-2.1.12.jar:2.1.12]
... 6 common frames omitted

 Invalid yaml
 Fatal configuration error; unable to start. See log for stacktrace.

So my questions:

1.do I need to change rpc_address(some people do,while some not)?
2. if yes, how to handle broadcast_rpc_address?
3. except rpc_address/broadcast_rpc_address, what else do I need to do for building the cassandra cluster?

2
OK, after another two hours research, I did it. since no one answer this question so far. I will show my way to do this, just follow this instruction:blog.powerupcloud.com/2016/01/10/… - Kevin Zheng
Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping; expected <block end>, but found BlockMappingStart; in 'reader', line 455, column 2: broadcast_rpc_address: 1.2.3.4 To solve this problem, you need to type two spaces before the parameter you changed to uniform the formatting. I don't know the reason but this method works. - Kevin Zheng
Why don't you set rpc_address to the same value as listen_address ? - doanduyhai

2 Answers

0
votes

rpc_address is the address or interface to bind the Thrift RPC service and native transport server to. You could leave it blank. Cassandra will use the node's hostname. It is not suggested to set as 0.0.0.0, unless the node is protected by such as firewall. Or else, anyone could access Cassandra.

broadcast_rpc_address is the RPC address to broadcast to drivers and other Cassandra nodes. This cannot be set to 0.0.0.0. The drivers need the valid IP address to send the requests. If you set rpc_address to 0.0.0.0, you should set broadcast_rpc_address to the node's IP. In your example, 192.168.0.208, 192.168.0.209, or 192.168.0.210.

For 3, you just need to set cluster name to be the same on all nodes.

-2
votes

for rpc_address, try using:

rpc_address: localhost

Here is answers to your questions:

1.do I need to change rpc_address(some people do,while some not)? NO, you dont need it unless you want your clients to connect to a different IP address rather than the actual IP address of the server, example would be SQL server Alias etc. 2. if yes, how to handle broadcast_rpc_address? broadcast... i think it would be public IPs as the broadcast_address, or 0.0.0.0

  1. except rpc_address/broadcast_rpc_address, what else do I need to do for building the cassandra cluster? make sure the Cluster name is the same for all nodes, and that for your first node setting up the cluster the first time, seed is the same as the listen IP, Then the second node the seed is the first node etc.