1、服务启动完全由脚本实现,可根据实际情况,修改hadoop和zookeeper的路径即可
说明:第二次启动,需要将格式化的代码注释掉即可
#!/bin/bash
HADOOP_PATH=/opt/hadoop/hadoop-2.8.1
ZOOKEEPER_INSTALL_PATH=/opt/hadoop/zookeeper-3.4.10
HADOOP_TMP=/opt/hadoop/tmp
rm -rf /opt/hadoop/tmp
rm -rf /opt/hadoop/hdfs
rm -rf ${HADOOP_PATH}/logs/*
mkdir -p ${HADOOP_TMP}
ssh hadoop@nmslaver -C "rm -rf /opt/hadoop/tmp;rm -rf ${HADOOP_PATH}/logs/*;mkdir -p ${HADOOP_TMP}"
ssh hadoop@nnnode1 -C " rm -rf /opt/hadoop/tmp;rm -rf ${HADOOP_PATH}/logs/*;mkdir -p ${HADOOP_TMP}"
ssh hadoop@nnnode2 -C " rm -rf /opt/hadoop/tmp;rm -rf ${HADOOP_PATH}/logs/*;mkdir -p ${HADOOP_TMP}"
ssh hadoop@nnnode3 -C " rm -rf /opt/hadoop/tmp;rm -rf ${HADOOP_PATH}/logs/*;mkdir -p ${HADOOP_TMP}"
ssh hadoop@nmslaver -C " rm -rf /opt/hadoop/hdfs"
ssh hadoop@nnnode1 -C " rm