Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache kafka Kafka无法在3个单独的VM';s_Apache Kafka - Fatal编程技术网

Apache kafka Kafka无法在3个单独的VM';s

Apache kafka Kafka无法在3个单独的VM';s,apache-kafka,Apache Kafka,我正在使用卡夫卡版本2.11-2.3.1和zookeeper 3.4.10-3,并且能够让3个Ubuntu18.04虚拟机中的每一个单独运行一切正常,,基本配置允许我创建主题,生成数据,并使用卡夫卡提供的卡夫卡主题.sh,卡夫卡控制台生成器.sh,和kafka console consumer.sh。 有人能帮我设置zookeeper和kafka的配置,这样我就可以将3个连接到一个集群中吗?我想我所要做的就是如下所示设置配置,然后使用kafka topics.shshell脚本创建一个具有复制因

我正在使用卡夫卡版本2.11-2.3.1和zookeeper 3.4.10-3,并且能够让3个Ubuntu18.04虚拟机中的每一个单独运行一切正常,基本配置允许我创建主题,生成数据,并使用卡夫卡提供的
卡夫卡主题.sh
卡夫卡控制台生成器.sh
,和
kafka console consumer.sh
。 有人能帮我设置zookeeper和kafka的配置,这样我就可以将3个连接到一个集群中吗?我想我所要做的就是如下所示设置配置,然后使用
kafka topics.sh
shell脚本创建一个具有复制因子3的主题,然后使用
kafka console producer.sh
kafka console consumer.sh
,它就可以工作了。但是我得到了很多不同的错误。有人有我可以遵循的指南/教程吗

zoo.cfg
中,我从默认脚本更改的唯一设置是:
对于服务器1

server.1=0.0.0.0:2888:3888                  
server.2=myserver2.com.au:2888:3888
server.3=myserver3.com.au:2888:3888
broker.id=1
zookeeper.connect=0.0.0.0:2181,myserver2.com.au:2181,myserver3.com.au:2181
。。。服务器2和服务器3也是如此

在卡夫卡的
server.properties
中,我更改的默认设置只有:
对于服务器1

server.1=0.0.0.0:2888:3888                  
server.2=myserver2.com.au:2888:3888
server.3=myserver3.com.au:2888:3888
broker.id=1
zookeeper.connect=0.0.0.0:2181,myserver2.com.au:2181,myserver3.com.au:2181

。。。同样,对于服务器2和3(
broker.id
分别设置为2和3,并且相应地设置了
zookeeper.connect
服务器)

然后在
myserver1.com.au
上运行:

/usr/local/kafka/bin/kafka-topics.sh --create --zookeeper
    "localhost:2181,myserver2.com.au:2181,myserver3.com.au:2181" 
    --replication-factor 3 --partitions 1 --topic test
然后试着

/usr/local/kafka/bin/kafka-console-producer.sh --broker-list
    "localhost:9092,myserver2.com.au:9092,myserver3.com.au:9092" 
    --topic test
但它失败了,错误很多。一个是

org.apache.kafka.common.KafkaException: Should not set log start 
    offset on partition test's local replica 1 without attempting 
    to delete records of the log
另一个是

ERROR [KafkaApi-0] Error when handling request: clientId=0, correlationId=0,
    api=UPDATE_METADATA, body={controller_id=0,controller_epoch=1,
    broker_epoch=155,topic_states=[{t...
    java.lang.IllegalStateException: Epoch 155 larger than current broker epoch 24
另一个是

ERROR Error when sending message to topic test4 with key: null, value: 1 bytes with 
    error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
    org.apache.kafka.common.errors.TimeoutException: Topic test not present in
    metadata after 60000 ms.
ERROR Error when sending message to topic test with key: null, value: 1 bytes with 
    error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
    org.apache.kafka.common.errors.NotLeaderForPartitionException: This server 
    is not the leader for that topic-partition.
另一个是

ERROR Error when sending message to topic test4 with key: null, value: 1 bytes with 
    error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
    org.apache.kafka.common.errors.TimeoutException: Topic test not present in
    metadata after 60000 ms.
ERROR Error when sending message to topic test with key: null, value: 1 bytes with 
    error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
    org.apache.kafka.common.errors.NotLeaderForPartitionException: This server 
    is not the leader for that topic-partition.

我似乎在网上找不到任何关于这些错误的有用信息,我尝试了很多方法,但我真的很挣扎,所以任何帮助都将不胜感激

老实说,不要手动操作,除非你只是想学习。使用类似Ansible的东西<代码>zookeeper.connect需要指向有效地址,而不是0.0.0.0;此外,在最新版本的Kafka中,您可以将
--bootstrap server
用于所有命令(可能除了console producer),老实说,不要手动执行,除非您只是想学习。使用类似Ansible的东西<代码>zookeeper.connect需要指向有效地址,而不是0.0.0.0;此外,在最新版本的Kafka中,您可以将
--bootstrap server
与所有命令一起使用(可能除了console producer)