To run a JNI program on a Hadoop cluster, the first thing to do is to debug the program on a stand-alone computer until the JNI program is properly run, and then porting to the Hadoop cluster is a good deal.
The way Hadoop runs the program is through the jar package, so we need to package all the class files into a jar package. There is no need to include a dynamic link library in the packaging process.
Before running a program in a cluster, Hadoop passes the jar package first to all nodes and then starts running. At this stage, we can pass the dynamic link library as an attachment and a jar package to all nodes at the same time. The method is to specify the-files parameter for the jar command. The order is as follows:
Hadoop jarsegment.jar segment-files./bin/lib***.so Input Output
With this command, both the jar package and the dynamic-link library are passed to all nodes, and then the MapReduce task is started.