native_libraries.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="Apache Forrest" name="Generator">
  6. <meta name="Forrest-version" content="0.8">
  7. <meta name="Forrest-skin-name" content="pelt">
  8. <title>Native Hadoop Libraries</title>
  9. <link type="text/css" href="skin/basic.css" rel="stylesheet">
  10. <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
  11. <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
  12. <link type="text/css" href="skin/profile.css" rel="stylesheet">
  13. <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
  14. <link rel="shortcut icon" href="images/favicon.ico">
  15. </head>
  16. <body onload="init()">
  17. <script type="text/javascript">ndeSetTextSize();</script>
  18. <div id="top">
  19. <!--+
  20. |breadtrail
  21. +-->
  22. <div class="breadtrail">
  23. <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  24. </div>
  25. <!--+
  26. |header
  27. +-->
  28. <div class="header">
  29. <!--+
  30. |start group logo
  31. +-->
  32. <div class="grouplogo">
  33. <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
  34. </div>
  35. <!--+
  36. |end group logo
  37. +-->
  38. <!--+
  39. |start Project Logo
  40. +-->
  41. <div class="projectlogo">
  42. <a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
  43. </div>
  44. <!--+
  45. |end Project Logo
  46. +-->
  47. <!--+
  48. |start Search
  49. +-->
  50. <div class="searchbox">
  51. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  52. <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
  53. <input name="Search" value="Search" type="submit">
  54. </form>
  55. </div>
  56. <!--+
  57. |end search
  58. +-->
  59. <!--+
  60. |start Tabs
  61. +-->
  62. <ul id="tabs">
  63. <li>
  64. <a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
  65. </li>
  66. <li>
  67. <a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
  68. </li>
  69. <li class="current">
  70. <a class="selected" href="index.html">Hadoop 0.17 Documentation</a>
  71. </li>
  72. </ul>
  73. <!--+
  74. |end Tabs
  75. +-->
  76. </div>
  77. </div>
  78. <div id="main">
  79. <div id="publishedStrip">
  80. <!--+
  81. |start Subtabs
  82. +-->
  83. <div id="level2tabs"></div>
  84. <!--+
  85. |end Endtabs
  86. +-->
  87. <script type="text/javascript"><!--
  88. document.write("Last Published: " + document.lastModified);
  89. // --></script>
  90. </div>
  91. <!--+
  92. |breadtrail
  93. +-->
  94. <div class="breadtrail">
  95. &nbsp;
  96. </div>
  97. <!--+
  98. |start Menu, mainarea
  99. +-->
  100. <!--+
  101. |start Menu
  102. +-->
  103. <div id="menu">
  104. <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
  105. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  106. <div class="menuitem">
  107. <a href="index.html">Overview</a>
  108. </div>
  109. <div class="menuitem">
  110. <a href="quickstart.html">Quickstart</a>
  111. </div>
  112. <div class="menuitem">
  113. <a href="cluster_setup.html">Cluster Setup</a>
  114. </div>
  115. <div class="menuitem">
  116. <a href="hdfs_design.html">HDFS Architecture</a>
  117. </div>
  118. <div class="menuitem">
  119. <a href="hdfs_user_guide.html">HDFS User Guide</a>
  120. </div>
  121. <div class="menuitem">
  122. <a href="hdfs_shell.html">HDFS Shell Guide</a>
  123. </div>
  124. <div class="menuitem">
  125. <a href="hdfs_permissions_guide.html">HDFS Permissions Guide</a>
  126. </div>
  127. <div class="menuitem">
  128. <a href="mapred_tutorial.html">Map-Reduce Tutorial</a>
  129. </div>
  130. <div class="menupage">
  131. <div class="menupagetitle">Native Hadoop Libraries</div>
  132. </div>
  133. <div class="menuitem">
  134. <a href="streaming.html">Streaming</a>
  135. </div>
  136. <div class="menuitem">
  137. <a href="hod.html">Hadoop On Demand</a>
  138. </div>
  139. <div class="menuitem">
  140. <a href="api/index.html">API Docs</a>
  141. </div>
  142. <div class="menuitem">
  143. <a href="http://wiki.apache.org/hadoop/">Wiki</a>
  144. </div>
  145. <div class="menuitem">
  146. <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
  147. </div>
  148. <div class="menuitem">
  149. <a href="http://hadoop.apache.org/core/mailing_lists.html">Mailing Lists</a>
  150. </div>
  151. <div class="menuitem">
  152. <a href="releasenotes.html">Release Notes</a>
  153. </div>
  154. <div class="menuitem">
  155. <a href="changes.html">All Changes</a>
  156. </div>
  157. </div>
  158. <div id="credit"></div>
  159. <div id="roundbottom">
  160. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  161. <!--+
  162. |alternative credits
  163. +-->
  164. <div id="credit2"></div>
  165. </div>
  166. <!--+
  167. |end Menu
  168. +-->
  169. <!--+
  170. |start content
  171. +-->
  172. <div id="content">
  173. <div title="Portable Document Format" class="pdflink">
  174. <a class="dida" href="native_libraries.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  175. PDF</a>
  176. </div>
  177. <h1>Native Hadoop Libraries</h1>
  178. <div id="minitoc-area">
  179. <ul class="minitoc">
  180. <li>
  181. <a href="#Purpose">Purpose</a>
  182. </li>
  183. <li>
  184. <a href="#Components">Components</a>
  185. </li>
  186. <li>
  187. <a href="#Usage">Usage</a>
  188. </li>
  189. <li>
  190. <a href="#Supported+Platforms">Supported Platforms</a>
  191. </li>
  192. <li>
  193. <a href="#Building+Native+Hadoop+Libraries">Building Native Hadoop Libraries</a>
  194. <ul class="minitoc">
  195. <li>
  196. <a href="#Notes">Notes</a>
  197. </li>
  198. </ul>
  199. </li>
  200. </ul>
  201. </div>
  202. <a name="N1000D"></a><a name="Purpose"></a>
  203. <h2 class="h3">Purpose</h2>
  204. <div class="section">
  205. <p>Hadoop has native implementations of certain components for reasons of
  206. both performace &amp; non-availability of Java implementations. These
  207. components are available in a single, dynamically-linked, native library.
  208. On the *nix platform it is <em>libhadoop.so</em>. This document describes
  209. the usage &amp; details on how to build the native libraries.</p>
  210. </div>
  211. <a name="N1001A"></a><a name="Components"></a>
  212. <h2 class="h3">Components</h2>
  213. <div class="section">
  214. <p>Hadoop currently has the following
  215. <a href="api/org/apache/hadoop/io/compress/CompressionCodec.html">
  216. compression codecs</a> as the native components:</p>
  217. <ul>
  218. <li>
  219. <a href="http://www.zlib.net/">zlib</a>
  220. </li>
  221. <li>
  222. <a href="http://www.gzip.org/">gzip</a>
  223. </li>
  224. <li>
  225. <a href="http://www.oberhumer.com/opensource/lzo/">lzo</a>
  226. </li>
  227. </ul>
  228. <p>Of the above, the availability of native hadoop libraries is imperative
  229. for the lzo and gzip compression codecs to work.</p>
  230. </div>
  231. <a name="N1003D"></a><a name="Usage"></a>
  232. <h2 class="h3">Usage</h2>
  233. <div class="section">
  234. <p>It is fairly simple to use the native hadoop libraries:</p>
  235. <ul>
  236. <li>
  237. Take a look at the
  238. <a href="#Supported+Platforms">supported platforms</a>.
  239. </li>
  240. <li>
  241. Either <a href="http://hadoop.apache.org/core/releases.html#Download">download</a> the pre-built
  242. 32-bit i386-Linux native hadoop libraries (available as part of hadoop
  243. distribution in <span class="codefrag">lib/native</span> directory) or
  244. <a href="#Building+Native+Hadoop+Libraries">build</a> them yourself.
  245. </li>
  246. <li>
  247. Ensure you have either or both of <strong>&gt;zlib-1.2</strong> and
  248. <strong>&gt;lzo2.0</strong> packages for your platform installed;
  249. depending on your needs.
  250. </li>
  251. </ul>
  252. <p>The <span class="codefrag">bin/hadoop</span> script ensures that the native hadoop
  253. library is on the library path via the system property
  254. <em>-Djava.library.path=&lt;path&gt;</em>.</p>
  255. <p>To check everything went alright check the hadoop log files for:</p>
  256. <p>
  257. <span class="codefrag">
  258. DEBUG util.NativeCodeLoader - Trying to load the custom-built
  259. native-hadoop library...
  260. </span>
  261. <br>
  262. <span class="codefrag">
  263. INFO util.NativeCodeLoader - Loaded the native-hadoop library
  264. </span>
  265. </p>
  266. <p>If something goes wrong, then:</p>
  267. <p>
  268. <span class="codefrag">
  269. INFO util.NativeCodeLoader - Unable to load native-hadoop library for
  270. your platform... using builtin-java classes where applicable
  271. </span>
  272. </p>
  273. </div>
  274. <a name="N10087"></a><a name="Supported+Platforms"></a>
  275. <h2 class="h3">Supported Platforms</h2>
  276. <div class="section">
  277. <p>Hadoop native library is supported only on *nix platforms only.
  278. Unfortunately it is known not to work on <a href="http://www.cygwin.com/">Cygwin</a>
  279. and <a href="http://www.apple.com/macosx">Mac OS X</a> and has mainly been used on the
  280. GNU/Linux platform.</p>
  281. <p>It has been tested on the following GNU/Linux distributions:</p>
  282. <ul>
  283. <li>
  284. <a href="http://www.redhat.com/rhel/">RHEL4</a>/<a href="http://fedora.redhat.com/">Fedora</a>
  285. </li>
  286. <li>
  287. <a href="http://www.ubuntu.com/">Ubuntu</a>
  288. </li>
  289. <li>
  290. <a href="http://www.gentoo.org/">Gentoo</a>
  291. </li>
  292. </ul>
  293. <p>On all the above platforms a 32/64 bit Hadoop native library will work
  294. with a respective 32/64 bit jvm.</p>
  295. </div>
  296. <a name="N100B7"></a><a name="Building+Native+Hadoop+Libraries"></a>
  297. <h2 class="h3">Building Native Hadoop Libraries</h2>
  298. <div class="section">
  299. <p>Hadoop native library is written in
  300. <a href="http://en.wikipedia.org/wiki/ANSI_C">ANSI C</a> and built using
  301. the GNU autotools-chain (autoconf, autoheader, automake, autoscan, libtool).
  302. This means it should be straight-forward to build them on any platform with
  303. a standards compliant C compiler and the GNU autotools-chain.
  304. See <a href="#Supported+Platforms">supported platforms</a>.</p>
  305. <p>In particular the various packages you would need on the target
  306. platform are:</p>
  307. <ul>
  308. <li>
  309. C compiler (e.g. <a href="http://gcc.gnu.org/">GNU C Compiler</a>)
  310. </li>
  311. <li>
  312. GNU Autools Chain:
  313. <a href="http://www.gnu.org/software/autoconf/">autoconf</a>,
  314. <a href="http://www.gnu.org/software/automake/">automake</a>,
  315. <a href="http://www.gnu.org/software/libtool/">libtool</a>
  316. </li>
  317. <li>
  318. zlib-development package (stable version &gt;= 1.2.0)
  319. </li>
  320. <li>
  321. lzo-development package (stable version &gt;= 2.0)
  322. </li>
  323. </ul>
  324. <p>Once you have the pre-requisites use the standard <span class="codefrag">build.xml</span>
  325. and pass along the <span class="codefrag">compile.native</span> flag (set to
  326. <span class="codefrag">true</span>) to build the native hadoop library:</p>
  327. <p>
  328. <span class="codefrag">$ ant -Dcompile.native=true &lt;target&gt;</span>
  329. </p>
  330. <p>The native hadoop library is not built by default since not everyone is
  331. interested in building them.</p>
  332. <p>You should see the newly-built native hadoop library in:</p>
  333. <p>
  334. <span class="codefrag">$ build/native/&lt;platform&gt;/lib</span>
  335. </p>
  336. <p>where &lt;platform&gt; is combination of the system-properties:
  337. <span class="codefrag">${os.name}-${os.arch}-${sun.arch.data.model}</span>; for e.g.
  338. Linux-i386-32.</p>
  339. <a name="N1010A"></a><a name="Notes"></a>
  340. <h3 class="h4">Notes</h3>
  341. <ul>
  342. <li>
  343. It is <strong>mandatory</strong> to have both the zlib and lzo
  344. development packages on the target platform for building the
  345. native hadoop library; however for deployment it is sufficient to
  346. install zlib or lzo if you wish to use only one of them.
  347. </li>
  348. <li>
  349. It is necessary to have the correct 32/64 libraries of both zlib/lzo
  350. depending on the 32/64 bit jvm for the target platform for
  351. building/deployment of the native hadoop library.
  352. </li>
  353. </ul>
  354. </div>
  355. </div>
  356. <!--+
  357. |end content
  358. +-->
  359. <div class="clearboth">&nbsp;</div>
  360. </div>
  361. <div id="footer">
  362. <!--+
  363. |start bottomstrip
  364. +-->
  365. <div class="lastmodified">
  366. <script type="text/javascript"><!--
  367. document.write("Last Published: " + document.lastModified);
  368. // --></script>
  369. </div>
  370. <div class="copyright">
  371. Copyright &copy;
  372. 2007 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  373. </div>
  374. <!--+
  375. |end bottomstrip
  376. +-->
  377. </div>
  378. </body>
  379. </html>