##1)Environment initialization
Note:At least three nodes, 
the Master node at least 6G of memory, 
and the other two at least 4G of memory

|--------------|-----------|-------------|----------------|-----------|--------------------|-------------|
| Host         |   Server  |    Agent    |     zookeeper  |  namenode | secondarynamenode  |   datanode  |
|--------------|-----------|-------------|----------------|-----------|--------------------|-------------|	    
|cdh01 Master  |    Y      |     Y       |        Y       |    Y      |                    |             |
|--------------|-----------|-------------|----------------|-----------|--------------------|-------------|     
|cdh02 slave   |           |     Y       |        Y       |           |     Y              |     Y       |
|--------------|-----------|-------------|----------------|-----------|--------------------|-------------|    
|cdh03 slave   |           |     Y       |        Y       |           |                    |     Y       |
|--------------|-----------|-------------|----------------|-----------|--------------------|-------------|
|cdh04 slave   |           |     Y       |        Y       |           |                    |     Y       |
|--------------|-----------|-------------|----------------|-----------|--------------------|-------------|    
|cdh05 slave   |           |     Y       |        Y       |           |                    |     Y       |
|______________|___________|_____________|________________|___________|____________________|_____________|


#######################################
##Name resolution on every nodes
########################
cat > /etc/hosts <>/etc/sysctl.conf
echo 'net.ipv6.conf.default.disable_ipv6 = 1' >>/etc/sysctl.conf
echo 'vm.swappiness = 0' >>/etc/sysctl.conf
sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local
chmod +x /etc/rc.d/rc.local

groupadd hadoop -g 700
useradd hadoop -g hadoop -u 700
echo "hadoop123"|passwd --stdin hadoop
echo 'hadoop ALL=(ALL) NOPASSWD: ALL' >>/etc/sudoers

echo "ulimit -SHn 204800" >> /etc/rc.local
echo "ulimit -SHu 204800" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
*          soft   nofile    204800
*          hard   nofile    204800
*          soft   nproc     204800
*          hard   nproc     204800
EOF

#Install jdk on every nodes
wget http://god.nongdingbang.net/downloads/auto_jdk_1.8.sh
sh auto_jdk_1.8.sh

#Install java-jdbc on every nodes
cd /home/tools
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.39.tar.gz
tar zxvf mysql-connector-java-5.1.39.tar.gz
mkdir /usr/share/java/
\cp mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar /usr/share/java/mysql-connector-java.jar
########################################################################################################

##2)Deploy local yum for CDH on cdh01
yum -y install epel-release
yum -y install nginx createrepo

cat > /etc/nginx/nginx.conf < /etc/nginx/conf.d/default.conf </etc/yum.repos.d/cloudera-cm.repo </etc/my.cnf</etc/cloudera-scm-server/db.properties </etc/cloudera-scm-agent/config.ini<