type or paste code here
Where did you try to connect to the node from?
Note, that by default, scylla will bind to the localhost
address, which is not accessible from outside the docker container. The most convenient way to achieve this is to just add --network=host
to your docker run
command. This is fine in development setups.
A more complete solution is to specify in scylla.yaml
ip addresses for listen_address
and rpc_address
, such that they are accessible from the client’s network and the network the other scylla nodes are in respectively (the two can be the same). See Administration Guide | ScyllaDB Docs for more details.
I was able to do just that with running 3-node Scylla cluster in local docker. I also have JAVA application running in the container in the same docker that connects to Scylla. Here is how I set it up:
docker-compose.yml
version: '3'
services:
scylla-docker1:
image: scylladb/scylla
container_name: scylla-docker1
environment:
- CLUSTER_NAME=scylla-docker
command:
- --alternator-port 8000
- --alternator-write-isolation unsafe
- --smp 1
networks:
- test-net
scylla-docker2:
image: scylladb/scylla
container_name: scylla-docker2
environment:
- CLUSTER_NAME=scylla-docker
command:
- --seeds="scylla-docker1"
- --alternator-port 8000
- --alternator-write-isolation unsafe
- --smp 1
networks:
- test-net
scylla-docker3:
image: scylladb/scylla
container_name: scylla-docker3
environment:
- CLUSTER_NAME=scylla-docker
command:
- --seeds="scylla-docker1"
- --alternator-port 8000
- --alternator-write-isolation unsafe
- --smp 1
networks:
- test-net
networks:
test-net:
name: test-net
external: true
startup-script.sh
docker rmi $(docker images -f "dangling=true" -q)
docker network inspect test-net >/dev/null 2>&1 || docker network create -d bridge test-net
docker network ls
docker container ls
docker-compose up -d
docker run --network test-net --env-file ${PWD}/.env test-java-scylla:0.0.2