This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
galaxy-deployment-ansible-d…/Apache Hadoop/2.7.1/hdfs/role/templates/ini_hdfs.sh.j2
2024-01-18 15:35:34 +08:00

47 lines
563 B
Django/Jinja

#!/bin/bash
MASTER_IP={{ groups.hdfs[0] }}
SLAVE1_IP={{ groups.hdfs[1] }}
BASE_DIR={{ deploy_dir }}
VERSION={{ hadoop_version }}
function ini_namenode() {
cd $BASE_DIR/$VERSION/bin
yes | ./hadoop namenode -format
if [ $? -eq "0" ];then
# scp -r $BASE_DIR/hadoop/ root@$SLAVE1_IP:$BASE_DIR/
echo yes
else
echo no
fi
}
function ini_zk() {
cd $BASE_DIR/$VERSION/bin
yes | ./hdfs zkfc -formatZK
if [ $? -eq "0" ];then
echo yes
else
echo no
fi
}
case $1 in
[namenode]*)
ini_namenode
;;
[zkfc]*)
ini_zk
;;
* )
echo "请输入已有的指令."
;;
esac