kafka related commands

# Start nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

# Start php
/usr/local/php/sbin/php-fpm

# Start zookeeper
/home/kafka/bin/zookeeper-server-start.sh -daemon /home/kafka/config/zookeeper.properties

# Start broker
nohup /home/kafka/bin/kafka-server-start.sh /home/kafka/config/server.properties 1>/dev/null 2>&1 &

# Stop zookeeper
/home/kafka/bin/zookeeper-server-stop.sh

# Stop broker
/home/kafka/bin/kafka-server-stop.sh

# Create topic
/home/kafka/bin/kafka-topics.sh --create --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092 --replication-factor 1 --partitions 6 --topic test

See all topic #
/home/kafka/bin/kafka-topics.sh --list --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092

# View information about a single topic
/home/kafka/bin/kafka-topics.sh --describe --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092 --topic test

# Topic to increase partitions
/home/kafka/bin/kafka-topics.sh --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092 --alter --topic test --partitions 6

# Production news
/home/kafka/bin/kafka-console-producer.sh --broker-list 192.168.10.41:9092,192.168.10.42:9092 --topic test

# Consumer news
/home/kafka/bin/kafka-console-consumer.sh --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092 --topic test --from-beginning

# Delete topic
/home/kafka/bin/kafka-topics.sh --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092 --delete --topic test

# Detect the position of the consumer
/home/kafka/bin/kafka-consumer-groups.sh --bootstrap-server 192.168.10.41:9092,192.168.10.42:9092 --describe --group test

# Kafka php library
https://packagist.org/packages/superbalist/php-pubsub-kafka

# Kill process
ps -ef | grep java | grep -v grep | awk '{print $ 2}' | xargs kill -9

# Clear Log
rm -rf /tmp/kafka-logs/ && rm -rf /tmp/zookeeper/ && rm -rf /home/kafka/logs/*

  

Guess you like

Origin www.cnblogs.com/werben/p/11713650.html