您好,我正在尝试通过kafka通过SSL发送消息,我已经完成了kafka ssl和生产者和消费者环境ssl的所有必要配置,但是当我尝试发送消息时,出现错误。我不明白问题是否与生产者或消费者中的环境配置有关,或者这是否是kafka配置问题。 这是一些代码和错误
david@david-Notebook-P14:~/Desktop/docker-projects$ docker-compose down
Stopping docker-projects_wordpress_1 ... error
Stopping docker-projects_phpmyadmin_1 ... error
Stopping mailhog ... error
Stopping docker-projects_wordpress_db_1 ... error
ERROR: for mailhog b'cannot stop container: 171cb796bfc6f72294dc66fc0d6277bedda358052db9a95fca6b05c5d0222959: Cannot kill container 171cb796bfc6f72294dc66fc0d6277bedda358052db9a95fca6b05c5d0222959: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied"\n: unknown'
ERROR: for docker-projects_wordpress_1 b'cannot stop container: 47f29abaf5027d626ea55c7bd4d24a4369f37207d8d723000daa65f6a3b330cf: Cannot kill container 47f29abaf5027d626ea55c7bd4d24a4369f37207d8d723000daa65f6a3b330cf: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied"\n: unknown'
ERROR: for docker-projects_phpmyadmin_1 b'cannot stop container: 6911429b36f56ed310c94b4fff91247abea44d9ce4524facd13409a2972df5f2: Cannot kill container 6911429b36f56ed310c94b4fff91247abea44d9ce4524facd13409a2972df5f2: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied"\n: unknown'
david@david-Notebook-P14:~/Desktop/docker-projects$ ps aux | grep dockerd
root 1120 0.3 1.8 493900 71232 ? Ssl 09:32 0:08 dockerd -G docker --exec-root=/var/snap/docker/384/run/docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/var/snap/docker/384/run/docker.pid --config-file=/var/snap/docker/384/config/daemon.json --debug
root 1559 0.0 1.0 781576 40784 ? Ssl 09:32 0:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
david 6053 0.0 0.0 21540 1076 pts/0 S+ 10:17 0:00 grep --color=auto dockerd
david@david-Notebook-P14:~/Desktop/docker-projects$ sudo docker-compose down
[sudo] password for david:
Stopping docker-projects_wordpress_1 ... error
Stopping docker-projects_phpmyadmin_1 ... error
Stopping mailhog ... error
Stopping docker-projects_wordpress_db_1 ... error
ERROR: for docker-projects_phpmyadmin_1 b'cannot stop container: 6911429b36f56ed310c94b4fff91247abea44d9ce4524facd13409a2972df5f2: Cannot kill container 6911429b36f56ed310c94b4fff91247abea44d9ce4524facd13409a2972df5f2: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied"\n: unknown'
ERROR: for mailhog b'cannot stop container: 171cb796bfc6f72294dc66fc0d6277bedda358052db9a95fca6b05c5d0222959: Cannot kill container 171cb796bfc6f72294dc66fc0d6277bedda358052db9a95fca6b05c5d0222959: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied"\n: unknown'
ERROR: for docker-projects_wordpress_1 b'cannot stop container: 47f29abaf5027d626ea55c7bd4d24a4369f37207d8d723000daa65f6a3b330cf: Cannot kill container 47f29abaf5027d626ea55c7bd4d24a4369f37207d8d723000daa65f6a3b330cf: unknown error after kill: docker-runc did not terminate sucessfully: container_linux.go:393: signaling init process caused "permission denied"\n: unknown'
生产者环境配置
kafka:
image: confluent/kafka
environment:
KAFKA_BROKER_ID: 1
KAFKA_ADVERTISED_PORT: 9098
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_LISTENERS: 'SSL://:9098'
KAFKA_ADVERTISED_LISTENERS: 'SSL://localhost:9098'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_SSL_KEYSTORE_LOCATION: /certs/docker.kafka.server.keystore.jks
KAFKA_SSL_KEYSTORE_PASSWORD: 'kafkadocker'
KAFKA_SSL_KEY_PASSWORD: 'kafkadocker'
KAFKA_SSL_TRUSTSTORE_LOCATION: /certs/docker.kafka.server.truststore.jks
KAFKA_SSL_TRUSTSTORE_PASSWORD: 'kafkadocker'
KAFKA_SSL_CLIENT_AUTH: 'required'
KAFKA_SECURITY_INTER_BROKER_PROTOCOL: 'SSL'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./certs:/certs
ports:
- "9098:9098"
links:
- zookeeper
depends_on:
- zookeeper
container_name: kafka_local_SSL'
错误
kafka:
bootstrap-servers: localhost:9098
# bootstrap-servers: 192.168.99.100:9092
properties:
security.protocol: SSL
producer:
ssl:
key-password: kafkadocker
keystore-location: file:/home/user/Desktop/Project/nlp-sogei-integration-ms/nlp-sip-docker/security/certs/docker.kafka.client.keystore.jks
keystore-password: kafkadocker
truststore-location: file:/home/user/Desktop/Project/nlp-sogei-integration-ms/nlp-sip-docker/security/certs/docker.kafka.client.truststore.jks
truststore-password: kafkadocker
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: sip.core.service.kafka.CustomSerializer '