说明:在ssh,用root用户登录到header(master)机器上,手工执行以下命令进行业务调试。
常用命令:
1. env (忘记是大写ENV,还是小写env,来查看环境变量)
2. cat /etc/hosts (查看EMR集群机器的hostname ip配置)
3. 在header机器上,切换到hadoop用户后,可以 ssh@emr-worker-1 直接登录到worker-1机器上,因为集群的机器,hadoop用户已经配置互相信任关系。
启动:
###start zk
su hadoop -c "/usr/lib/zookeeper-current/bin/zkServer.sh start"
for i in `seq 1 2`;
do
su hadoop -c "ssh emr-worker-${i} /usr/lib/zookeeper-current/bin/zkServer.sh start";
done
###start hdfs
su hdfs -c "/usr/lib/hadoop-current/sbin/hadoop-daemon.sh start namenode"
su hdfs -c "/usr/lib/hadoop-current/sbin/hadoop-daemon.sh start secondarynamenode"
for i in `seq 1 2`;
do
su hdfs -c "ssh emr-worker-${i} /usr/lib/hadoop-current/sbin/hadoop-daemon.sh start datanode";
done
###start yarn
su hadoop -c "/usr/lib/hadoop-current/sbin/yarn-daemon.sh start resourcemanager"
for i in `seq 1 2`;
do
su hadoop -c "ssh emr-worker-${i} /usr/lib/hadoop-current/sbin/yarn-daemon.sh start nodemanager";
done
su hadoop -c "/usr/lib/hadoop-current/sbin/yarn-daemon.sh start proxyserver"
###start mapreduce historyserver
su hadoop -c "/usr/lib/hadoop-current/sbin/mr-jobhistory-daemon.sh start historyserver"
###stop spark
su hadoop -c "/usr/lib/spark-current/sbin/stop-history-server.sh"
###stop mapreduce historyserver
su hadoop -c "/usr/lib/hadoop-current/sbin/mr-jobhistory-daemon.sh stop historyserver"
###stop yarn
su hadoop -c "/usr/lib/hadoop-current/sbin/yarn-daemon.sh stop proxyserver"
for i in `seq 1 2`;
do
su hadoop -c "ssh emr-worker-${i} /usr/lib/hadoop-current/sbin/yarn-daemon.sh stop nodemanager";
done
su hadoop -c "/usr/lib/hadoop-current/sbin/yarn-daemon.sh stop resourcemanager"
###stop hdfs
for i in `seq 1 2`;
do
su hdfs -c "ssh emr-worker-${i} /usr/lib/hadoop-current/sbin/hadoop-daemon.sh stop datanode";
done
su hdfs -c "/usr/lib/hadoop-current/sbin/hadoop-daemon.sh stop secondarynamenode"
su hdfs -c "/usr/lib/hadoop-current/sbin/hadoop-daemon.sh stop namenode"
###stop zk
su hadoop -c "/usr/lib/zookeeper-current/bin/zkServer.sh stop"
for i in `seq 1 2`;
do
su hadoop -c "ssh emr-worker-${i} /usr/lib/zookeeper-current/bin/zkServer.sh stop";
done