Skip to main content

Configuration

Zookeeper We configure zookeeper as kafka to run it needs zookeeper.

Navigate to the following location and create zookeeper.properties file

cd /opt/kafka/

Add the following file to the location

zookeeper.properties 20 Mar 2024, 03:28 PM Now we need to run zookeeper as a service so we create a service file in the following location

cd /etc/systemd/system/

Add the following file in the location

zookeeper.service 20 Mar 2024, 03:31 PM

systemctl daemon-reload
systemctl start zookeeper
systemctl enable zookeeper

Kafka As we configured zookeeper we can now configure kafka

Navigate to the following location and create server.properties file


cd /opt/kafka/

Add the following file to the location. The following file is where we configure kafka to run on domain name, Authorization & authentication methods.

server.properties 20 Mar 2024, 03:35 PM In server properties if we choose to run kafka in the domain name. We need to follow the process mentioned below

mkdir -p /opt/kafka/ssl
cd /opt/kafka/ssl
openssl pkcs12 -export -in risecorp.crt -inkey risecorp.key -out keystore.p12 -name kafka -CAfile ca.pem -caname root
keytool -importkeystore -destkeystore kafka.keystore.jks -srckeystore keystore.p12 -srcstoretype pkcs12 -alias kafka
keytool -import -file ca.pem -alias root -keystore kafka.truststore.jks

To run kafka with authentication method SCRAM-256 configure the following

/usr/bin/kafka-configs --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[iterations=8192,password=Rise@123]' --entity-type users --entity-name test

Create a file in /opt/kafka and add the following file with kafka_server_jaas.conf

kafka_server_jaas.conf 20 Mar 2024, 04:33 PM Now we need to run kafka as a service so we create a service file in the following location

cd /etc/systemd/system/

Add the following file in the location

systemctl daemon-reload
systemctl start kafka
systemctl enable kafka