datastax/metric-collector-for-apache-cassandra

Running the docker compose

StefanVinica opened this issue · 18 comments

When I'm trying to run the docker compose up I am running into this error

[6/7] RUN cp /build/target/datastax-mcac-agent-0.1.0-SNAPSHOT.jar /mcac/lib:
#11 0.231 cp: cannot stat '/build/target/datastax-mcac-agent-0.1.0-SNAPSHOT.jar': No such file or directory

problem

The issue is that the release version has been upgraded to 0.2.0, but the Dockerfile hasn't been changed to reflect this. If you edit your local copy of the Dockerfile in the project here and change 0.1.0 to 0.2.0, you should be able to work around this until the change is committed officially.

what about the docker-compose lines here
Lines 46 and 77

Lines 46 and 77

Yes, both of those lines as well. Sorry I was not familiar with that compose file.

image
Same thing again

Did you build the artifact first with mvn clean install -DskipTests?

Actually, I think the problem is that the Dockerfile specifies /build/target/datastax-mcac-agent-0.1.0-SNAPSHOT.jar but should be /build/target/datastax-mcac-agent-0.2.0.jar, if you have the current master branch checked out.

a diff that should get things working:

diff --git a/Dockerfile b/Dockerfile
index 3ed4003..cc74bb0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,6 +7,6 @@ RUN mvn -ff package -DskipTests
 
 RUN mkdir -p /mcac/lib
 
-RUN cp /build/target/datastax-mcac-agent-0.1.0-SNAPSHOT.jar /mcac/lib
+RUN cp /build/target/datastax-mcac-agent-0.2.0.jar /mcac/lib
 RUN cp -r /build/target/collectd /mcac/lib
 
diff --git a/dashboards/demo/docker-compose.yml b/dashboards/demo/docker-compose.yml
index 5a606eb..3fb7cc4 100644
--- a/dashboards/demo/docker-compose.yml
+++ b/dashboards/demo/docker-compose.yml
@@ -43,7 +43,7 @@ services:
     environment:
       MAX_HEAP_SIZE: "500M"
       HEAP_NEWSIZE: "100M"
-      JVM_EXTRA_OPTS: '-javaagent:/mcac/lib/datastax-mcac-agent-0.1.0-SNAPSHOT.jar  -Dcassandra.consistent.rangemovement=false -Dcassandra.ring_delay_ms=100'
+      JVM_EXTRA_OPTS: '-javaagent:/mcac/lib/datastax-mcac-agent-0.2.0.jar  -Dcassandra.consistent.rangemovement=false -Dcassandra.ring_delay_ms=100'
       CASSANDRA_NUM_TOKENS: 1
       CASSANDRA_SEEDS: "cassandra, cassandra2"
     healthcheck:
@@ -74,7 +74,7 @@ services:
     environment:
       MAX_HEAP_SIZE: "500M"
       HEAP_NEWSIZE: "100M"
-      JVM_EXTRA_OPTS: '-javaagent:/mcac/lib/datastax-mcac-agent-0.1.0-SNAPSHOT.jar -Dcassandra.consistent.rangemovement=false -Dcassandra.ring_delay_ms=100'
+      JVM_EXTRA_OPTS: '-javaagent:/mcac/lib/datastax-mcac-agent-0.2.0.jar -Dcassandra.consistent.rangemovement=false -Dcassandra.ring_delay_ms=100'
       CASSANDRA_NUM_TOKENS: 1
       CASSANDRA_SEEDS: "cassandra2, cassandra"
     depends_on:

Well the containers are starting but it still seems I'm having problem with the jar file
image

I'm not able to reproduce those errors locally. With the changes I posted, in the dashboards/demo directory, if I execute this:

docker-compose up

I see this:

Starting demo_mcac_1       ... done
Starting demo_prometheus_1 ... done
Starting demo_cassandra_1  ... done
Starting demo_cassandra2_1 ... done
Starting demo_stress2_1    ... done
Starting demo_stress_1     ... done
Attaching to demo_grafana_1, demo_mcac_1, demo_prometheus_1, demo_cassandra_1, demo_cassandra2_1, demo_stress_1, demo_stress2_1
cassandra_1   | CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.deserializeLargeSubset (Lorg/apache/cassandra/io/util/DataInputPlus;Lorg/apache/cassandra/db/Columns;I)Lorg/apache/cassandra/db/Columns;
cassandra_1   | CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.serializeLargeSubset (Ljava/util/Collection;ILorg/apache/cassandra/db/Columns;ILorg/apache/cassandra/io/util/DataOutputPlus;)V
cassandra_1   | CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.serializeLargeSubsetSize (Ljava/util/Collection;ILorg/apache/cassandra/db/Columns;I)I
cassandra_1   | CompilerOracle: dontinline org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.advanceAllocatingFrom (Lorg/apache/cassandra/db/commitlog/CommitLogSegment;)V
cassandra_1   | CompilerOracle: dontinline org/apache/cassandra/db/transform/BaseIterator.tryGetMoreContents ()Z
grafana_1     | installing grafana-polystat-panel @ 1.2.3
grafana_1     | from: https://grafana.com/api/plugins/grafana-polystat-panel/versions/1.2.3/download
grafana_1     | into: /var/lib/grafana/plugins
grafana_1     | 
cassandra2_1  | CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.deserializeLargeSubset (Lorg/apache/cassandra/io/util/DataInputPlus;Lorg/apache/cassandra/db/Columns;I)Lorg/apache/cassandra/db/Columns;
cassandra2_1  | CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.serializeLargeSubset (Ljava/util/Collection;ILorg/apache/cassandra/db/Columns;ILorg/apache/cassandra/io/util/DataOutputPlus;)V
cassandra2_1  | CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.serializeLargeSubsetSize (Ljava/util/Collection;ILorg/apache/cassandra/db/Columns;I)I
cassandra2_1  | CompilerOracle: dontinline org/apache/cassandra/db/commitlog/AbstractCommitLogSegmentManager.advanceAllocatingFrom (Lorg/apache/cassandra/db/commitlog/CommitLogSegment;)V
cassandra2_1  | CompilerOracle: dontinline org/apache/cassandra/db/transform/BaseIterator.tryGetMoreContents ()Z
...

Eventually stress tests start running:

stress_1      | Creating tlp_stress: 
stress_1      | CREATE KEYSPACE
stress_1      |  IF NOT EXISTS tlp_stress
stress_1      |  WITH replication = {'class': 'SimpleStrategy', 'replication_factor':3 }
stress_1      | 
stress2_1     | Creating tlp_stress: 
stress2_1     | CREATE KEYSPACE
stress2_1     |  IF NOT EXISTS tlp_stress
stress2_1     |  WITH replication = {'class': 'SimpleStrategy', 'replication_factor':3 }
stress2_1     | 
...

And after that I am able to access http://loclahost:3000 and I see the Grafana dashboard with Cassandra metrics as expected.

I wouldn't expect it to change, but could you try using the branch I pushed here:
https://github.com/emerkle826/metric-collector-for-apache-cassandra/tree/dockerfile-fix

After running
docker-compose up
I get this
image
and the tests still don't run
image

MCAC_ROOT="/home/stefan/datastax-mcac-agent-0.2.0"
JVM_OPTS="$JVM_OPTS -javaagent:${MCAC_ROOT}/lib/datastax-mcac-agent.jar"

This is what i have in my cassandra-env.sh file

MCAC_ROOT="/home/stefan/datastax-mcac-agent-0.2.0"
JVM_OPTS="$JVM_OPTS -javaagent:${MCAC_ROOT}/lib/datastax-mcac-agent.jar"

This is what i have in my cassandra-env.sh file

I'm not sure where you have your cassandra-env.shfile, but the JVM_OPTS line looks wrong. The jarfile created in the build would be named datastax-mcac-agent-0.2.0.jar, not datastax-mcac-agent.jar

image
I must be doing something wrong then, I downloaded the file and then created the cassandra-env.sh file then added those 2 lines

I must be doing something wrong then, I downloaded the file and then created the cassandra-env.sh file then added those 2 lines

So are you trying this on a deployed Cassandra, or using the demo? I thought you were trying to use the demo and using docker-compose up.

https://github.com/datastax/metric-collector-for-apache-cassandra/tree/master/dashboards/demo

I'm trying the Demo and using docker-compose up but after it finishes building the only containers running are
image
so after inspecting the Cassandra node I see this
image

image
there is no data in the dashboards

@StefanVinica I'm not sure what the issue is. I tried to run this from an old mac I had laying around. After installing Docker on it, I pulled my branch and without doing anything else, I changed into the dashboard/demo directory and ran docker-compose up. My mac is pretty under powered so I could only get one instance of Cassandra up, but it came up.
I'm not sure what else to try. From the error, it seems the Cassandra container doesn't have, or can't read the agent jarfile, or possibly the file is somehow corrupt. But docker-compose should be building the jarfile, so I don't know how that would happen.

Update the problem was access so I used sudo docker-compose up for anyone else with this problem in the future