##1)Environment initializationNote: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.confecho 'net.ipv6.conf.default.disable_ipv6 = 1' >>/etc/sysctl.confecho 'vm.swappiness = 0' >>/etc/sysctl.confsysctl -pecho never > /sys/kernel/mm/transparent_hugepage/defragecho 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.localchmod +x /etc/rc.d/rc.localgroupadd hadoop -g 700useradd hadoop -g hadoop -u 700echo "hadoop123"|passwd --stdin hadoopecho 'hadoop ALL=(ALL) NOPASSWD: ALL' >>/etc/sudoersecho "ulimit -SHn 204800" >> /etc/rc.localecho "ulimit -SHu 204800" >> /etc/rc.localcat >> /etc/security/limits.conf << EOF*          soft   nofile    204800*          hard   nofile    204800*          soft   nproc     204800*          hard   nproc     204800EOF#Install jdk on every nodeswget http://god.nongdingbang.net/downloads/auto_jdk_1.8.shsh auto_jdk_1.8.sh#Install java-jdbc on every nodescd /home/toolswget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.39.tar.gztar zxvf mysql-connector-java-5.1.39.tar.gzmkdir /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 cdh01yum -y install epel-releaseyum -y install nginx createrepocat > /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<