问题一:WARN Error while fetching metadata with correlatio

[root@e48a7bb44563 /]# /home/work/local/kafka/bin/kafka-console-producer.sh --broker-list="127.0.0.1:9092" --topic test-123

[2019-04-11 04:59:03,215] WARN Error while fetching metadata with correlation id 1 : {test-123=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)
[2019-04-11 04:59:03,318] WARN Error while fetching metadata with correlation id 3 : {test-123=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)
[2019-04-11 04:59:03,421] WARN Error while fetching metadata with correlation id 4 : {test-123=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)
[2019-04-11 04:59:03,524] WARN Error while fetching metadata with correlation id 5 : {test-123=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)
[2019-04-11 04:59:03,628] WARN Error while fetching metadata with correlation id 6 : {test-123=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)
[2019-04-11 04:59:03,732] WARN Error while fetching metadata with correlation id 7 : {test-123=INVALID_REPLICATION_FACTOR} (org.apache.kafka.clients.NetworkClient)

解决

1.修改server.properties

vim config/server.properties 
#注释打开并把值修改成hsot
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
# value for "host.name" if configured.  Otherwise, it will use the value returned from
# java.net.InetAddress.getCanonicalHostName().
advertised.host.name=your_hostname

2.查看集群是否有broker没有运行

#进入zookeeper客户端

[root@e48a7bb44563 kafka]# ./bin/zookeeper-shell.sh 127.0.0.1:2181
Connecting to 127.0.0.1:2181
Welcome to ZooKeeper!
JLine support is disabled
[2019-04-11 05:00:12,626] WARN Connected to an old server; r-o mode will be unavailable (org.apache.zookeeper.ClientCnxnSocket)

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

#查看状态

ls /brokers/ids
[3, 2, 0]

如果少broker重新启动