skip to Main Content

I’m trying to get started with Cassandra by following the directions on https://cassandra.apache.org/_/quickstart.html, but step two doesn’t make sense. This command: docker run --name cassandra cassandra starts a container. Then the second command (docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra) attempts to start another container with the same name which fails because the container already exists. But if it didn’t it refers to a network that doesn’t exist.

If instead of the first command I run docker network cassandra and then run the second command as given the command in step four (docker run --rm --network cassandra -v "$(pwd)/data.cql:/scripts/data.cql" -e CQLSH_HOST=cassandra -e CQLSH_PORT=9042 nuvo/docker-cqlsh) fails to connect to cassandra.

2

Answers


  1. [EDITED] I’ve removed my answer since we have now corrected the steps on the Quickstart page on the Cassandra website (CASSANDRA-17485). Cheers!

    Login or Signup to reply.
  2. Yes, the instructions on the Cassandra Quickstart page look to be out of date. The following steps worked for me just now:

    # step 1 (same as on the page)
    docker pull cassandra:latest
    
    # step 2, create network
    docker network create cassandra
    
    # step 2, start server
    docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra
    
    # step 3, follow directions on page to create cql file
    
    # step 4, run the contents of data.cql
    docker run --rm -it --network cassandra  -v "$(pwd)/data.cql:/scripts/data.cql" nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.5' -f /scripts/data.cql
    
    # step 5, create interactive shell
    docker run --rm -it --network cassandra  -v "$(pwd)/data.cql:/scripts/data.cql" nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.5'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search