如何更改"kafka connect"组件端口? [英] How to change the "kafka connect" component port?
问题描述
在端口8083上,我正在运行Influxdb,甚至可以在 http://localhost:8083 上获得GUI
现在来到kafka,在这里我指的是根据 https://kafka.apache.org/快速入门
通过以下命令启动位于/opt/zookeeper-3.4.10文件夹中的Zookeeeper:
因此,zookeeper现在开始在/opt/kafka_2.11-1.1.0文件夹下以以下方式启动kafka:
bin/kafka-server-start.sh config/server.properties
使用一个分区和一个副本创建一个名为"test"的主题:
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
主题已创建,可以使用以下命令进行检入:
bin/kafka-topics.sh --list --zookeeper localhost:2181
到这里为止一切都很好,并且已经过调整.
现在,我需要使用" Kafka connect "组件来导入/导出数据.
所以我创建一个种子数据为:echo -e "foo\nbar" > test.txt
现在使用连接器配置使" kafka connect "正常工作:
bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties
运行上述命令后,我得到:Address already in use
Kafka connect has stopped
我什至更改了/opt/kafka_2.11-1.1.0/config/connect-distributed.properties中的rest.port=8084
,以免与已经在8083上的influxdb发生冲突.相同的Address already in use
,
Kafka connect has stopped
如屏幕截图所示.
由于您在独立模式下使用Kafka Connect,因此需要在config/connect-standalone.properties
中更改REST端口:
rest.port=18083
要了解有关独立与分布式的更多信息,可以阅读文档这里.
On port 8083 I am running Influxdb for which I am even getting the GUI on http://localhost:8083
Now come to kafka, Here I am referring the setup as per https://kafka.apache.org/quickstart
starting the zookeeeper which is in folder /opt/zookeeper-3.4.10 by the command: bin/zkServer.sh start
So zookeeper is started now starting kafka under /opt/kafka_2.11-1.1.0 folder as :
bin/kafka-server-start.sh config/server.properties
create a topic named "test" with a single partition and only one replica:
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
Topic is created and can be checked in with command :
bin/kafka-topics.sh --list --zookeeper localhost:2181
Uptill here everything is fine and tuned.
Now I need to use "Kafka connect" component to import/export data.
So I am creating a seed data as: echo -e "foo\nbar" > test.txt
Now using connector configuration for "kafka connect" to work :
bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties config/connect-file-sink.properties
after running above command I am getting : Address already in use
Kafka connect has stopped
I even changed the rest.port=8084
in the /opt/kafka_2.11-1.1.0/config/connect-distributed.properties so as it don't get conflict with influxdb which already on 8083. Still I am getting the same Address already in use
,
Kafka connect has stopped
as shown in screenshots.
Since you're using Kafka Connect in Standalone mode, you need to change the REST port in config/connect-standalone.properties
:
rest.port=18083
To understand more about Standalone vs Distributed you can read the doc here.
这篇关于如何更改"kafka connect"组件端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!