Note: The servers that need to issue public keys are: NameNode, ResourceManager
< p>
4. Write cluster distribution script xsync
#!/bin/bash
#1 Get the number of input parameters, if there are no parameters, exit directly pcount=$# if((pcount==0)); then echo no args; exit; fi #2 Get the file namep1=$1 fname=`basename $p1` echo fname=$fname #3 Get the absolute path of the parent directorypdir=`cd -P $(dirname $p1); pwd` echo pdir=$pdir #4 Get the current user nameuser=`whoami` # 5 Loop for((host=1; host <4; host++)); do echo --------< span class="cm-attribute">----------- hadoop$host -------------- rsync -rvl $pdir/$fname [email protected]$host:$pdir done < /span>< /span>< /span>
5. Cluster configuration
hadoop1
< td>
hadoop2
hadoop3
HDFS
NameNode
DataNode
< p>
DataNode
SecondaryNameNode
DataNode
YARN
NodeManager
ResourceManager
NodeManager p>
NodeManager
Principle: NameNode, ResourceManager, SecondaryNameNode are allocated in different On the server
< span class="cm-meta">#!/bin/bash
#1 Get the number of input parameters, if there are no parameters, exit directly pcount=$# if((pcount==0)); then echo no args; exit; fi #2 Get the file namep1=$1 fname=`basename $p1` echo fname=$fname #3 Get the absolute path of the parent directorypdir=`cd -P $(dirname $p1); pwd` echo pdir=$pdir #4 Get the current user nameuser=`whoami` # 5 Loop for((host=1; host <4; host++)); do echo --------< span class="cm-attribute">----------- hadoop$host -------------- rsync -rvl $pdir/$fname [email protected]$host:$pdir done < /span>< /span>< /span>