{"id":57,"date":"2012-05-24T10:20:38","date_gmt":"2012-05-24T14:20:38","guid":{"rendered":"http:\/\/lichun.cc\/blog\/?p=57"},"modified":"2012-05-24T10:20:38","modified_gmt":"2012-05-24T14:20:38","slug":"build-local-haoop-cluster-on-linux","status":"publish","type":"post","link":"https:\/\/www.lichun.cc\/blog\/2012\/05\/build-local-haoop-cluster-on-linux\/","title":{"rendered":"Build Local Single Node Hadoop Cluster on Linux"},"content":{"rendered":"<p>This post shows how to build a local single node Hadoop cluster on Linux.<\/p>\n<h2>Prerequisite:<\/h2>\n<p>(1) Install JDK , <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/index.html\">Download Link<\/a><\/p>\n<p>(2) install ANT, <a href=\"http:\/\/ant.apache.org\/bindownload.cgi\">Download Link<\/a><\/p>\n<p>Use the bin version, and add the following lines in your<br \/>\n<strong>~\/.bash_profile<\/strong><\/p>\n<pre>export ANT_HOME=YOUR_ANT_PATH\nexport JAVA_HOME=YOUR_JDK_PATH\nexport PATH=${PATH}:${ANT_HOME}\/bin<\/pre>\n<p>&nbsp;<\/p>\n<h2>Install Hadoop:<\/h2>\n<p>(1) Download Hadoop, <a href=\"http:\/\/hadoop.apache.org\/common\/releases.html#Download\">Download Link<\/a><br \/>\n<!--more--><br \/>\n(2) uncompress the file, move the folder to wherever you want, I use ~\/hadoop\/<\/p>\n<p>(3) enter ~\/hadoop\/, run<\/p>\n<pre>ant<\/pre>\n<p>(4)\u00a0Put localhost in two files, conf\/masters and conf\/slaves:<\/p>\n<pre>echo localhost &gt; conf\/masters;\necho localhost &gt; conf\/slaves;<\/pre>\n<p>(5) In conf\/core-site.xml:<\/p>\n<pre>&lt;?xml version=\"1.0\"?&gt;\n&lt;?xml-stylesheet type=\"text\/xsl\" href=\"configuration.xsl\"?&gt;\n&lt;configuration&gt;\n  &lt;property&gt;\n    &lt;name&gt;fs.default.name&lt;\/name&gt;\n    &lt;value&gt;hdfs:\/\/127.0.0.1:9000&lt;\/value&gt;\n  &lt;\/property&gt;\n&lt;\/configuration&gt;<\/pre>\n<p>(6) In\u00a0conf\/mapred-site.xml:<\/p>\n<pre>&lt;?xml version=\"1.0\"?&gt;\n&lt;?xml-stylesheet type=\"text\/xsl\" href=\"configuration.xsl\"?&gt;\n&lt;configuration&gt;\n  &lt;property&gt;\n    &lt;name&gt;mapred.job.tracker&lt;\/name&gt;\n    &lt;value&gt;localhost:9001&lt;\/value&gt;\n  &lt;\/property&gt;\n\n  &lt;property&gt;\n    &lt;name&gt;dfs.datanode.socket.write.timeout&lt;\/name&gt;\n    &lt;value&gt;0&lt;\/value&gt;\n  &lt;\/property&gt;\n&lt;\/configuration&gt;<\/pre>\n<p>(7) edit conf\/hadoop-env.sh, uncomment the JAVA_HOME line, and put the right path for JDK<\/p>\n<pre>export JAVA_HOME=YOUR_JDK_PATH<\/pre>\n<p>(8) Run Hadoop !<\/p>\n<pre>.\/bin\/start-all.sh<\/pre>\n<p>&nbsp;<\/p>\n<h2>After Running:<\/h2>\n<p>(1)\u00a0Check that the daemons are running using jps (shows java processes):<\/p>\n<pre>jps<\/pre>\n<p>Should show 5 processes and Jps (and maybe more if you are running e.g. Eclipse):<\/p>\n<pre>17400 SecondaryNameNode\n17172 NameNode\n17599 TaskTracker\n17279 DataNode\n17493 JobTracker\n17699 Jps<\/pre>\n<p>Check the local NameNode:\u00a0<a href=\"http:\/\/localhost:50070\/dfshealth.jsp\" rel=\"nofollow\" target=\"_blank\">http:\/\/localhost:50070\/dfshealth.jsp<\/a>\u00a0should show one live node.<\/p>\n<p>Check the local JobTracker:\u00a0<a href=\"http:\/\/localhost:50030\/jobtracker.jsp\" rel=\"nofollow\" target=\"_blank\">http:\/\/localhost:50030\/jobtracker.jsp<\/a>\u00a0should show &#8216;State: RUNNING&#8217;, not &#8216;INITIALIZING&#8217;.<\/p>\n<p>If the Namenode is not running, format the Namenode, and run start-all.sh again:<\/p>\n<pre>rm -r \/tmp\/hadoop-*;\nbin\/hadoop namenode -format;\n.\/bin\/start-all.sh<\/pre>\n<p>This can be caused by switching Hadoop versions.<br \/>\n(2) Sanity test<\/p>\n<pre>hadoop fs -ls \/<\/pre>\n<p>(3) Word Count Example:<\/p>\n<p>Please Look <a href=\"http:\/\/www.michael-noll.com\/tutorials\/running-hadoop-on-ubuntu-linux-single-node-cluster\/#running-a-mapreduce-job\" target=\"_blank\">Here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post shows how to build a local single node Hadoop cluster on Linux. Prerequisite: (1) Install JDK , Download Link (2) install ANT, Download Link Use the bin version, and add the following lines in your ~\/.bash_profile export ANT_HOME=YOUR_ANT_PATH export JAVA_HOME=YOUR_JDK_PATH export PATH=${PATH}:${ANT_HOME}\/bin &nbsp; Install Hadoop: (1) Download Hadoop, Download Link<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[19],"tags":[15,16,17,18],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2s9sh-V","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/posts\/57"}],"collection":[{"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":0,"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lichun.cc\/blog\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}