Задать вопрос
drno-reg
@drno-reg
см не кратко

GitlabCI как решить проблему с сервисами kafka и zookeeper ERROR Unable to resolve address: zookeeper:2181?

Для реализации задачи тестирования на gitlab ci пытаюсь воспользоваться services

integration_test:
  image: $CI_REGISTRY/platform/docker-images/rpm-builder:etl-spark-python-3.6
  stage: test
  variables:
    # KAFKA SERVICES
    KAFKA_HOST: kafka
    ALLOW_ANONYMOUS_LOGIN: "yes"
    ALLOW_PLAINTEXT_LISTENER: "yes"
    KAFKA_CFG_ZOOKEEPER_CONNECT: "zookeeper:2181"
  services:
    - name: $CI_REGISTRY/bitnami/zookeeper:latest
      alias: zookeeper
    - name: $CI_REGISTRY/bitnami/kafka:latest
      alias: kafka
  script:
    # Copy base files for spark
    - cp -ir /app/* ./


при подъеме сервисов возвращается ошибка

Service container logs:
2022-01-17T18:47:42.438533980Z kafka 18:47:42.43 
2022-01-17T18:47:42.439726418Z kafka 18:47:42.43 Welcome to the Bitnami kafka container
2022-01-17T18:47:42.441043769Z kafka 18:47:42.44 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-kafka
2022-01-17T18:47:42.442225944Z kafka 18:47:42.44 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-kafka/issues
2022-01-17T18:47:42.443420255Z kafka 18:47:42.44 
2022-01-17T18:47:42.444662314Z kafka 18:47:42.44 INFO  ==> ** Starting Kafka setup **
2022-01-17T18:47:42.492055880Z kafka 18:47:42.49 WARN  ==> You set the environment variable ALLOW_PLAINTEXT_LISTENER=yes. For safety reasons, do not use this flag in a production environment.
2022-01-17T18:47:42.501865183Z kafka 18:47:42.50 INFO  ==> Initializing Kafka...
2022-01-17T18:47:42.508696785Z kafka 18:47:42.50 INFO  ==> No injected configuration files found, creating default config files
2022-01-17T18:47:42.576396875Z kafka 18:47:42.57 INFO  ==> ** Kafka setup finished! **
2022-01-17T18:47:42.576440084Z 
2022-01-17T18:47:42.594123673Z kafka 18:47:42.59 INFO  ==> ** Starting Kafka **
2022-01-17T18:47:43.474583867Z [2022-01-17 18:47:43,474] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
2022-01-17T18:47:43.938419050Z [2022-01-17 18:47:43,938] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
2022-01-17T18:47:44.048924378Z [2022-01-17 18:47:44,048] INFO Registered signal handlers for TERM, INT, HUP (org.apache.kafka.common.utils.LoggingSignalHandler)
2022-01-17T18:47:44.051763052Z [2022-01-17 18:47:44,051] INFO starting (kafka.server.KafkaServer)
2022-01-17T18:47:44.052194609Z [2022-01-17 18:47:44,052] INFO Connecting to zookeeper on zookeeper:2181 (kafka.server.KafkaServer)
2022-01-17T18:47:44.068206148Z [2022-01-17 18:47:44,067] INFO [ZooKeeperClient Kafka server] Initializing a new session to zookeeper:2181. (kafka.zookeeper.ZooKeeperClient)
2022-01-17T18:47:44.073037886Z [2022-01-17 18:47:44,072] INFO Client environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073054713Z [2022-01-17 18:47:44,072] INFO Client environment:host.name=253a7ecd266d (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073057592Z [2022-01-17 18:47:44,072] INFO Client environment:java.version=11.0.13 (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073060310Z [2022-01-17 18:47:44,072] INFO Client environment:java.vendor=BellSoft (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073072484Z [2022-01-17 18:47:44,072] INFO Client environment:java.home=/opt/bitnami/java (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073155184Z [2022-01-17 18:47:44,073] INFO Client environment:java.class.path=/opt/bitnami/kafka/bin/../libs/activation-1.1.1.jar:/opt/bitnami/kafka/bin/../libs/aopalliance-3.6.3.jar:/opt/bitnami/kafka/bin/../libs/zstd-jni-1.5.0-2.jar (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073264080Z [2022-01-17 18:47:44,073] INFO Client environment:java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073282854Z [2022-01-17 18:47:44,073] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073287291Z [2022-01-17 18:47:44,073] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073324331Z [2022-01-17 18:47:44,073] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073346295Z [2022-01-17 18:47:44,073] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073375677Z [2022-01-17 18:47:44,073] INFO Client environment:os.version=4.1.12-124.22.2.el7uek.x86_64 (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073379826Z [2022-01-17 18:47:44,073] INFO Client environment:user.name=? (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073430178Z [2022-01-17 18:47:44,073] INFO Client environment:user.home=? (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073468545Z [2022-01-17 18:47:44,073] INFO Client environment:user.dir=/ (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073488353Z [2022-01-17 18:47:44,073] INFO Client environment:os.memory.free=1010MB (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073543290Z [2022-01-17 18:47:44,073] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.073549405Z [2022-01-17 18:47:44,073] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.075679856Z [2022-01-17 18:47:44,075] INFO Initiating client connection, connectString=zookeeper:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@3700ec9c (org.apache.zookeeper.ZooKeeper)
2022-01-17T18:47:44.080141410Z [2022-01-17 18:47:44,080] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
2022-01-17T18:47:44.084960045Z [2022-01-17 18:47:44,084] INFO zookeeper.request.timeout value is 0. feature enabled=false (org.apache.zookeeper.ClientCnxn)
2022-01-17T18:47:44.086992807Z [2022-01-17 18:47:44,086] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
2022-01-17T18:47:44.094487882Z [2022-01-17 18:47:44,091] ERROR Unable to resolve address: zookeeper:2181 (org.apache.zookeeper.client.StaticHostProvider)
2022-01-17T18:47:44.094502342Z java.net.UnknownHostException: zookeeper: Name or service not known
2022-01-17T18:47:44.094505342Z 	at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
2022-01-17T18:47:44.094508179Z 	at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
2022-01-17T18:47:44.094511436Z 	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1519)
2022-01-17T18:47:44.094526980Z 	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848)
2022-01-17T18:47:44.094529836Z 	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1509)
2022-01-17T18:47:44.094532442Z 	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1368)
2022-01-17T18:47:44.094535523Z 	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1302)
2022-01-17T18:47:44.094538134Z 	at org.apache.zookeeper.client.StaticHostProvider$1.getAllByName(StaticHostProvider.java:88)
2022-01-17T18:47:44.094540779Z 	at org.apache.zookeeper.client.StaticHostProvider.resolve(StaticHostProvider.java:141)
2022-01-17T18:47:44.094543344Z 	at org.apache.zookeeper.client.StaticHostProvider.next(StaticHostProvider.java:368)
2022-01-17T18:47:44.094545978Z 	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1207)
2022-01-17T18:47:44.100106437Z [2022-01-17 18:47:44,099] WARN Session 0x0 for sever zookeeper:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException. (org.apache.zookeeper.ClientCnxn)
2022-01-17T18:47:44.100122479Z java.lang.IllegalArgumentException: Unable to canonicalize address zookeeper:2181 because it's not resolvable
2022-01-17T18:47:44.100125855Z 	at org.apache.zookeeper.SaslServerPrincipal.getServerPrincipal(SaslServerPrincipal.java:78)
2022-01-17T18:47:44.100128814Z 	at org.apache.zookeeper.SaslServerPrincipal.getServerPrincipal(SaslServerPrincipal.java:41)
2022-01-17T18:47:44.100131534Z 	at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1161)
2022-01-17T18:47:44.100134049Z 	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1210)


начинается бодро но в итоге: ERROR Unable to resolve address: zookeeper:2181

В чем может быть проблема и как ее решить?
  • Вопрос задан
  • 1138 просмотров
Подписаться 1 Простой Комментировать
Решения вопроса 1
drno-reg
@drno-reg Автор вопроса
см не кратко
объявление в ENV переменной окружения
FF_NETWORK_PER_BUILD: "true

решило проблему

integration_test:
  image: $CI_REGISTRY/platform/docker-images/rpm-builder:etl-spark-python-3.6
  stage: test
  variables:
    # KAFKA SERVICES
    KAFKA_HOST: kafka
    ALLOW_ANONYMOUS_LOGIN: "yes"
    ALLOW_PLAINTEXT_LISTENER: "yes"
    FF_NETWORK_PER_BUILD: "true
    KAFKA_CFG_ZOOKEEPER_CONNECT: "zookeeper:2181"
  services:
    - name: $CI_REGISTRY/bitnami/zookeeper:latest
      alias: zookeeper
    - name: $CI_REGISTRY/bitnami/kafka:latest
      alias: kafka
  script:
    # Copy base files for spark
    - cp -ir /app/* ./
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы