| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | ◢ <[wiki:III141025/Lab3 實作三]> | <[wiki:III141025 回課程大綱]> ▲ | <[wiki:III141025/Lab5 實作五]> ◣ |
| | 4 | |
| | 5 | = 實作四 Lab 4 = |
| | 6 | |
| | 7 | {{{ |
| | 8 | #!html |
| | 9 | <div style="text-align: center;"><big style="font-weight: bold;"><big>HDFS 叢集環境操作練習<br/>HDFS full distributed mode in practice</big></big></div> |
| | 10 | }}} |
| | 11 | |
| | 12 | {{{ |
| | 13 | #!text |
| | 14 | 以下練習,請連線至 hadoop.3du.me 操作。底下的 userXX 等於您的用戶名稱。 |
| | 15 | }}} |
| | 16 | |
| | 17 | == 產生目錄 == |
| | 18 | |
| | 19 | {{{ |
| | 20 | user0@hdp:~$ hadoop fs -ls |
| | 21 | user0@hdp:~$ hadoop fs -mkdir tmp |
| | 22 | user0@hdp:~$ hadoop fs -ls |
| | 23 | Found 1 items |
| | 24 | drwxr-xr-x - user0 supergroup 0 2014-03-23 02:04 /user/user0/tmp |
| | 25 | }}} |
| | 26 | |
| | 27 | == 產生一個 100 MB 的檔案 == |
| | 28 | |
| | 29 | {{{ |
| | 30 | user0@hdp:~$ dd if=/dev/zero of=100mb.img bs=1M count=100 |
| | 31 | 100+0 records in |
| | 32 | 100+0 records out |
| | 33 | 104857600 bytes (105 MB) copied, 0.0589096 s, 1.8 GB/s |
| | 34 | user0@hdp:~$ hadoop fs -put 100mb.img test.img |
| | 35 | user0@hdp:~$ hadoop fs -ls |
| | 36 | Found 2 items |
| | 37 | -rw-r--r-- 1 user0 supergroup 104857600 2014-03-23 02:08 /user/user0/test.img |
| | 38 | drwxr-xr-x - user0 supergroup 0 2014-03-23 02:04 /user/user0/tmp |
| | 39 | }}} |
| | 40 | |
| | 41 | == 觀察 block 分佈情形 == |
| | 42 | |
| | 43 | {{{ |
| | 44 | user0@hdp:~$ hadoop fsck /user/$USER/test.img -files -blocks -locations |
| | 45 | FSCK started by user0 from /10.240.1.123 for path /user/$USER/test.img at Sun |
| | 46 | Mar 23 02:11:08 UTC 2014 |
| | 47 | /user/user0/test.img 104857600 bytes, 2 block(s): OK |
| | 48 | 0. blk_-4422576463029178583_1044 len=67108864 repl=1 [10.240.1.123:50010] |
| | 49 | 1. blk_7793285600029540175_1044 len=37748736 repl=1 [10.240.1.123:50010] |
| | 50 | |
| | 51 | Status: HEALTHY |
| | 52 | Total size: 104857600 B |
| | 53 | Total dirs: 0 |
| | 54 | Total files: 1 |
| | 55 | Total blocks (validated): 2 (avg. block size 52428800 B) |
| | 56 | Minimally replicated blocks: 2 (100.0 %) |
| | 57 | Over-replicated blocks: 0 (0.0 %) |
| | 58 | Under-replicated blocks: 0 (0.0 %) |
| | 59 | Mis-replicated blocks: 0 (0.0 %) |
| | 60 | Default replication factor: 1 |
| | 61 | Average block replication: 1.0 |
| | 62 | Corrupt blocks: 0 |
| | 63 | Missing replicas: 0 (0.0 %) |
| | 64 | Number of data-nodes: 9 |
| | 65 | Number of racks: 1 |
| | 66 | FSCK ended at Sun Mar 23 02:11:08 UTC 2014 in 9 milliseconds |
| | 67 | |
| | 68 | |
| | 69 | The filesystem under path '/user/$USER/test.img' is HEALTHY |
| | 70 | }}} |
| | 71 | |
| | 72 | == 修改副本個數 == |
| | 73 | |
| | 74 | {{{ |
| | 75 | user0@hdp:~$ hadoop fs -setrep 2 /user/$USER/test.img |
| | 76 | Replication 2 set: hdfs://hdp:9000/user/$USER/test.img |
| | 77 | user0@hdp:~$ hadoop fsck /user/$USER/test.img -files -blocks -locations |
| | 78 | FSCK started by user0 from /10.240.1.123 for path /user/$USER/test.img at Sun |
| | 79 | Mar 23 02:45:11 UTC 2014 |
| | 80 | /user/$USER/test.img 104857600 bytes, 2 block(s): OK |
| | 81 | 0. blk_-4422576463029178583_1044 len=67108864 repl=2 [10.240.1.123:50010, 10.2 |
| | 82 | 40.174.73:50010] |
| | 83 | 1. blk_7793285600029540175_1044 len=37748736 repl=2 [10.240.1.123:50010, 10.24 |
| | 84 | 0.116.151:50010] |
| | 85 | |
| | 86 | Status: HEALTHY |
| | 87 | Total size: 104857600 B |
| | 88 | Total dirs: 0 |
| | 89 | Total files: 1 |
| | 90 | Total blocks (validated): 2 (avg. block size 52428800 B) |
| | 91 | Minimally replicated blocks: 2 (100.0 %) |
| | 92 | Over-replicated blocks: 0 (0.0 %) |
| | 93 | Under-replicated blocks: 0 (0.0 %) |
| | 94 | Mis-replicated blocks: 0 (0.0 %) |
| | 95 | Default replication factor: 1 |
| | 96 | Average block replication: 2.0 |
| | 97 | Corrupt blocks: 0 |
| | 98 | Missing replicas: 0 (0.0 %) |
| | 99 | Number of data-nodes: 9 |
| | 100 | Number of racks: 1 |
| | 101 | FSCK ended at Sun Mar 23 02:45:11 UTC 2014 in 0 milliseconds |
| | 102 | |
| | 103 | |
| | 104 | The filesystem under path '/user/$USER/test.img' is HEALTHY |
| | 105 | }}} |