shell脚本(1)--一键启动zookeeper

一键启动三个节点(hadoop11,hadoop12,hadoop13)zookeeper

bash 复制代码
#! /bin/bash

if [ $# -eq 0 ]
then
  echo '没有提供参数 start | stop | status'
  exit
fi

function start(){
	for i in 11 12 13
	do
	  echo --------------- hadoop$i -----------
	  ssh root@hadoop$i "source /etc/profile;zkServer.sh start"
	done
}

function stop(){
	for i in 11 12 13
	do
	  echo --------------- hadoop$i -----------
	  ssh root@hadoop$i "source /etc/profile;zkServer.sh stop"
	done
}

function status(){
	for i in 11 12 13
	do
	  echo --------------- hadoop$i -----------
	  ssh root@hadoop$i "source /etc/profile;zkServer.sh status"
	done
}

if [ "$1" = "start" ]; then
  start
elif [ "$1" = "stop" ]; then
  stop
elif [ "$1" = "status" ]; then
  status
else
  echo "Usage: $0 [start|stop|status]"
  exit 1
fi

    
相关推荐
一位摩羯座DBA2 小时前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组2 小时前
CentOS配置网络
linux·网络·centos
weixin_307779132 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
漫步企鹅3 小时前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
cui_win3 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、3 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
冰橙子id3 小时前
linux系统安全
linux·安全·系统安全
stark张宇3 小时前
VMware 虚拟机装 Linux Centos 7.9 保姆级教程(附资源包)
linux·后端
Johny_Zhao4 小时前
Ubuntu系统安装部署Pandawiki智能知识库
linux·mysql·网络安全·信息安全·云计算·shell·yum源·系统运维·itsm·pandawiki
悲伤小伞4 小时前
linux_git的使用
linux·c语言·c++·git