启动简约的独立cassandra无法通过“ cassandra -f”工作

时间:2019-03-11 05:32:03

标签: cassandra

最新的cassandra是从网站下载的。我正在按照https://medium.com/@areeves9/cassandras-gossip-on-os-x-single-node-installation-of-apache-cassandra-on-mac-634e6729fad6

上的指示进行操作

已安装Cassandra

22:26:40/cassandra $cassandra -v
3.11.4

我将按照以下方式开始cassandra

2:23:04/cassandra $bin/cassandra -f

但是,在尝试找到cassandra.config时失败了:

Exception (org.apache.cassandra.exceptions.ConfigurationException) encountered during startup: Expecting URI in variable: [cassandra.config]. Found[cassandra.yaml]. Please prefix the file with [file:///] for local files and [file://<server>/] for remote files. If you are executing this from an external tool, it needs to set Config.setClientMode(true) to avoid loading configuration.
org.apache.cassandra.exceptions.ConfigurationException: Expecting URI in variable: [cassandra.config]. Found[cassandra.yaml]. Please prefix the file with [file:///] for local files and [file://<server>/] for remote files. If you are executing this from an external tool, it needs to set Config.setClientMode(true) to avoid loading configuration.
    at org.apache.cassandra.config.YamlConfigurationLoader.getStorageConfigURL(YamlConfigurationLoader.java:80)
    at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:100)
    at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:268)
    at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:147)
    at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:132)
    at org.apache.cassandra.service.CassandraDaemon.applyConfig(CassandraDaemon.java:665)
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:609)
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:732)

这是目录信息:

22:23:34/cassandra $pwd
/opt/cassandra
22:23:39/cassandra $ll conf
total 304
drwxr-xr-x@  3 sboesch  admin     96 Feb  2 14:09 triggers
-rw-r--r--@  1 sboesch  admin   1603 Feb  2 14:09 metrics-reporter-config-sample.yaml
-rw-r--r--@  1 sboesch  admin   3809 Feb  2 14:09 logback.xml
-rw-r--r--@  1 sboesch  admin   1195 Feb  2 14:09 logback-tools.xml
-rw-r--r--@  1 sboesch  admin   9956 Feb  2 14:09 jvm.options
-rw-r--r--@  1 sboesch  admin   2757 Feb  2 14:09 hotspot_compiler
-rw-r--r--@  1 sboesch  admin   6360 Feb  2 14:09 cqlshrc.sample
-rw-r--r--@  1 sboesch  admin   2082 Feb  2 14:09 commitlog_archiving.properties
-rw-r--r--@  1 sboesch  admin  57672 Feb  2 14:09 cassandra.yaml
-rw-r--r--@  1 sboesch  admin   1358 Feb  2 14:09 cassandra-topology.properties
-rw-r--r--@  1 sboesch  admin   1200 Feb  2 14:09 cassandra-rackdc.properties
-rw-r--r--@  1 sboesch  admin    148 Feb  2 14:09 cassandra-jaas.config
-rw-r--r--@  1 sboesch  admin  12541 Feb  2 14:09 cassandra-env.sh
-rw-r--r--@  1 sboesch  admin  18250 Feb  2 14:09 cassandra-env.ps1
-rw-r--r--@  1 sboesch  admin    291 Feb  2 14:09 README.txt
drwxr-xr-x@ 17 sboesch  admin    544 Mar 10 22:22 .
drwxr-xr-x  17 sboesch  admin    544 Mar 10 22:22 ..

我确保conf下的<installation_home>/conf文件正确可用。 cassandra.yaml保持不变:这是tar.gz下载中的默认内容。

为什么这简直就是开箱即用(以前 容易启动独立的cassandra ..)?

2 个答案:

答案 0 :(得分:1)

像这样设置系统变量:

System.setProperty(“ cassandra.config”,“ file:////cassandra.yaml”);

答案 1 :(得分:0)

可以使用-D cassandra.config=<path>指定配置文件,如下所示:

export CASSANDRA=/opt/cassandra
$cassandra  -D cassandra.config=file://$CASSANDRA/conf/cassandra.yaml

然后可以启动。

enter image description here