Local DSE Cluster via Docker

170 views Asked by At

H ello,

I want to build a locales dse cluster with 3 nodes. I build each dse node as follows in a docker container

sudo docker pull debian:latest
sudo docker run -p 7001:7001 -p 9042:9042 -p 9160:9160 -u root --name mein-container -it -e https_proxy=http://10.241.50.94:8080 -e http_proxy=http://10.241.50.94:8080 debian:latest

and

apt-get update
apt-cache search wget
apt-cache search wget | grep wget
apt search wget
apt-get install wget -y

apt-get update && apt-get install -y gnupg2

wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add -
apt-get install software-properties-common -y

add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update && apt-get install adoptopenjdk-8-hotspot -y

echo "deb https://debian.datastax.com/enterprise stable main" | tee -a /etc/apt/sources.list.d/datastax.sources.list
apt install curl -y

curl -L https://debian.datastax.com/debian/repo_key | apt-key add -
apt-get update

apt-get install dse=5.1.10-1 \
    dse-full=5.1.10-1 \
    dse-libcassandra=5.1.10-1 \
    dse-libgraph=5.1.10-1 \
    dse-libhadoop2-client-native=5.1.10-1 \
    dse-libhadoop2-client=5.1.10-1 \
    dse-liblog4j=5.1.10-1 \
    dse-libsolr=5.1.10-1 \
    dse-libspark=5.1.10-1 \
    dse-libtomcat=5.1.10-1 -y

service dse start

My questions are...

  1. How I can access the cassandra in the container from my host via cqlsh? cqlsh localhost:9042 throws a error:
Traceback (most recent call last):
  File "/home/Software/apache-cassandra-3.11.1/bin/cqlsh.py", line 2434, in <module>
    main(*read_options(sys.argv[1:], os.environ))
  File "/home/Software/apache-cassandra-3.11.1/bin/cqlsh.py", line 2413, in main
    encoding=options.encoding)
  File "/home/Software/apache-cassandra-3.11.1/bin/cqlsh.py", line 479, in __init__
    load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
  File "/home/Software/apache-cassandra-3.11.1/bin/../lib/cassandra-driver-internal-only-3.10.zip/cassandra-driver-3.10/cassandra/policies.py", line 417, in __init__
socket.gaierror: [Errno -2] Name or service not known
  1. It is enough to adapt the cassandra.yaml?
1

There are 1 answers

0
Alex Ott On BEST ANSWER

Instead of building Docker images on your own, for DSE I suggest to use existing images published to Docker hub (you can still get Dockerfile definitions from the repository). There are also Docker compose files that you can use to create local clusters - it's better to use them.

Regarding your issue - you're starting each docker with binding of the ports for the each process, but it won't work because of conflicts. The solution will be to start only one bound to 9042, and the rest not bound to that port