Cassandra 多节点安装,由于权限被拒绝,无法打开文件 /var/log/cassandra/gc.log

Cassandra 多节点安装,由于权限被拒绝,无法打开文件 /var/log/cassandra/gc.log

我想在 4 个远程节点上安装 Cassandra。一切正常,直到我检查状态时才到达

nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  103.68 KiB  256          100.0%            4e03d80f-5972-4bc7-b36d-6e536ebfa808  rack1

我已正确将 listen_address 设置为 192.68.0.25,将 seeds 设置为 192.69.0.13

我在另一个节点上也遇到了同样的问题

Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  103.64 KiB  256          100.0%            c7ad74b0-9fa1-4068-a2f8-24e45523b731  rack1

这是我从命令 shell 运行 cassandra 时得到的结果

    OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied

18:06:55,305 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.apache.cassandra] to DEBUG
18:06:55,305 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.thinkaurelius.thrift] to ERROR
18:06:55,305 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
18:06:55,305 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6ea12c19 - Registering current configuration as safe fallback point

INFO  [main] 2018-01-25 18:06:55,399 YamlConfigurationLoader.java:89 - Configuration location: file:/etc/cassandra/cassandra.yaml
Exception (org.apache.cassandra.exceptions.ConfigurationException) encountered during startup: Invalid yaml: file:/etc/cassandra/cassandra.yaml
 Error: null; Can't construct a java object for tag:yaml.org,2002:org.apache.cassandra.config.Config; exception=Cannot create property=seed_provider for JavaBean=org.apache.cassandra.config.Config@3d36e4cd; java.lang.reflect.InvocationTargetException;  in 'reader', line 10, column 1:
    cluster_name: 'Test Cluster'
    ^
Invalid yaml: file:/etc/cassandra/cassandra.yaml

其实我没有gc.log。这是文件夹的内容

/var/log/cassandra$ ls *.log
debug.log  system.log

/var/log$ ls -lia cassandra/
total 284
8389155 drwxr-xr-x  2 cassandra cassandra   4096 jan.  25 15:50 .
8257787 drwxrwxr-x 14 root      syslog      4096 jan.  25 15:49 ..
8389157 -rw-r--r--  1 cassandra cassandra 178071 jan.  25 17:50 debug.log
8389086 -rw-r--r--  1 cassandra cassandra  53037 jan.  25 18:16 gc.log.0.current
8389150 -rw-r--r--  1 cassandra cassandra  41003 jan.  25 17:50 system.log

答案1

确保您的 /etc/hosts 文件格式有效,例如

root@my-cass1-1:~# cat /etc/hosts | egrep -v "^#|::"
127.0.0.1 localhost
192.168.xxx.13 my-cass1-1.int.xxxxxxxxx.tld my-cass1-1

其中没有 localhost.localdomain 内容。

在 cassandra.yaml 中设置这两个选项:

root@my-cass1-1:~# cat /etc/cassandra/cassandra.yaml | grep 192.168
          - seeds: "192.168.xxx.111,192.168.xxx.112,192.168.xxx.13,192.168.xxx.10"
listen_address: 192.168.xxx.13
broadcast_rpc_address: 192.168.xxx.13

相关内容