| | 181 | == 5.1 install IBM mapReduce tool == |
| | 182 | 1. Download the IBM MapReduce Tools zip file and extract to /tmp/. [[br]] |
| | 183 | 2. Make sure Eclipse is closed and ... [[br]] |
| | 184 | {{{ |
| | 185 | $ cd /tmp/ |
| | 186 | $ unzip mapreduce_tools.zip |
| | 187 | $ mv plugins/com.ibm.hipods.mapreduce* /usr/lib/eclipse/plugins/ |
| | 188 | }}} |
| | 189 | 3. Restart Eclipse [[br]] |
| | 190 | Check IBM MapReduce Tools plugin installing well [[br]] |
| | 191 | {{{ |
| | 192 | Eclipse |
| | 193 | File > New > Project |
| | 194 | see MapReduce category |
| | 195 | }}} |
| | 196 | == 5.2 Eclipse configure == |
| | 197 | {{{ |
| | 198 | Eclipse |
| | 199 | Window > Preferences > java> compiler |
| | 200 | set compiler compliance level to 5.0 |
| | 201 | }}} |
| | 202 | * Some eclipse-plugin may exhaust much resource, you may happen to “out of |
| | 203 | |
| | 204 | memory error”. We suggest to execute eclipse with some parameters as that : |
| | 205 | {{{ |
| | 206 | $ eclipse -vmargs -Xmx 512m |
| | 207 | }}} |
| | 208 | |
| | 209 | == 5.3. Run on Eclipse == |
| | 210 | === 5.3.1 map-reduce sample code === |
| | 211 | {{{ |
| | 212 | Eclipse |
| | 213 | File > new > project > map-reduce project > next > |
| | 214 | project name : sample |
| | 215 | use default location : V |
| | 216 | use default Hadoop : V |
| | 217 | > Finish |
| | 218 | }}} |
| | 219 | * at “Project explorer”, you will see “sample” tree. Now, you should |
| | 220 | |
| | 221 | create a sample code. |
| | 222 | {{{ |
| | 223 | Eclipse |
| | 224 | right click sample > new > file > |
| | 225 | file name : WordCount.java |
| | 226 | }}} |
| | 227 | * the sample code is here |
| | 228 | |
| | 229 | [http://trac.nchc.org.tw/cloud/attachment/wiki/hadoop-sample- |
| | 230 | |
| | 231 | code/WordCount.java] |
| | 232 | |
| | 233 | * paste the contents to your new adding file “WordCount.java” |
| | 234 | === 5.3.2. Connect to Hadoop File System === |
| | 235 | |
| | 236 | * Enable the MapReduce servers window |
| | 237 | {{{ |
| | 238 | Eclipse |
| | 239 | Window > Show View > Other... > MapReduce Tools > MapReduce Servers |
| | 240 | }}} |
| | 241 | |
| | 242 | * At the bottom of your window, you should have a "MapReduce Servers" tab. |
| | 243 | |
| | 244 | If not, see second bullet above. Switch to that tab. |
| | 245 | |
| | 246 | * At the top right edge of the tab, you should see a little blue elephant |
| | 247 | |
| | 248 | icons. |
| | 249 | {{{ |
| | 250 | Eclipse |
| | 251 | Click blue elephant to add a new MapReduce server location. |
| | 252 | Server name : any_you_want |
| | 253 | Hostname : localhost |
| | 254 | Installation directory: /home/waue/workspace/nutch/ |
| | 255 | Username : waue |
| | 256 | }}} |
| | 257 | * If any password prompt, please input the password which you login to |
| | 258 | |
| | 259 | local |
| | 260 | |
| | 261 | * It should show up under a little elephant icon in the Project Explorer |
| | 262 | |
| | 263 | (on the left side of Eclipse). |
| | 264 | |
| | 265 | * ps : Pleast make sure your Hadoop is working on local system. If not, |
| | 266 | |
| | 267 | please refer “session 2 Hadoop Setup” for debuging, or you can not pass |
| | 268 | |
| | 269 | through. |
| | 270 | |
| | 271 | $ cd /home/waue/workspace/hadoop/ [[br]] |
| | 272 | $ wget http://www.gutenberg.org/etext/132/132.txt [[br]] |
| | 273 | $ bin/hadoop dfs -mkdir input [[br]] |
| | 274 | $ bin/hadoop dfs -ls [[br]] |
| | 275 | {{{ |
| | 276 | Found 1 items |
| | 277 | /user/waue/input <dir> 2008-05-23 15:15 rwxr-xr-x |
| | 278 | |
| | 279 | waue supergroup |
| | 280 | }}} |
| | 281 | $ bin/hadoop dfs -put 132.txt input [[br]] |
| | 282 | |
| | 283 | === 5.3.3 Run === |
| | 284 | {{{ |
| | 285 | Eclipse |
| | 286 | sample > right click WordCount.java > run as ... > run on Hadoop > choose |
| | 287 | |
| | 288 | an existing server from the list below > finish |
| | 289 | }}} |
| | 290 | * A “console” tag will show beside “MapReduce Server” tag. |
| | 291 | |
| | 292 | * While Map Reduce is running, you can visit http://localhost:50030/ to |
| | 293 | |
| | 294 | view that Hadoop is dispatching jobs by Map Reduce. |
| | 295 | |
| | 296 | * After finish, you can go to http://localhost:50060/ to see the result. |
| | 297 | |
| | 298 | |