Skip to content

Preparing Standalone Cassandra Inside Docker Container

Nathan Brazil edited this page Apr 14, 2018 · 17 revisions

Introduction

You can run Cassandra locally (or on another machine) as a Docker container. Doing so can be advantageous over installing Cassandra natively on your machine, as the setup is easier. See Docker Hub for more information.

Docker Compose

You can manage Cassandra on your development setup using Docker Compose. Here is a sample docker-compose.yml file:

version: '3.1'

services:
  cassandra:
    container_name: cassandra
    image: cassandra:3.11.2
    ports:
      - 9042:9042

With the above file in place, execute the docker-compose up -d command to bring up a single-node Cassandra. You can connect to it once you log entries like these via docker logs -f cassandra:

INFO  [main] 2018-04-14 17:41:04,821 NativeTransportService.java:70 - Netty using native Epoll event loop
INFO  [main] 2018-04-14 17:41:05,060 Server.java:155 - Using Netty Version: [netty-buffer=netty-buffer-4.0.44.Final.452812a, netty-codec=netty-codec-4.0.44.Final.452812a, netty-codec-haproxy=netty-codec-haproxy-4.0.44.Final.452812a, netty-codec-http=netty-codec-http-4.0.44.Final.452812a, netty-codec-socks=netty-codec-socks-4.0.44.Final.452812a, netty-common=netty-common-4.0.44.Final.452812a, netty-handler=netty-handler-4.0.44.Final.452812a, netty-tcnative=netty-tcnative-1.1.33.Fork26.142ecbb, netty-transport=netty-transport-4.0.44.Final.452812a, netty-transport-native-epoll=netty-transport-native-epoll-4.0.44.Final.452812a, netty-transport-rxtx=netty-transport-rxtx-4.0.44.Final.452812a, netty-transport-sctp=netty-transport-sctp-4.0.44.Final.452812a, netty-transport-udt=netty-transport-udt-4.0.44.Final.452812a]
INFO  [main] 2018-04-14 17:41:05,073 Server.java:156 - Starting listening for CQL clients on /0.0.0.0:9042 (unencrypted)...
Clone this wiki locally