smartcat-labs / cassandra-diagnostics

Cassandra Node Diagnostics Tools
Apache License 2.0
51 stars 6 forks source link

Unable to start Cassandra with Expecting URI in variable #295

Closed irumman closed 6 years ago

irumman commented 6 years ago

Hi,

I am trying to use this for the first time with my DSE 4.8.14. I installed it using the build script as: cassandra-diagnostics-installer.sh -c /etc/dse/cassandra -l /usr/share/dse/resources/cassandra/lib -v 2.1.18 -V 1.4.10 -C /home/ubuntu/cassandra_slow_query/cassandra-diagnostics.yml I can see these in my cassandra-env.sh:

### Begin cassandra-diagnostics-installer managed configuration. DO NOT EDIT! ###

JVM_OPTS="$JVM_OPTS -Dcassandra.diagnostics.config=/etc/dse/cassandra/cassandra-diagnostics.yml"
JVM_OPTS="$JVM_OPTS -javaagent:/usr/share/dse/resources/cassandra/lib/cassandra-diagnostics-core-1.4.10.jar"

#### End cassandra-diagnostics-installer managed configuration. DO NOT EDIT! ####

I have the following file:

 ls -l /usr/share/dse/resources/cassandra/lib/cassandra-diagnostics-core-1.4.10.jar
-rw-r--r-- 1 cassandra cassandra 271868 Sep 18 11:43 /usr/share/dse/resources/cassandra/lib/cassandra-diagnostics-core-1.4.10.jar

My cassandra-diagnostics.yml file:

cat /etc/dse/cassandra/cassandra-diagnostics.yml
global:
  systemName: "mycluster"

reporters:
  - reporter: io.smartcat.cassandra.diagnostics.reporter.LogReporter

modules:
  - module: io.smartcat.cassandra.diagnostics.module.slowquery.SlowQueryModule
    measurement: queryReport
    options:
      slowQueryThresholdInMilliseconds: 1
    reporters:
      - io.smartcat.cassandra.diagnostics.reporter.LogReporter

But when I am trying to start my Cassandra, it is giving me following error:

/var/log/cassandra$ cat output.log
Aborted (core dumped)
INFO  23:05:22,602  Cassandra Diagnostics starting.
ERROR 23:05:22,633  A problem occured while loading configuration.
io.smartcat.cassandra.diagnostics.config.ConfigurationException: Expecting URI in variable [cassandra.diagnostics.config]. Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting.
        at io.smartcat.cassandra.diagnostics.config.YamlConfigurationLoader.getStorageConfigUrl(YamlConfigurationLoader.java:54) ~[cassandra-diagnostics-core-1.4.10.jar:na]
        at io.smartcat.cassandra.diagnostics.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:75) ~[cassandra-diagnostics-core-1.4.10.jar:na]
        at io.smartcat.cassandra.diagnostics.Diagnostics.loadConfiguration(Diagnostics.java:81) [cassandra-diagnostics-core-1.4.10.jar:na]
        at io.smartcat.cassandra.diagnostics.Diagnostics.<init>(Diagnostics.java:53) [cassandra-diagnostics-core-1.4.10.jar:na]
        at io.smartcat.cassandra.diagnostics.DiagnosticsAgent.premain(DiagnosticsAgent.java:39) [cassandra-diagnostics-core-1.4.10.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386) [na:1.8.0_151]
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401) [na:1.8.0_151]
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.IllegalStateException: io.smartcat.cassandra.diagnostics.config.ConfigurationException: Expecting URI in variable [cassandra.diagnostics.config]. Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting.
        at io.smartcat.cassandra.diagnostics.Diagnostics.loadConfiguration(Diagnostics.java:84)
        at io.smartcat.cassandra.diagnostics.Diagnostics.<init>(Diagnostics.java:53)
        at io.smartcat.cassandra.diagnostics.DiagnosticsAgent.premain(DiagnosticsAgent.java:39)
        ... 6 more
Caused by: io.smartcat.cassandra.diagnostics.config.ConfigurationException: Expecting URI in variable [cassandra.diagnostics.config]. Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting.
        at io.smartcat.cassandra.diagnostics.config.YamlConfigurationLoader.getStorageConfigUrl(YamlConfigurationLoader.java:54)
        at io.smartcat.cassandra.diagnostics.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:75)
        at io.smartcat.cassandra.diagnostics.Diagnostics.loadConfiguration(Diagnostics.java:81)
        ... 8 more
FATAL ERROR in native method: processing of -javaagent failed

Can anyone please tell me what I am missing here?

Thanks.

mgobec commented 6 years ago

Can you update cassandra-env.sh by adding the file:/// for config path? Thats what the error is saying.

This should work: JVM_OPTS="$JVM_OPTS -Dcassandra.diagnostics.config=file:///etc/dse/cassandra/cassandra-diagnostics.yml" JVM_OPTS="$JVM_OPTS -javaagent:/usr/share/dse/resources/cassandra/lib/cassandra-diagnostics-core-1.4.10.jar"

Since you put diagnostics config at the config path (in your case /etc/dse/cassandra) you can just set -Dcassandra.diagnostics.config=cassandra-diagnostics.yml.

irumman commented 6 years ago

Tried that. Still it's giving the same error. io.smartcat.cassandra.diagnostics.config.ConfigurationException: Cannot locate file:///etc/dse/cassandra/cassandra-diagnostics.yml. If this is a local file, please confirm you've provided file:/// as a URI prefix.

irumman commented 6 years ago

When I used this, I got different error:

JVM_OPTS="$JVM_OPTS -Dcassandra.diagnostics.config=file:///etc/dse/cassandra/cassandra-diagnostics.yaml"
JVM_OPTS="$JVM_OPTS -javaagent:/usr/share/dse/resources/cassandra/lib/cassandra-diagnostics-core-1.4.8.jar"

Error:

INFO  06:05:27,847  Loading settings from file:/etc/dse/cassandra/cassandra-diagnostics.yaml
INFO  06:05:28,095  Effective configuration: { hostname: ip-10-2-0-84.us-east-2.compute.internal{ systemName: zabbix_test, httpApiEnabled: true, httpApiPort: 8998, reporters: , reporter: "io.smartcat.cassandra.diagnostics.reporter.LogReporter", reporterOptions: {} }, modules: , module: "io.smartcat.cassandra.diagnostics.module.slowquery.SlowQueryModule", measurement: queryReport, moduleOptions: {slowQueryThresholdInMilliseconds=1}, moduleReporters: [io.smartcat.cassandra.diagnostics.reporter.LogReporter] } }
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.IllegalStateException: Unable to find Cassandra Connector implementation.
        at io.smartcat.cassandra.diagnostics.ConnectorFactory.getImplementation(ConnectorFactory.java:25)
        at io.smartcat.cassandra.diagnostics.DiagnosticsAgent.premain(DiagnosticsAgent.java:40)
        ... 6 more
FATAL ERROR in native method: processing of -javaagent failed

Can you please tell me what I am missing?

Thanks.

irumman commented 6 years ago

I am able to solve it. I was missing: /usr/share/dse/resources/cassandra/lib/cassandra-diagnostics-connector21-1.4.8.jar I copied it and now Cassandra started.

mgobec commented 6 years ago

Cool. We will check the installer after you feedback.