1.å¦ä½å¨ubuntuä¸å®è£
hadoop
å¦ä½å¨ubuntuä¸å®è£ hadoop
1ãå建hadoop管çåå¸å·
ç´æ¥å¨ç»ç«¯æ§è¡å¦ä¸å½ä»¤è¡ï¼
1 sudo adduser hadoop
ç¶åè¦æ±ä½ 设置hadoopå¸æ·å¯ç ï¼è¿ä¸ªå½ä»¤æ¯æ·»å ä¸ä¸ªå为hadoopçæ åå¸æ·ï¼æ们éè¦çæ¯ç®¡çåå¸å·
å¯ä»¥ç´æ¥å¨å¾å½¢çé¢ä¸ä¿®æ¹hadoopæéï¼å°é¼ æ ç¹å»å³ä¸è§çä¸ä¸ªäººå¤´å¤ï¼æµ®ç°å表ï¼ç¹å»âç¨æ·è´¦æ·âï¼è§£éï¼ç¶åæ´æ¹ä¸ºç®¡çåæé
2ãå®è£ sshæå¡
sshå¯ä»¥å®ç°è¿ç¨ç»å½å管çï¼è¯¦ç»æ åµè¯·googleç¾åº¦
ubuntué»è®¤å¹¶æ²¡æå®è£ sshæå¡ï¼å¦æéè¿sshé¾æ¥ubuntuï¼éè¦èªå·±æå¨å®è£ ssh-serverãå½ä»¤è¡ï¼
1 sudo apt-get install ssh openssh-server
3ãsshæ å¯ç éªè¯ç»å½
å建ssh-keyï¼è¿éæ们éç¨rsaæ¹å¼ï¼å½ä»¤è¡å¦ä¸ï¼
1 ssh-keygen -t rsa -P ""
åºç°ä¸ä¸ªå¾å½¢ï¼åºç°çå¾å½¢å°±æ¯å¯ç ï¼ä¸ç¨ç®¡å®
1 cat ~/.ssh/id_rsa.pub >> authorized_keys
ç¶åå³å¯æ å¯ç éªè¯ç»å½äºï¼å¦ä¸ï¼
1 ssh localhost
éåºå½ä»¤è¡ä¸ºï¼
exit
4ã解åhadoopæºç å
ç»ç«¯ä¸è¿å ¥hadoopæºç å æå¨ç®å½ï¼ä½¿ç¨å¤å¶å½ä»¤æhadoopæºç å å¤å¶å°/home/hadoopä¸
1 cp hadoop-1.2.1.tar.gz /home/hadoop
ç¶å解å,盲盒商城公众号版本源码å½ä»¤è¡å¦ä¸
tar -xzvf *.tag.gz
5ãé ç½®hadoopçhadoop/confä¸çhadoop-env.shï¼core-site.xmlï¼mapred-site.xmlï¼hdfs-site.xml
é ç½®hadoop-1.2.1/conf/hadoop-env.shï¼å½ä»¤è¡ï¼
1 gedit /home/hadoop/hadoop-1.2.1/conf/hadoop-env.sh
ctrl + f æç´¢å°JAVA_HOME
æåé¢ç#å»æï¼å ä¸æ¬ç³»ç»jdkè·¯å¾ï¼ä¿åéåº
é ç½®hadoop-1.2.1/conf/core-site.xmlï¼å½ä»¤è¡ï¼
gedit /home/hadoop/hadoop-1.2.1/conf/core-site.xml
å¨hadoopæ°å»ºhadoop_tmpç®å½ï¼
å°å¦ä¸<configuration> </configuration>ä¹é´çæ·»å è¿å ¥ï¼ä¿åéåº
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/hadoop-1.2.1/hadoop_tmp</value>
<description>A base for other temporary directories.</description>
</property>
</configuration>
é ç½®hadoop-1.2.1/conf/mapre-site.xmlï¼å½ä»¤è¡ï¼
1 gedit /home/hadoop/hadoop-1.2.1/conf/mapre-site.xml.xml
å°å¦ä¸<configuration> </configuration>ä¹é´çæ·»å è¿å ¥ï¼ä¿åéåº
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:</value>
</property>
</configuration>
é ç½®hadoop-1.2.1/conf/hdfs-site.xmlï¼å½ä»¤è¡ï¼
1 gedit /home/hadoop/hadoop-1.2.1/conf/hdfs-site.xml
å°å¦ä¸<configuration> </configuration>ä¹é´çæ·»å è¿å ¥ï¼ä¿åéåº
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
è³æ¤hadoopçå®è£ é 置已ç»å®æ¯ï¼ç¨åçæ¯hadoopçå次è¿è¡æä½
6ãæ ¼å¼åhdfsæ件系ç»
è¿å ¥hadoop-1.2.1
/bin/hadoop namenode -format
7ãå¯å¨hadoopæå¡
/bin/start-all.sh
åºç°å¦ä¸ç»é¢
jps
jpsæ¯æ¥çjavaèææºè¿è¡çjava线ç¨
ç¶ååºç°å¦ä¸ç»é¢
ä¸è®¡jpsï¼æäºä¸ªhadoopç¸å ³çº¿ç¨ï¼æåä½ ï¼hadoopå®è£ é ç½®æåï¼è¿è¡æ£å¸¸ã
ç¶åå¯ä»¥éåºhadoopãï¼ä»¥ååç¨æ¶åå¯å¨ï¼å¯¼å ¥æ°æ®