{"id":6786,"date":"2017-06-21T12:48:10","date_gmt":"2017-06-21T04:48:10","guid":{"rendered":"http:\/\/rmohan.com\/?p=6786"},"modified":"2017-06-21T12:48:10","modified_gmt":"2017-06-21T04:48:10","slug":"hadoop-2-6-4-distributed-cluster-environment-is-built-on-the-actual-cluster","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6786","title":{"rendered":"Hadoop 2.6.4 distributed cluster environment is built on the actual cluster ."},"content":{"rendered":"<p><strong>Hadoop 2.6.4 distributed cluster environment is built on the actual cluster .<\/strong><\/p>\n<p>Cluster preparation<\/p>\n<p>There are five machines that have changed the machine name for master, slaver1, slaver2, slaver3, slaver4, and set the face password ssh login. You can refer to here http:\/\/www.linuxidc.com\/Linux\/2016-02\/128149.htm<\/p>\n<p>Machine name\tIp<br \/>\nMaster\t192.168.1.1<br \/>\nSlaver1\t192.168.1.2<br \/>\nSlaver2\t192.168.1.3<br \/>\nSlaver3\t192.168.1.4<br \/>\nSlaver4\t192.168.1.5<br \/>\nInstall the JDK<\/p>\n<p>CentOS 7 is openJDK by default<\/p>\n<p>Uninstall the openJDK under CentOS 7 and install Sun JDK1.7<\/p>\n<p>View the openJDK installation path<\/p>\n<p>rpm -qa | grep java<\/p>\n<p>Uninstall openJDK<\/p>\n<p> rpm -e &#8211;nodeps  java-1.7.0-openjdk-1.7.0.85-2.6.1.2.el7_1.x86_64<br \/>\n rpm -e &#8211;nodeps  java-1.8.0-openjdk-devel-1.8.0.60-2.b27.el7_1.x86_64<br \/>\n rpm -e &#8211;nodeps  java-1.6.0-openjdk-1.6.0.36-1.13.8.1.el7_1.x86_64<br \/>\n rpm -e &#8211;nodeps  java-1.6.0-openjdk-devel-1.6.0.36-1.13.8.1.el7_1.x86_64<\/p>\n<p>Install Sun JDK1.7<\/p>\n<p>Download from the official website jdk-7u80-linux-x64.rpm, upload to master<\/p>\n<p>Install Sun JDK1.7<\/p>\n<p>rpm -ivh jdk-7u80-linux-x64.rpm<\/p>\n<p>Modify environment variables<\/p>\n<p>In \/etc\/profile  add in<\/p>\n<p>export JAVA_HOME=\/usr\/java\/jdk1.7.0_80<br \/>\nexport CLASSPATH=.:$JAVA_HOME\/jre\/lib\/rt.jar:$JAVA_HOME\/lib\/dt.jar:$JAVA_HOME\/lib\/tools.jar<br \/>\nexport PATH=$PATH:$JAVA_HOME\/bin<\/p>\n<p>source \/etc\/profile<\/p>\n<p>Install Hadoop 2.6.4<\/p>\n<p>Download, extract<\/p>\n<p>Hadoop 2.6.4 downloaded from the official website and decompress on the master<br \/>\nextraction path of their choice, here is my decompression in<\/p>\n<p>\/root\/workspace\/software\/hadoop-2.6.4<\/p>\n<p>Add environment variable<\/p>\n<p>In \/etc\/profileadd in<\/p>\n<p>export HADOOP_HOME=\/root\/workspace\/software\/hadoop-2.6.4\/<br \/>\nexport PATH=$PATH:$HADOOP_HOME\/bin:$HADOOP_HOME\/sbin<br \/>\nModify the Hadoop configuration file<\/p>\n<p>Hadoop-env.sh<\/p>\n<p>In the hadoop decompression path below, \/ etc \/ hadoop \/ hadoop-env.sh add the following two lines<\/p>\n<p>export JAVA_HOME=\/usr\/java\/jdk1.7.0_80<br \/>\nexport HADOOP_PREFIX=\/root\/workspace\/software\/hadoop-2.6.4<br \/>\nCore-site.xml<\/p>\n<p>Under the hadoop decompression path, add the following to \/ etc \/ hadoop \/ core-site.xml<\/p>\n<property>\n        <name>fs.defaultFS<\/name><br \/>\n        <value>hdfs:\/\/master:9000\/<\/value>\n    <\/property>\n    <property>\n         <name>hadoop.tmp.dir<\/name><br \/>\n         <value>\/root\/workspace\/software\/hadoop-2.6.4\/tmp<\/value>\n    <\/property>\n<\/configuration><br \/>\nHdfs-site.xml<\/p>\n<p>In the hadoop decompression path below, \/ etc \/ hadoop \/ hdfs-site.xml add the following<\/p>\n<p><configuration>\n    <property>\n        <name>dfs.replication<\/name><br \/>\n        <value>3<\/value>\n    <\/property>\n<\/configuration><br \/>\nSet here to 3, indicating that the data has 3 copies.<\/p>\n<p>Mapred-site.xml<\/p>\n<p>Under the hadoop decompression path, add the following to \/ etc \/ hadoop \/ mapred-site.xml<\/p>\n<p><configuration>\n    <property>\n        <name>mapreduce.framework.name<\/name><br \/>\n        <value>yarn<\/value>\n    <\/property>\n<\/configuration><br \/>\nYarn-env.sh<\/p>\n<p>In the hadoop decompression path below, \/ etc \/ hadoop \/ yarn-env.sh increase below, increase the Java-HOME configuration<\/p>\n<p>export JAVA_HOME=\/usr\/java\/jdk1.7.0_80<br \/>\nYarn-site.xml<\/p>\n<p>Under the hadoop decompression path, add the following to \/ etc \/ hadoop \/ yarn-site.xml<\/p>\n<p><configuration>\n    <property>\n        <name>yarn.nodemanager.aux-services<\/name><br \/>\n        <value>mapreduce_shuffle<\/value>\n    <\/property>\n    <property>\n        <name>yarn.resourcemanager.hostname<\/name><br \/>\n        <value>master<\/value>\n    <\/property>\n  <property>\n  <description>The address of the applications manager interface in the RM.<\/description><br \/>\n  <name>Yarn.resourcemanager.address<\/name><br \/>\n  <value>master:18040<\/value>\n  <\/property>\n<property>\n  <description>The address of the scheduler interface.<\/description><br \/>\n  <name>Yarn.resourcemanager.scheduler.address<\/name><br \/>\n  <value>master:18030<\/value>\n  <\/property>\n<property>\n  <description>The address of the RM web application.<\/description><br \/>\n  <name>Yarn.resourcemanager.webapp.address<\/name><br \/>\n  <value>master:18088<\/value>\n  <\/property>\n<property>\n  <description>The address of the resource tracker interface.<\/description><br \/>\n  <name>Yarn.resourcemanager.resource-tracker.address<\/name><br \/>\n  <value>master:8025<\/value>\n  <\/property>\n<\/configuration><br \/>\nAdd some of the port number, easy to remotely from the browser to view the cluster situation, it is recommended to add in accordance with this.<\/p>\n<p>Slaves<\/p>\n<p>Under the hadoop decompression path, add the following to \/ etc \/ hadoop \/ slaves<\/p>\n<p>master<br \/>\nslaver1<br \/>\nslaver2<br \/>\nslaver3<br \/>\nslaver4<\/p>\n<p>Deploy slaver1-slaver4<\/p>\n<p>In accordance with the above process, the slaver1-slaver4 on the environment variables added, and then directly<\/p>\n<p>scp -r \/Hadoop2.6.4 root@slaverX:\/root\/workspace\/software\/<br \/>\nX is 1 &#8211; 4, copied to slaver1 &#8211; slaver4, respectively<\/p>\n<p>Start hadoop cluster<\/p>\n<p>Format the file system<\/p>\n<p>hdfs namenode -format<br \/>\nStart NameNode and DateNode<\/p>\n<p>\/root\/workspace\/software\/hadoop-2.6.4\/sbin, run<\/p>\n<p>start-dfs.sh<br \/>\nUse the jps command to view the Java process on the master<\/p>\n<p>[root@master hadoop]# jps<br \/>\n27130 DataNode<br \/>\n27927 NameNode<br \/>\n12379 Jps<br \/>\n27422 SecondaryNameNode<br \/>\n[root@master hadoop]#<br \/>\nJps command to view the Java processes on slaver1 &#8211; slaver4, respectively<\/p>\n<p>[root@slaver1 hadoop]# jps<br \/>\n6130 DataNode<br \/>\n1264 Jps<br \/>\nView NameNode and NameNode information<\/p>\n<p>Browser input<\/p>\n<p>IP:50070\/dfshealth.html#tab-datanode<br \/>\nIP is the IP of your cluster<\/p>\n<p>Start the ResourceManager and NodeManager<\/p>\n<p>Run start-yarn.sh, jps view process is as follows:<\/p>\n<p>[root@master hadoop]# jps<br \/>\n27130 DataNode<br \/>\n28777 ResourceManager<br \/>\n27927 NameNode<br \/>\n12379 Jps<br \/>\n28916 NodeManager<br \/>\n27422 SecondaryNameNode<br \/>\nSwitch to slaver1-slaver4, jps view process<\/p>\n<p>[root@slaver1 hadoop]# jps<br \/>\n27130 DataNode<br \/>\n12379 Jps<br \/>\n28916 NodeManager<br \/>\nSucceeded<\/p>\n<p>Hadoop cluster has already started.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hadoop 2.6.4 distributed cluster environment is built on the actual cluster .<\/p>\n<p>Cluster preparation<\/p>\n<p>There are five machines that have changed the machine name for master, slaver1, slaver2, slaver3, slaver4, and set the face password ssh login. You can refer to here http:\/\/www.linuxidc.com\/Linux\/2016-02\/128149.htm<\/p>\n<p>Machine name Ip Master 192.168.1.1 Slaver1 192.168.1.2 Slaver2 192.168.1.3 Slaver3 192.168.1.4 Slaver4 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6786"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6786"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6786\/revisions"}],"predecessor-version":[{"id":6787,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6786\/revisions\/6787"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}