Created
April 9, 2022 19:14
-
-
Save sarjsheff/cfa7662226083624aea2d2f0580cbe35 to your computer and use it in GitHub Desktop.
Install kafka kraft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
process.roles=broker,controller | |
inter.broker.listener.name=PLAINTEXT | |
controller.listener.names=CONTROLLER | |
listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL | |
num.network.threads=3 | |
num.io.threads=8 | |
socket.send.buffer.bytes=102400 | |
socket.receive.buffer.bytes=102400 | |
socket.request.max.bytes=104857600 | |
log.dirs=/opt/kafka/kraft-combined-logs/logs | |
num.partitions=3 | |
num.recovery.threads.per.data.dir=1 | |
offsets.topic.replication.factor=1 | |
transaction.state.log.replication.factor=1 | |
transaction.state.log.min.isr=1 | |
log.retention.ms=-1 | |
log.segment.bytes=1073741824 | |
log.retention.check.interval.ms=300000 | |
auto.create.topics.enable=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
KEY=${KEY:-"~/.ssh/id_rsa.ansible"} | |
KID="4zfHz1MvQx2yQTc0xvMBmg" # must generated by kafka-storage.sh random-uuid | |
function ikafka() { | |
ssh -i $KEY root@$IP "rm -rf /kraft-combined-logs" | |
ssh -i $KEY root@$IP 'ls /opt/kafka/kafka.pid && ( kill -9 `cat /opt/kafka/kafka.pid` && rm /opt/kafka/kafka.pid )' | |
ssh -i $KEY root@$IP "cd /opt/kafka || ( mkdir /opt/kafka && cd /opt/kafka && wget https://dlcdn.apache.org/kafka/3.1.0/kafka_2.13-3.1.0.tgz && tar -zxf kafka_2.13-3.1.0.tgz )" | |
ssh -i $KEY root@$IP "apt install -y openjdk-11-jre-headless" | |
scp -i $KEY base.properties root@$IP:/opt/kafka/ | |
scp -i $KEY server${1}.properties root@$IP:/opt/kafka/ | |
ssh -i $KEY root@$IP "cat /opt/kafka/server${1}.properties > /opt/kafka/kafka.properties && cat /opt/kafka/base.properties >> /opt/kafka/kafka.properties" | |
ssh -i $KEY root@$IP "cd /opt/kafka/kafka_2.13-3.1.0 && bin/kafka-storage.sh info -c /opt/kafka/kafka.properties || bin/kafka-storage.sh format -t $KID -c /opt/kafka/kafka.properties" | |
ssh -i $KEY root@$IP 'cd /opt/kafka/kafka_2.13-3.1.0 && nohup bin/kafka-server-start.sh /opt/kafka/kafka.properties &> /opt/kafka/kafka.log & ; echo $! > /opt/kafka/kafka.pid' | |
} | |
function testkafka() { | |
cd kafka_2.13-3.1.0 || ( wget https://dlcdn.apache.org/kafka/3.1.0/kafka_2.13-3.1.0.tgz && tar -zxf kafka_2.13-3.1.0.tgz && cd kafka_2.13-3.1.0 ) | |
bin/kafka-topics.sh --bootstrap-server 10.49.22.55:7092,10.49.22.56:7192 --delete --topic test | |
bin/kafka-topics.sh --bootstrap-server 10.49.22.55:7092,10.49.22.56:7192 --create --topic test | |
echo 111 | bin/kafka-console-producer.sh --bootstrap-server 10.49.22.55:7092,10.49.22.56:7192 --topic test | |
bin/kafka-console-consumer.sh --bootstrap-server 10.49.22.55:7092,10.49.22.56:7192 --topic test --from-beginning --max-messages 1 | |
} | |
IP=10.49.22.55 | |
ikafka 1 | |
IP=10.49.22.56 | |
ikafka 2 | |
testkafka |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node.id=0 | |
[email protected]:7093,[email protected]:7193 | |
listeners=PLAINTEXT://:7092,CONTROLLER://:7093 | |
advertised.listeners=PLAINTEXT://10.49.22.55:7092 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node.id=1 | |
[email protected]:7093,[email protected]:7193 | |
listeners=PLAINTEXT://:7192,CONTROLLER://:7193 | |
advertised.listeners=PLAINTEXT://10.49.22.56:7192 | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment