kafka安装设置相关

Posted on 2020-11-20 09:47  yacbo  阅读(77)  评论(0编辑  收藏  举报

kafka

#!/bin/bash
basepath=$(cd `dirname $0`; pwd)
#echo $basepath     #当前文件所在路径
cd $basepath

#修改zookeeper和server配置
# vi ./config/zookeeper.properties  修改日志路径为dataDir=/home/logs/zookeeper
# vi ./config/server.properties 修改日志路径为log.dirs=/home/logs/kafka-logs


#启动zookeeoer和kafka-server
nohup ./bin/zookeeper-server-start.sh ./config/zookeeper.properties & 
nohup bin/kafka-server-start.sh config/server.properties &

#查看服务是否启动成功
#lsof -i:2181     (zookeeper端口)
#lsof -i:9092      (kafka-server端口)

#创建topic(topic名称: face)
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic face

#删除topic (topic名称: face)
#bin/kafka-topics.sh  --delete --zookeeper localhost:2181  --topic face


#查看topic列表:
#bin/kafka-topics.sh -zookeeper localhost:2181 --list

#查看topic详情:
#bin/kafka-topics.sh --zookeeper localhost:2181 --describe 

#向创建的topic生产消息
#bin/kafka-console-producer.sh --broker-list localhost:9092 --topic face

#订阅topic 消费消息
#bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic face --from-beginning
#bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic face

#创建9个topic,每个topic分区设为16
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Log_Heartbeat
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Face_Img
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Comp_Result
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Comp_Request_Real
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Feature_Extraction_Result
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Setting_Change
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Device_Manager
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Comp_Request_Offline
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Face_Register

 

Copyright © 2024 yacbo
Powered by .NET 8.0 on Kubernetes