在使用java编写hadoop处理程序时遇到了,java使用依赖的第三方libxx.so库的情况,找到了一种可行的方法,记录一下,希望对别人也有帮助;
加入需要使用的lib库为libxxx.so
1.先将该库放到hdfs中. /user/xx/libxxx.so
2.在java代码中添加如下代码
DistributedCache.addCacheFile(new URI("hdfs://hdfsip:port/user/xx/libxxx.so#libxxx.so")); DistributedCache.createSymLink(conf);