3 | | * Hadoop 與 DRBL 整合時,常遇到 storageID 無法識別的困擾,遇到這種問題的時候,就直接給定 hostname 當 storageID 就可以看到全部的 DataNode 都加進 HDFS 了 |
| 3 | * Hadoop 與 DRBL 整合時,常遇到 storageID 無法識別的困擾,遇到這種問題的時候,就直接給定 hostname 當 storageID 就可以看到全部的 !DataNode 都加進 HDFS 了 |
| 4 | * 首先,為了日後重開機以後,維持 !NameNode 的 namenodeID 不變,我們把 namenode 的資料存在 /home/hdfsadm 中。修改 /etc/hadoop/hadoop-site.xml 的 dfs.name.dir 來達成這個目標。至於原本安裝 hadoop 套件時設定的 localhost 則應該要改成 DRBL 對內的 IP 位址(這裡以 192.168.100.254 為例)。另外,也把 /etc/hadoop/slaves 修改成目前 DRBL Client 的 IP 範圍。 |
| 5 | {{{ |
| 6 | jazz@drbl:~$ cat /etc/hadoop/hadoop-site.xml |
| 7 | <?xml version="1.0"?> |
| 8 | <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> |
| 9 | |
| 10 | <!-- Put site-specific property overrides in this file. --> |
| 11 | |
| 12 | <configuration> |
| 13 | <property> |
| 14 | <name>fs.default.name</name> |
| 15 | <value>192.168.100.254:9000</value> |
| 16 | <description> |
| 17 | The name of the default file system. Either the literal string |
| 18 | "local" or a host:port for NDFS. |
| 19 | </description> |
| 20 | </property> |
| 21 | <property> |
| 22 | <name>mapred.job.tracker</name> |
| 23 | <value>192.168.100.254:9001</value> |
| 24 | <description> |
| 25 | The host and port that the MapReduce job tracker runs at. If |
| 26 | "local", then jobs are run in-process as a single map and |
| 27 | reduce task. |
| 28 | </description> |
| 29 | </property> |
| 30 | <property> |
| 31 | <name>dfs.name.dir</name> |
| 32 | <value>/home/hdfsadm/dfs/name</value> |
| 33 | <description> |
| 34 | Determines where on the local filesystem the DFS name node |
| 35 | should store the name table. If this is a comma-delimited list |
| 36 | of directories then the name table is replicated in all of the |
| 37 | directories, for redundancy. |
| 38 | </description> |
| 39 | </property> |
| 40 | </configuration> |
| 41 | jazz@drbl:~$ cat /etc/hadoop/slaves |
| 42 | 192.168.100.1 |
| 43 | 192.168.100.2 |
| 44 | ... |
| 45 | 192.168.100.30 |
| 46 | }}} |
| 47 | * 接著以 dcs 的功能執行 re-deploy 好讓每一個 nodes 的設定同步。然後只做一次 namenode 格式化,以後就不需要再格式化了。 |
| 48 | {{{ |
| 49 | jazz@drbl:~$ sudo /opt/drbl/sbin/dcs |
| 50 | jazz@drbl:~$ sudo /opt/hadoop/bin/hadoop namenode -format |
| 51 | }}} |