这是我在机器上设置3节点Cassandra集群的第二次尝试。我无法启动第一个实例。 在启动期间我得到了
Exception encountered during startup
org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml: file:/home/user1/TestCluster/node1/dsc-cassandra-2.2.8/conf/cassandra.yaml
以及我无法理解的很多行(我不明白为什么yaml无效)。
我的方法包括以下步骤:
我将tarball安装解压缩到3个文件夹中(因为我想要3个实例)。
在每个cassandra.yaml
中:
cluster_name
已设置seeds:
“127.0.0.2”(所有节点都相同)rpc_address, listen_address
都设置为127.0.0.2-4 rpc_port
已设置(9160,9161,9162)data_file_directories
,commitlog_directories
,saved_caches_directory
已为所有在每个cassandra-env.sh
JMX_PORT
已设置(8081,8082,8083)
etc/hosts
,以便127.2-4是127.0.0.1的别名
我的问题是:我做错了什么?怎么解决这个问题?在ubuntu上有没有其他简单的方法可以做到这一点?
我包含错误,因为它有任何意义。如果占用太多空间,将删除。
ERROR 12:19:12 Exception encountered during startup
org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml: file:/home/user1/TestCluster/node1/dsc-cassandra-2.2.8/conf/cassandra.yaml
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:118) ~[apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:85) ~[apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:135) ~[apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:119) ~[apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:507) [apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:641) [apache-cassandra-2.2.8.jar:2.2.8]
Caused by: org.yaml.snakeyaml.constructor.ConstructorException: null; Can't construct a java object for tag:yaml.org,2002:org.apache.cassandra.config.Config; exception=Cannot create property=data_file_directories for JavaBean=org.apache.cassandra.config.Config@24a35978; No single argument constructor found for class [Ljava.lang.String;; in 'reader', line 10, column 1:
cluster_name: 'Testcluster'
^
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:333) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:475) ~[snakeyaml-1.11.jar:na]
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:111) ~[apache-cassandra-2.2.8.jar:2.2.8]
... 5 common frames omitted
Caused by: org.yaml.snakeyaml.error.YAMLException: Cannot create property=data_file_directories for JavaBean=org.apache.cassandra.config.Config@24a35978; No single argument constructor found for class [Ljava.lang.String;
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:299) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331) ~[snakeyaml-1.11.jar:na]
... 11 common frames omitted
Caused by: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for class [Ljava.lang.String;
at org.yaml.snakeyaml.constructor.Constructor$ConstructScalar.construct(Constructor.java:379) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) ~[snakeyaml-1.11.jar:na]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:296) ~[snakeyaml-1.11.jar:na]
... 13 common frames omitted
答案 0 :(得分:2)
如果在本地计算机上严格用于测试目的,我会使用CCM。
答案 1 :(得分:1)
您的配置似乎正确,我完全按照您的描述进行了操作,效果很好。
问题似乎是您在cassandra.yaml
文件中存在某种错误。请检查以下行:
data_file_directories:
- /var/lib/cassandra/data
当它是这样的时候(两行),当它放在一行中时,它将引发帖子中的错误。