通过 Docker 的本地 DSE 集群

Local DSE Cluster via Docker

你好,

我想构建一个具有 3 个节点的 locales dse 集群。我在 docker 容器

中按如下方式构建每个 dse 节点
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

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

我的问题是...

  1. 如何通过 cqlsh 从我的主机访问容器中的 cassandra? cqlsh localhost:9042 抛出错误:
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. 适配就够了cassandra.yaml?

对于 DSE,我建议使用发布到 Docker 中心的现有图像,而不是自己构建 Docker 图像(您仍然可以从 repository). There are also Docker compose files 可以用来创建本地集群 - 最好使用它们。

关于您的问题 - 您在每个 docker 开始时都绑定了每个进程的端口,但由于冲突而无法正常工作。解决方案是只启动一个绑定到 9042,其余的不绑定到该端口