Enable Thrift in Cassandra Docker

cscan picture cscan · Jul 25, 2015 · Viewed 14.2k times · Source

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

Answer

Les Hazlewood picture Les Hazlewood · Jan 6, 2016

The sed workaround (and subsequent custom Dockerfiles that enable only this behavior) is no longer necessary.

Newer official Docker containers support a CASSANDRA_START_RPC environment variable using the -e flag. For example:

docker run --name cassandra1 -d -e CASSANDRA_START_RPC=true -p 9160:9160 -p 9042:9042 -p 7199:7199 -p 7001:7001 -p 7000:7000 cassandra