Mac under Hadoop install and run example

Source: Internet
Author: User
Tags builtin deprecated xsl hadoop fs

1 installation

install hadoop

Install the 2.6.0, directory is/usr/local/cellar/hadoop, if you want to install another version, download the TAR package decompression. Address: http://mirrors.cnnic.cn/apache/hadoop/common/
2 configuration
Configure the Hadoop executable path bin and sbin to environment variables

HADOOP_HOME=/usr/local/Cellar/hadoop/2.6.0/libexecJAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/ContentsPATH=.:$JAVA_HOME/bin:$HADOOP_HOME/sbin/:$HADOOP_HOME/bin/:$PATH

Next configure the pseudo-distributed:
(1)
Configure Core-site.xml

?  hadoop  cat core-site.xml<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration>    <property>        <name>fs.default.name</name>        <value>hdfs://localhost:9000</value>    </property></configuration>

(2) The node backup of HDFs is set to 1
Configure Hdfs-site.xml

?  hadoop  cat hdfs-site.xml<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration>  <property>    <name>dfs.replication</name>    <value>1</value>  </property></configuration>

(3) Configuration Mapred-site.xml

?  hadoop  cat mapred-site.xml<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration>  <property>    <name>mapred.job.tracker</name>    <value>hdfs://localhost:9000/</value>  </property></configuration>

(4) Configure the JDK path in the hadoop-env.sh.
Then execute: Format namenode

?  Hadoop Namenode-format? HadoopStart- All. shthis Script isDeprecated. Instead useStart-dfs.sh and Start-yarn.sh the/Geneva/ in  A: *: AWARN Conf. Configuration:deprecated:hadoop-site.xmlfound inchThe classpath.Usage  ofHadoop-site.xml isDeprecated. Instead use Core-site.xml, Mapred-site.xml andHdfs-site.xml toOverride Properties ofcore-default. XML, mapred-default. xml andhdfs-default. XML respectively the/Geneva/ in  A: *: +WARN util. Nativecodeloader:unable to LoadNative-hadoop Library forYour platform ...usingBuiltin-java classeswhereApplicablestarting Namenodes on[Localhost]localhost:namenode Running asProcess7082.Stop it First. Localhost:datanode Running asProcess7163.Stop it First. Starting secondary namenodes [0.0. 0. 0]0.0. 0. 0: Secondarynamenode Running asProcess7266.Stop it First. the/Geneva/ in  A: *: -WARN Conf. Configuration:deprecated:hadoop-site.xmlfound inchThe classpath.Usage  ofHadoop-site.xml isDeprecated. Instead use Core-site.xml, Mapred-site.xml andHdfs-site.xml toOverride Properties ofcore-default. XML, mapred-default. xml andhdfs-default. XML respectively the/Geneva/ in  A: *: theWARN util. Nativecodeloader:unable to LoadNative-hadoop Library forYour platform ...usingBuiltin-java classeswhereapplicablestarting Yarn Daemonsresourcemanager Running asProcess7377.Stop it First. Localhost:nodemanager Running asProcess7466.Stop it First.? Hadoop JPS7163DataNode9619Jps7466NodeManager7377ResourceManager7082NameNode7266Secondarynamenode? Hadoop

You can see that five nodes are started.
3 Running Example WordCount
First create the directory input and file and upload to HDFs

? Libexec ls Inputfile1.TXT file2.TXT? libexec Hadoop FS-putInput/file*.Txt/input? Libexec Hadoop FS-ls/input the/Geneva/ in  A: $:Panax NotoginsengWARN conf.Configuration:DEPRECATED:hadoop-site.XMLFoundinchThe Classpath.Usage of Hadoop-site.XMLis deprecated.Instead Use Core-site.XML, mapred-site.XML  andHdfs-site.XML  toOverride properties of Core-default.XML, mapred-default.XML  andHdfs-default.XMLrespectively the/Geneva/ in  A: $: theWARN util.Nativecodeloader:unable toLoad native-hadoopLibrary for your platform...Using builtin-javaClasseswhereApplicablefound2Items-RW- R--R--   1SHENYB supergroup *  --Geneva- in  One: Geneva/input/file1.Txt-RW- R--R--   1SHENYB supergroup -  --Geneva- in  One: Geneva/input/file2.Txt? Libexec Hadoop jar Share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6. 0.Jar Wordcount/input/output Run If there is no error, the result output is as follows:? Libexec Hadoop FS-ls/output the/Geneva/ in  A: About: inWARN conf.Configuration:DEPRECATED:hadoop-site.XMLFoundinchThe Classpath.Usage of Hadoop-site.XMLis deprecated.Instead Use Core-site.XML, mapred-site.XML  andHdfs-site.XML  toOverride properties of Core-default.XML, mapred-default.XML  andHdfs-default.XMLrespectively the/Geneva/ in  A: About: -WARN util.Nativecodeloader:unable toLoad native-hadoopLibrary for your platform...Using builtin-javaClasseswhereApplicablefound2Items-RW- R--R--   1SHENYB supergroup0  --Geneva- in  A: -/output/_success-RW- R--R--   1SHENYB supergroup the  --Geneva- in  A: -/output/part- R-00000? Libexec Hadoop FS-cat/output/part- R-00000 the/Geneva/ in  A: About: -WARN conf.Configuration:DEPRECATED:hadoop-site.XMLFoundinchThe Classpath.Usage of Hadoop-site.XMLis deprecated.Instead Use Core-site.XML, mapred-site.XML  andHdfs-site.XML  toOverride properties of Core-default.XML, mapred-default.XML  andHdfs-default.XMLrespectively the/Geneva/ in  A: About:WuyiWARN util.Nativecodeloader:unable toLoad native-hadoopLibrary for your platform...Using builtin-javaClasseswhereApplicableai2Am3Cmp1Is2I2Mans1Man21Shenya2W.H.O.2You1You21? Libexec

Mac under Hadoop install and run example

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.