Search code examples
cassandradockerthrift

Enable Thrift in Cassandra Docker


I'm trying to start up a docker image that runs cassandra. I need to use thrift to communicate with cassandra, but it looks like that's disabled by default. Checking out the cassandra logs shows:

INFO  21:10:35 Not starting RPC server as requested. 
  Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it

My question is: how can I enable thrift when starting this cassandra container?

I've tried to set various environment variables to no avail:

docker run --name cs1 -d -e "start_rpc=true" cassandra
docker run --name cs1 -d -e "CASSANDRA_START_RPC=true" cassandra
docker run --name cs1 -d -e "enablethrift=true" cassandra

Solution

  • I've been having the same problem with the Docker Cassandra image. You can use my docker container on Github or on Docker hub instead of the default Cassandra image.

    The problem is that the cassandra.yaml file has start_rpc set to false. We need to change that. To do that we can use the following Dockerfile (which is what my image does):

    FROM cassandra
    RUN sed -i 's/^start_rpc.*$/start_rpc: true/' /etc/cassandra/cassandra.yaml