• 启动zookeeper集群

    • 一键启动脚本的环境变量配置

      #set onekey env
      export OK_HOME=/export/servers/oneKey
      export PATH=${OK_HOME}/zk:$PATH
      export PATH=${OK_HOME}/storm:$PATH
      export PATH=${OK_HOME}/kafka:$PATH
      
    • 关于黑洞

    • 一键启动的目录信息

      -rw-r--r--. 1 root root  21 Nov 11 03:46 slave
      -rwxr-xr-x. 1 root root 160 Nov 11 03:46 startzk.sh
      -rwxr-xr-x. 1 root root 172 Nov 11 03:47 stopzk.sh
      

      /export/servers/oneKey/zk

    • startzk.sh文件

      cat /export/servers/oneKey/zk/slave | while read line
      do
      {
       echo $line
       ssh $line "source /etc/profile;nohup zkServer.sh start >/dev/nul* 2>&1 &"
      }&
      wait
      done 
      
    • stopzk.sh 停止脚本

      cat /export/servers/oneKey/zk/slave | while read line
      do
      {
       echo $line
       ssh $line "source /etc/profile;jps |grep QuorumPeerMain |cut -c 1-4 |xargs kil* -s 9"
      }&
      wait
      done 
      
    • 跨服务器运行命令

      ssh hostname "command"

  • 启动Kafka集群

    • 环境变量

      #set onekey env
      export OK_HOME=/export/servers/oneKey
      export PATH=${OK_HOME}/zk:$PATH
      export PATH=${OK_HOME}/storm:$PATH
      export PATH=${OK_HOME}/kafka:$PATH
      
    • kafka环境变量配置

      #set kafka env
      export KAFKA_HOME=/export/servers/kafka
      export PATH=${KAFKA_HOME}/bin:$PATH
      
    • 启动脚本

      cat /export/servers/oneKey/kafka/slave | while read line
      do
      {
       echo $line
       ssh $line "source /etc/profile;nohup kafka-server-start.sh /export/servers/kafka/config/server.properties >/dev/nul* 2>&1 &"
      }&
      wait
      done
      
    • 停止脚本

      cat /export/servers/oneKey/kafka/slave | while read line
      do
      {
       echo $line
       ssh $line "source /etc/profile;jps |grep Kafka |cut -c 1-4 |xargs kil* -s 9 "
      }&
      wait
      done 
      

评论已关闭

暂无评论