我需要为我的公司建立一个Cassandra集群,我使用apache-cassandra-2.1.12-bin.tar.gz从官方网站下载。
我有三台机器:
192.168.0.210;
192.168.0.209;
192.168.0.208;
我为每个人更改了cassandra.yaml。
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
我在网上搜索过,有些人也改变了rpc_address,而有些人却没有。当我将rpc_address更改为0.0.0.0,然后运行./cassandra时,它显示:
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
所以我将broadcast_rpc_address更改为1.2.3.4,然后运行./cassandra,显示
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.
所以我的问题:
1.我需要更改rpc_address(有些人会这样做,有些人却没有)?
2.如果是,如何处理broadcast_rpc_address?
3.除了rpc_address / broadcast_rpc_address,我还需要做些什么来构建cassandra集群?
答案 0 :(得分:0)
rpc_address是将Thrift RPC服务和本机传输服务器绑定到的地址或接口。你可以把它留空。 Cassandra将使用节点的主机名。除非节点受防火墙保护,否则不建议将其设置为0.0.0.0。否则,任何人都可以访问Cassandra。
broadcast_rpc_address是要广播到驱动程序和其他Cassandra节点的RPC地址。这不能设置为0.0.0.0。驱动程序需要有效的IP地址才能发送请求。如果将rpc_address设置为0.0.0.0,则应将broadcast_rpc_address设置为节点的IP。在您的示例中,192.168.0.208,192.168.0.209或192.168.0.210。
对于3,您只需要在所有节点上将群集名称设置为相同。
答案 1 :(得分:-2)
对于rpc_address,请尝试使用:
rpc_address:localhost
以下是您的问题的答案:
1.do我需要更改rpc_address(有些人会这样做,有些人却没有)? 不,你不需要它,除非你希望你的客户端连接到不同的IP地址而不是服务器的实际IP地址,例如SQL服务器别名等。 2.如果是,如何处理broadcast_rpc_address? 广播...我认为它将是public_address的公共IP,或0.0.0.0