#!/bin/bash #-*- coding: utf-8 -*- #Date: 2018/11/20 #Author: Mr.yang
#!/bin/bash
KAFKA_HOST="192.168.0.184:9092" #kafka主机IP+端口
KAFKA_CMD="/database/kafka/bin/kafka-producer-perf-test.sh" #kafka脚本执行路径(根据自己本身环境修改,脚本名无需更改)PARATER="--num-records 5 --record-size 2 --throughput 10" #参数,可不修改TOPIC_NAME="monitor" #Topic名称可创建一个测试使用 ps -ef |grep kafka |grep -v grep |grep -v kafka.sh > /dev/nullif [ $? -eq 0 ];then timeout 10s sh ${KAFKA_CMD} ${PARATER} --topic ${TOPIC_NAME} --producer-props bootstrap.servers=${KAFKA_HOST} > /dev/null if [ $? -ne 0 ];then echo 1 else echo 0 fi elif [ $? -ne 0 ];then echo 1fi原创文章,转载请注明:
转载自纯种黄牛博客