Team1-TU-tech / semi_final

0 stars 0 forks source link

[2024-11-13 00:00:28,967] INFO shutting down (kafka.server.KafkaServer) #17

Open hamsunwoo opened 1 week ago

hamsunwoo commented 1 week ago
[2024-11-13 00:00:28,957] INFO shutting down (kafka.server.KafkaServer)
[2024-11-13 00:00:28,964] INFO App info kafka.server for 1 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2024-11-13 00:00:28,964] INFO shut down completed (kafka.server.KafkaServer)
[2024-11-13 00:00:28,964] ERROR Exiting Kafka due to fatal exception during startup. (kafka.Kafka$)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
    at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:257)
    at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:253)
    at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:115)
    at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:2317)
    at kafka.zk.KafkaZkClient$.createZkClient(KafkaZkClient.scala:2407)
    at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:748)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:230)
    at kafka.Kafka$.main(Kafka.scala:112)
    at kafka.Kafka.main(Kafka.scala)
[2024-11-13 00:00:28,967] INFO shutting down (kafka.server.KafkaServer)
hamsunwoo commented 1 week ago

문제: 주키퍼 3개를 늘렸을 때 연결이 안되는 문제가 있었다. 주키퍼 로그를 살펴보니

2024-11-13 00:50:30,508 [myid:] - ERROR [ListenerHandler-zookeeper1/192.168.16.2:3889:o.a.z.s.q.QuorumCnxManager$Listener$ListenerHandler@1099] - Exception while listening to address zookeeper1/192.168.16.2:3889
zookeeper2  | java.net.BindException: Cannot assign requested address (Bind failed)
zookeeper2  |   at java.base/java.net.PlainSocketImpl.socketBind(Native Method)
zookeeper2  |   at java.base/java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:452)
zookeeper2  |   at java.base/java.net.ServerSocket.bind(ServerSocket.java:395)
zookeeper2  |   at java.base/java.net.ServerSocket.bind(ServerSocket.java:349)
zookeeper2  |   at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.createNewServerSocket(QuorumCnxManager.java:1141)
zookeeper2  |   at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.acceptConnections(QuorumCnxManager.java:1070)
zookeeper2  |   at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener$ListenerHandler.run(QuorumCnxManager.java:1039)
zookeeper2  |   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
zookeeper2  |   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
zookeeper2  |   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
zookeeper2  |   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
zookeeper2  |   at java.base/java.lang.Thread.run(Thread.java:829)

java.net.BindException: Cannot assign requested address (Bind failed) 오류는 ZooKeeper 인스턴스가 3889 포트에 바인딩하려고 할 때 실패했음을 나타낸다.

hamsunwoo commented 1 week ago

원래 코드는 이랬다.

zookeeper1:
    image: bitnami/zookeeper:3.6.3
    container_name: zookeeper1
    hostname: zookeeper1
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
      - ZOO_MY_ID=1
      - ZOO_SERVERS=zookeeper1:2888:3889;zookeeper2:2888:3889;zookeeper3:2888:3889
      - ZOO_TICK_TIME=2000  # 2초
      - ZOO_INIT_LIMIT=10   # 초기 연결 제한 시간
      - ZOO_SYNC_LIMIT=5    # 동기화 제한 시간
    ports:
      - "2181:2181"
    networks:
      - kafka_network

  zookeeper2:
    image: bitnami/zookeeper:3.6.3
    container_name: zookeeper2
    hostname: zookeeper2
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
      - ZOO_MY_ID=2
       - ZOO_SERVERS=zookeeper1:2888:3889;zookeeper2:2888:3889;zookeeper3:2888:3889
      - ZOO_TICK_TIME=2000  # 2초
      - ZOO_INIT_LIMIT=10   # 초기 연결 제한 시간
      - ZOO_SYNC_LIMIT=5    # 동기화 제한 시간
    ports:
      - "2182:2181"
    networks:
      - kafka_network

  zookeeper3:
    image: bitnami/zookeeper:3.6.3
    container_name: zookeeper3
    hostname: zookeeper3
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
      - ZOO_MY_ID=3
      - ZOO_SERVERS=zookeeper1:2888:3889;zookeeper2:2888:3889;zookeeper3:2888:3889
      - ZOO_TICK_TIME=2000  # 2초
      - ZOO_INIT_LIMIT=10   # 초기 연결 제한 시간
      - ZOO_SYNC_LIMIT=5    # 동기화 제한 시간
    ports:
      - "2183:2181"
    networks:
      - kafka_network

ZOO_SERVERS=zookeeper1:2888:3889;zookeeper2:2888:3889;zookeeper3:2888:3889 를 없애니 잘 작동되었다.