docker 安装kafka一直无法测试生产者生产消息成功

1.docker 安装kafka一直无法测试生产者生产消息成功

docker安装完kafka之后,创建topic没有报错
bash-4.4# kafka-topics.sh --create --zookeeper 118.190.26.133:2181 --replication-factor 1 --partitions 1 --topic mytest_topic
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Created topic mytest_topic.

但是运行生产者时候出现了一下错误
bash-4.4# kafka-console-producer.sh --broker-list 118.190.26.133:9092 --topic mytest_topic

[2020-04-20 02:50:33,086] WARN [Producer clientId=console-producer] Connection to node -1 (/118.190.26.133:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,087] WARN [Producer clientId=console-producer] Bootstrap broker 118.190.26.133:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,175] WARN [Producer clientId=console-producer] Connection to node -1 (/118.190.26.133:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,175] WARN [Producer clientId=console-producer] Bootstrap broker 118.190.26.133:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,277] WARN [Producer clientId=console-producer] Connection to node -1 (/118.190.26.133:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,277] WARN [Producer clientId=console-producer] Bootstrap broker 118.190.26.133:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,480] WARN [Producer clientId=console-producer] Connection to node -1 (/118.190.26.133:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,480] WARN [Producer clientId=console-producer] Bootstrap broker 118.190.26.133:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,934] WARN [Producer clientId=console-producer] Connection to node -1 (/118.190.26.133:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:33,934] WARN [Producer clientId=console-producer] Bootstrap broker 118.190.26.133:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
[2020-04-20 02:50:34,741] WARN [Producer clientId=console-producer] Connection to node -1 (/118.190.26.133:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

以下是server.propertise配置文件信息
connect-distributed.properties connect-log4j.properties consumer.properties server.properties zookeeper.properties
bash-4.4# vi server.properties

Licensed to the Apache Software Foundation (ASF) under one or more

contributor license agreements. See the NOTICE file distributed with

this work for additional information regarding copyright ownership.

The ASF licenses this file to You under the Apache License, Version 2.0

(the "License"); you may not use this file except in compliance with

the License. You may obtain a copy of the License at

#

http://www.apache.org/licenses/LICENSE-2.0

#

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

see kafka.server.KafkaConfig for additional details and defaults

############################# Server Basics #############################

The id of the broker. This must be set to a unique integer for each broker.

broker.id=0
advertised.host.name=master
############################# Socket Server Settings #############################

The address the socket server listens on. It will get the value returned from

java.net.InetAddress.getCanonicalHostName() if not configured.

FORMAT:

listeners = listener_name://host_name:port

EXAMPLE:

listeners = PLAINTEXT://your.host.name:9092

listeners=PLAINTEXT://0.0.0.0:9092

Hostname and port the broker will advertise to producers and consumers. If not set,

it uses the value for "listeners" if configured. Otherwise, it will use the value

returned from java.net.InetAddress.getCanonicalHostName().

advertised.listeners=PLAINTEXT://118.190.26.133:9092

https://blog.csdn.net/qq_44830260/article/details/103716666