Open DevShivmohan opened 10 months ago
https://kafka.apache.org/downloads
.tar -xvf kafka_file_with_extension.tgz
.sudo chmod ugo+rwx data
../zookeeper-server-start.sh ../config/zookeeper.properties
../kafka-server-start.sh ../config/server.properties
.openssl req -new -x509 -keyout ca-key -out ca-cert -days 3650
.keytool -keystore kafka.zookeeper.truststore.jks -alias ca-cert -import -file ca-cert
.keytool -keystore kafka.zookeeper.keystore.jks -alias zookeeper -validity 3650 -genkey -keyalg RSA -ext SAN=dns:localhost
.keytool -keystore kafka.zookeeper.keystore.jks -alias zookeeper -certreq -file ca-request-zookeeper
.openssl x509 -req -CA ca-cert -CAkey ca-key -in ca-request-zookeeper -out ca-signed-zookeeper -days 3650 -CAcreateserial
.keytool -keystore kafka.zookeeper.keystore.jks -alias ca-cert -import -file ca-cert
keytool -keystore kafka.zookeeper.keystore.jks -alias zookeeper -import -file ca-signed-zookeeper
../zookeeper-server-start.sh ../config/zookeeper.properties
inside the bin directory as shown below screenshot.kafka-server-start.sh ../config/server.properties
inside the bin directory as shown below screenshot.If there is occur any erros during run apache-kafka then try to delete all logs of zookeeper and kafka logs like below screenshot
.
sudo nano ./config/server.properties
and check log.dirs value as per mention in the below screenshot.sudo rm -r *
.sudo nano ./config/zookeeper.properties
and check the value of dataDir as per given in screenshot.cd /home/kafka/data/zookeeper
.sudo rm -r *
.
kafka.topic=normal-message
spring.kafka.bootstrap.servers=localhost:9002
spring.kafka.consumer.group-id=tbp
server.port=9090
ssl.protocol = TLS spring.kafka.bootstrap-servers=localhost:9093 spring.kafka.properties.security.protocol=TLS spring.kafka.properties.ssl.truststore.location=file:/home/kafka/kafka_2.12-3.5.1/ssl/kafka.zookeeper.truststore.jks spring.kafka.properties.ssl.truststore.password=123456 spring.kafka.properties.ssl.keystore.location=file:/home/kafka/kafka_2.12-3.5.1/ssl/kafka.zookeeper.keystore.jks spring.kafka.properties.ssl.keystore.password=123456 spring.kafka.properties.ssl.key.password=123456
spring.kafka.producer.bootstrap-servers=localhost:9093 spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.consumer.bootstrap-servers=localhost:9093 spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
Create openssl certificate for localhost
//Generate CA's private key openssl genrsa -des3 -out ca.key.pem 2048
//create CA's self-signed certificate openssl req -x509 -new -nodes -key ca.key.pem -sha256 -days 365 -out localhost.cert.pem
//create private key for server openssl genrsa -out localhost.key 2048
//create certificate signing request (CSR) openssl req -new -key localhost.key -out localhost.csr
//Use CA's private key to sign web server's CSR and get back the signed certificate openssl x509 -req -in localhost.csr -CA localhost.cert.pem -CAkey ca.key.pem -CAcreateserial -out localhost.crt -days 365
//convert server private key in PKCS8 standard(gRPc expects) openssl pkcs8 -topk8 -nocrypt -in localhost.key -out localhost.pem
Demo with live screenshots