How to change the “kafka connect” component port?

2019-05-22 16:08发布

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

enter image description here

enter image description here

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.

3条回答
SAY GOODBYE
2楼-- · 2019-05-22 16:19

Kafka Standalone mode, uses Port 8084 as the Rest API post, by default. Due to this reason, if someone else is using that port already, the process with throw a BindException.

To change the port used above, navigate to the config/connect-standalone.properties file in the Kafka Root directory.

Add the following key value property to change the Port being used for Rest API opening. (Kafka should have included this in the properties file by default, else many developers go nuts trying to find the port mapping used in the standalone mode). Put a different port as you wish.

rest.port=11133
查看更多
Melony?
3楼-- · 2019-05-22 16:35

Change the port definition in config/server.properties:

# The port the socket server listens on
port=9092
查看更多
【Aperson】
4楼-- · 2019-05-22 16:36

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.

查看更多
登录 后发表回答