我正在尝试为具有3个实例的kafka连接器和cassandra群集设置landoop / fast-data-dev群集,但是我收到“启动userland代理时出错:监听tcp 0.0.0.0:9042:绑定:地址已在使用中” “。
使用sudo netstat -pna | grep 9042
我正进入(状态:
tcp 0 0 127.0.0.1:9042 0.0.0.0:* LISTEN 1166/java
我尝试过
pkill -f CassandraDaemon
和
docker rm -f $(docker ps -aq)
没有成功。
这是docker-compose文件:
version: '2'
services:
kafka-cluseter:
image: landoop/fast-data-dev:latest
environment:
ADV_HOST: 127.0.0.1
RUNTESTS: 0
ports:
- 2181:2181
- 3030:3030
- 8081-8083:8081-8083
- 9581-9585:9581-9585
- 9092:9092
###############################
cassandra0:
image: cassandra:latest
container_name: cassandra0
ports:
- 9042:9042
- 7199:7199
###############################
cassandra1:
image: cassandra:latest
container_name: cassandra1
ports:
- 9142:9042
links:
- cassandra0:seed
environment:
- CASSANDRA_SEEDS=seed
###############################
cassandra2:
image: cassandra:latest
container_name: cassandra2
ports:
- 9242:9042
links:
- cassandra0:seed
environment:
- CASSANDRA_SEEDS=seed
Cassandra实例在以下时间未启动
sudo docker-compose up -d
Creating network "kafka-code_default" with the default driver
Creating cassandra0 ... error
Creating kafka-code_kafka-cluseter_1 ...
ERROR: for cassandra0 Cannot start service cassandra0: b'driver failed programming external connectivity on endpoint cassandra0 (e5383709e9e9b45bbdf57a6445da0df4e4aa228269ad1d18c4c3de70bc903b0a): Error starting userland proxy: listen tcp 0Creating kafka-code_kafka-cluseter_1 ... done
ERROR: for cassandra0 Cannot start service cassandra0: b'driver failed programming external connectivity on endpoint cassandra0 (e5383709e9e9b45bbdf57a6445da0df4e4aa228269ad1d18c4c3de70bc903b0a): Error starting userland proxy: listen tcp 0.0.0.0:9042: bind: address already in use'
答案 0 :(得分:0)
您显示的端口9042上还有其他内容在运行:
sudo netstat -pna | grep 9042
tcp 0 0 127.0.0.1:9042 0.0.0.0:* LISTEN 1166/java
这就是为什么您无法启动也要使用相同端口的Docker容器的原因。
问题是您假设该端口上必须是Docker或Cassandra,并试图杀死它们
pkill -f CassandraDaemon
docker rm -f $(docker ps -aq)
您真正需要做的是找出1166
是什么进程,并终止该进程-或者,如果该进程正在运行,请为您的Docker容器选择另一个端口使用
ps -ef|grep 1166