通过docker的本地dse群集

uhry853o  于 2021-06-09  发布在  Cassandra
关注(0)|答案(1)|浏览(316)

你好,
我想构建一个具有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

我的问题是。。。
如何通过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

这足以适应Cassandra。亚马尔?

iqih9akk

iqih9akk1#

对于dse,我建议使用已发布到docker hub的现有图像(您仍然可以从存储库获取docker文件定义),而不是自己构建docker图像。还有docker compose文件,可以用来创建本地集群-最好使用它们。
关于您的问题-您正在启动每个docker,为每个进程绑定端口,但由于冲突而无法工作。解决方案是只启动一个绑定到9042的端口,其余的不绑定到该端口

相关问题