脚本启动zookeeper集群
来源:互联网 发布:linux下安装软件 编辑:程序博客网 时间:2024/04/28 08:02
我写了一个启动zookeeper的脚本d.sh。启动时提示成功了不了,但实际上没有成功
脚本:
脚本很简单内容如下:
age="Usage: $0 (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage
exit 1
fi
behave=$1
echo "$behave zkServer cluster"
for i in hadoop01 hadoop02 hadoop03
do
ssh $i "/home/software/zookeeper-3.4.7/bin/zkServer.sh $behave"
done
exit 0
原因:
首先需要知道 交互式shell和非交互式shell、登录shell和非登录shell是有区别的
在登录shell里,环境信息需要读取/etc/profile和~ /.bash_profile, ~/.bash_login, and ~/.profile按顺序最先的一个,并执行其中的命令。除非被 --noprofile选项禁止了;
在非登录shell里,环境信息只读取 /etc/bash.bashrc和~/.bashrc
在非登录shell里,环境信息只读取 /etc/bash.bashrc和~/.bashrc
手工执行是属于登陆shell,脚本执行数据非登陆shell,而我的linux环境配置中只对/etc/profile进行了jdk1.7等环境的配置,所以脚本执行/usr/local/zookeeper/bin/zkServer.sh start 启动zookeeper失败了
解决方法(下面3个方法任选1):
1、脚本代码中添加“source /etc/profile;” 改为:ssh crxy$i "source /etc/profile;/usr/local/zookeeper/bin/zkServer.sh start"
2、把profile的配置信息echo到.bashrc中 echo 'source /etc/profile' >> ~/.bashrc
3、在/zookeeper/bin/zkEnv.sh的中开始位置添加 export JAVA_HOME=/usr/local/jdk1.7.0_45(就像hadoop中对hadoop-env.sh的配置一样)
解决了这个问题,就以方便的通过脚本实现hadoop集群的启动与关闭了
0 0
- 脚本启动zookeeper集群
- zookeeper 启动集群shell脚本
- zookeeper集群启动的shell脚本
- zookeeper集群脚本启动与停用
- 如何启动zookeeper集群
- zookeeper自动启动脚本
- zookeeper集群自动搭建脚本
- linux自动化启动集群zookeeper
- Zookeeper集群搭建与启动
- zookeeper集群无法正确启动
- zookeeper以集群方式启动
- zookeeper 集群安装配置启动
- kafka集群启动脚本
- mongo集群启动脚本
- 集群storm启动脚本
- Kafka 集群启动脚本
- redis集群启动脚本
- Shell脚本一键启动/关闭 zookeeper集群(版本1.0)
- 损失函数+激活函数
- Python 函数 —— map(), reduce()
- 我的博客全部统一在博客园
- 用ajax向后台传参的几种方式
- C++ 智能指针shared_ptr模板实现原理
- 脚本启动zookeeper集群
- 121. Best Time to Buy and Sell Stock
- Stories 9-10
- Deep Learning(深度学习)-----我整理了网上与此相关的资料
- Spring初入配置~十四
- 微信小程序上滑加载下拉刷新(onscrollLower)分批加载数据 下篇
- java的循环
- STM32系统时钟树分析
- IOS快捷键