skip to Main Content

I’m following this quickstart: https://cassandra.apache.org/_/quickstart.html

I created this network “cassandra” (step 2)

docker network create cassandra

[ { “Name”: “cassandra”, “Id”:
“90110775f66993f8588559650da813ba1f30bd785ca9b13d2e5fff46cb2685e0”,
“Created”: “2023-06-12T23:03:45.05532Z”, “Scope”: “local”, “Driver”:
“bridge”, “EnableIPv6”: false, “IPAM”: { “Driver”: “default”,
“Options”: {}, “Config”: [ { “Subnet”: “172.21.0.0/16”, “Gateway”:
“172.21.0.1” } ] }, “Internal”: false, “Attachable”: false, “Ingress”:
false, “ConfigFrom”: { “Network”: “” }, “ConfigOnly”: false,
“Containers”: {}, “Options”: {}, “Labels”: {} } ]

After that running (step 2)

docker run –rm -d –name cassandra –hostname cassandra –network
cassandra cassandra

After running (step 5) gotting this error:

docker run –rm -it –network cassandra nuvo/docker-cqlsh cqlsh
cassandra 9042 –cqlversion=‘3.4.5’

Traceback (most recent call last): File “/usr/local/bin/cqlsh”, line
2816, in main(*read_options(sys.argv[1:], os.environ)) File
“/usr/local/bin/cqlsh”, line 2795, in main encoding=options.encoding)
File “/usr/local/bin/cqlsh”, line 690, in init
load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]), File
“/usr/local/lib/python2.7/site-packages/cassandra/policies.py”, line
425, in init for endpoint in socket.getaddrinfo(a, None,
socket.AF_UNSPEC, socket.SOCK_STREAM)] socket.gaierror: [Errno -2] Name does not resolve

2

Answers


  1. Chosen as BEST ANSWER

    I found the problem with that.

    My docker container was killed by docker because my memory was configured with low values:

    https://lucianomolinari.com/2017/06/11/containers-being-killed-on-docker-for-mac/

    Unfortunatelly I wasn't getting any error.


  2. The guide works still, but with 1 caveat, the –cqlshversion needs to be incremented to 3.4.6, because cassandra:latest has moved forwards.

    ~ % docker pull cassandra:latest
    latest: Pulling from library/cassandra
    99803d4b97f3: Pull complete
    7affba4c9a33: Pull complete
    272204ded759: Pull complete
    1bd3d9ca0baf: Pull complete
    378262bde537: Pull complete
    248d11231fdc: Pull complete
    b5291296f116: Pull complete
    f2ee33e4006d: Pull complete
    25577cbc0305: Pull complete
    Digest: sha256:63f6e18ad5ed3fdaa16d36e175260fe2fd9c944cb7aa9833558c2de68e56753d
    Status: Downloaded newer image for cassandra:latest
    docker.io/library/cassandra:latest
    ~ % docker network create cassandra
    166aa6312dd6c752e7180dae1adf40f7e267c72cec1573a3247ab449ccb0b4e5
    ~ % docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra
    9ace16f7f0665d7f2c505fc8f55e5db67872f00ff01abf6eae080466c1bf8dc9
    ~ % docker ps
    CONTAINER ID   IMAGE       COMMAND                  CREATED          STATUS          PORTS                                         NAMES
    9ace16f7f066   cassandra   "docker-entrypoint.s…"   15 seconds ago   Up 13 seconds   7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp   cassandra
    ~ % docker run --rm --network cassandra -v "$(pwd)/data.cql:/scripts/data.cql" -e CQLSH_HOST=cassandra -e CQLSH_PORT=9042 -e CQLVERSION=3.4.6 nuvo/docker-cqlsh
    Checking connection to cassandra...
    Connected to Test Cluster at cassandra:9042.
    Executing /scripts/data.cql...
    Done.
    ~ % docker run --rm -it --network cassandra nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.6'
    Connected to Test Cluster at cassandra:9042.
    [cqlsh 5.0.1 | Cassandra 4.1.2 | CQL spec 3.4.6 | Native protocol v5]
    Use HELP for help.
    cqlsh>
    

    Using the CQLVERSION=3.4.5 does not work as mentioned, attempting to use 3.4.5 generates this response:

    ~ % docker run --rm -it --network cassandra nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.5'
    Connection error: ('Unable to connect to any servers', {'172.31.0.2': ProtocolError("cql_version '3.4.5' is not supported by remote (w/ native protocol). Supported versions: [u'3.4.6']",)})
    

    I would try first to use the 3.4.6 – although the python stack trace indicates that you have a container not in the network?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search