Cassandra isn't starting when specified in circle.yml

One of our projects specifies Cassandra to be started but recently Circle refuses to start the Cassandra service:

service cassandra status || service cassandra start
cassandra: unrecognized service

service cassandra status || service cassandra start returned exit code 1

cassandra: unrecognized service
Action failed: Starting cassandra

Hi,

Are you actually trying to connect to the cluster and failing? I tried a test build and though I do get those error messages, running cqlsh works just fine for me.

It’s refusing to go any further in the build because Cassandra won’t start:

Are you building on the Trusty image? if so Cassandra isn’t currently available on that image. You’d need to install it yourself. Precise has it though.

Yes we’ve always built on the trusty image. What changed?

We get the error:

ubuntu@box1165:/var/log/cassandra$ service cassandra start
ubuntu@box1165:/var/log/cassandra$ start-stop-daemon: unable to set gid to 124 (Operation not permitted)

The Trusty image has only been around for a few months now. The default image is still Precise.

You must prefix this command with sudo

Best,
Lev

Hi Lev,

“service cassandra start” is being generated by Circle because we list “cassandra” under machine\services.

When we stop and start cassandra (to sed replace parts of the config file) later we use sudo.

Moving to the precise image returns us to building, but Cassandra still throws errors when started by Circle (though it doesn’t keep the build from continuing since we additionally stop and restart Cassandra as noted above)

-J

It appears that Cassandra (3.4) is supported in the Trusty image now…but it doesn’t seem to be starting when enabled in the circle.yml:

service cassandra status || service cassandra start

  • Cassandra is not running

I just ran into this issue as well and it seems that the root user is not using Java 8 which is required to start Cassandra.

=> java -version
java version "1.8.0_40"
Java™ SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot™ 64-Bit Server VM (build 25.40-b25, mixed mode)

=> sudo java -version
java version "1.7.0_101"
OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

I did some digging and found that the alternatives were not set up correctly. To fix it you can run
=> echo ‘3’ | sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status


  • 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
    1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
    2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
    3 /usr/lib/jvm/jdk1.8.0/bin/java 1 manual mode

Press enter to keep the current choice[*], or type selection number:

You should do this in the machine.pre section of your circle.yml so that Cassandra can start after