Original, reproduced please specify. Thank you
Shell launches Hadoop cluster
1: Clear Boot order
1) Start zookeeper cluster (in CentOS 4-02,centos6-02,centos7-02 respectively)
app/zookeeper-3.4.5/bin/zkserver.sh Start//startup process
app/zookeeper-3.4.5/bin/zkserver.sh Status//view state
2) Start Journalnode (respectively in CentOS 4-02,centos6-02,centos7-02)
app/hadoop-2.7.2/sbin/hadoop-daemon.sh Start Journalnode
3) format HDFs (centos4-01)
HDFs Namenode-format
Since it has been started, it is not necessary to format it.
4) Start HDFs (centos4-01)
app/hadoop-2.7.2/sbin/start-dfs.sh
5) Start yarn (centos7-01,centos8-01, start on centos7-01 only)
app/hadoop-2.7.2/sbin/start-yarn.sh
6) All the others are Datanode
app/hadoop-2.7.2/sbin/hadoop-daemon.sh Start Datanode
The code is as follows:
1 expect EOF2 EOF3 Done<zoo.list4 5 Echo "-------------------------Start-namenode----------------------------"6app/hadoop-2.7.2/sbin/hadoop-daemon.SHStart Namenode7 SSHcentos6- onapp/hadoop-2.7.2/sbin/hadoop-daemon.SHStart Namenode8 9 Echo "------------------------Start-yarn----------------------------"Ten SSHcentos7- onapp/hadoop-2.7.2/sbin/start-yarn.SH One A Echo "------------------------Start-datanode----------------------------" - whileRead Line - Do theip=$line - Echo$line - Echo$ip -/usr/bin/expect <<-EOF +SpawnSSH-P22 [email protected] $ip -Send"app/hadoop-2.7.2/sbin/hadoop-daemon.sh start datanode\r" +Expect"*#" ASend"exit\r" at Interact - expect EOF - EOF - Done<data.list - Echo "-------------------------over!----------------------------"
Shell launches Hadoop cluster