shell脚本利用python随机模块生成随机数,并将数据发送到kafka中
#!/usr/bin/bash
# author :seed
i=1
while(( i <= 100 ))
do
    res=$(python -c 'import random;print random.randint(10,20)')
     echo $res
     echo "zhangfei_$res">>../sanguoyanyi
     echo "zhangfei_$res" | kafka-console-producer --topic cs_ --broker-list \
      test94.AAAA.com:9092,test94.BBBB:9092,test94.CCCC.com:9092
     let "i += 1"
     sleep 2
done
 
echo "sum=$i" 
 
转载于:http://blog.sina.com.cn/s/blog_6dd718930102xddk.html

相关文章:

  • 2022-12-23
  • 2021-06-27
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2022-02-08
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2021-11-14
相关资源
相似解决方案