1. zookeeper.connect

The service address (including port number) that the broker connects to the ZooKeeper cluster. There is no default value. This parameter is mandatory. If the ZK cluster has multiple nodes, it can be separated. You can add a chroot path so that it is clear that the nodes under the chroot path are used by Kafka. You can also reuse a ZK cluster from multiple Kafka clusters to save more hardware resources. Similar to Hadoop :2181/kafka instead of Hadoop :2181

# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
zookeeper.connect=hadoop:2181/kafka
Copy the code

2. listeners

Specify the broker to monitor client connection address list, namely the client to connect address list at the entrance to the broker configuration format for protocol1: / / hostname1: port1, protocol2: hostname2: port2, including protocol on behalf of the protocol type, The protocol types supported by Kfaka are PLAINTEXT, SSL, SASL_SSL, and so on. If the host name is not specified, the default NIC is bound to 127.0.0.1. In this case, the host name cannot provide external services. Therefore, do not leave the host name empty. If the host name is 0.0.0.0, all nics are bound.

Note There are other parameters associated with advertised. Listeners are similar to listeners and the default value is null. Advertised. listeners are used in Iaas environments. For example, a machine on a public cloud has multiple network adapters (private network adapters and public network adapters). In this case, you can set advertised.listeners to bind public IP addresses for external clients. The Listeners parameter is used to bind private IP addresses for interbroker communication.

# 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://hadoop: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://your.host.name:9092

Copy the code

3. broker.id

This parameter is used to specify the unique identity of the broker in a Kafka cluster. The default value is -1. If not, Kafka automatically generates one. This parameter and meta properties file and broker server parameters. Id. Generation. The enable and reserved. Broker. Max. Id.

# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
Copy the code

4. Log. Dir and the dirs

Kafka saves all messages on disk, and these two parameters are used to configure the root directory for Kafka log files. In general, log.dir is used to configure a single root directory and log.dirs is used to configure multiple root directories, but kafka does not enforce this restriction. Log. dirs has a higher priority than log.dir.

# A comma separated list of directories under which to store log files
log.dirs=/ opt/module/kafka_2. 12-2.3.1 / logs /
Copy the code

5. message.max.bytes

This parameter specifies the maximum number of messages that the broker can receive. The default value is 1000012B, which is approximately 976.6KB. If greater than this value, RecordToolLargeException will be thrown. If you want to change this parameter, you also need to consider the effects of max-request. size(the client parameter) and max-message. bytes(the topic parameter). To avoid cascading effects caused by modifying this parameter, you are advised to consider the possibility of splitting messages before modifying the parameter.

6. delete.topic.enable

Whether the deletion message was actually sent

delete.topic.enable=true
Copy the code

7. auto.create.topics.enable

Whether to allow automatic message creation defaults to true