启动userland代理时出错:listen tcp 0.0.0.0:9042:bind:address already in use'

70gysomp  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(699)

我正在尝试为kafka连接器和cassandra集群3示例设置landoop/fast data dev cluster,但得到“启动userland proxy:listen tcp 0.0.0.0:9042:bind:address already in use”的错误消息。
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'

iqih9akk

iqih9akk1#

在端口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

相关问题