Skip to content

maylem/libgfapi-jni

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libgfapi-jni

Java Native Interface (JNI) bindings for libgfapi, the GlusterFS client API.

instructions

groundwork

Prerequisites

  • gluster 3.4 or newer - installed from source or a gluster development package installed.
  • maven 3.0.3 or newer
  • auto tool chain
  • Ubuntu packages: build-essential libtool pkg-config automake

Compiling without tests

If you have installed gluster to non-standard location then you export GLFS_HOME so we know where it's at:

export GLFS_HOME=/path/to/gluster/prefix

Building without tests is simple. Just run:

mvn -Pdownlaod -Plinux64 -Dmaven.test.skip=true install

Compiling and Testing

To really test this you'll need a running glusterfs volume called foo.

  • Set up a loopback interface alias, because glusterfs refuses to create a volume with a brick on localhost or 127.0.0.1

      ifconfig lo:0 127.0.2.1
    
  • Create a glusterfs volume called foo

      gluster volume create foo 127.0.2.1:/var/tmp/foo
      gluster volume start foo
    
  • Gluster requires that clients communicate from privileged source ports by default, so we need to disable this feature before testing.

    • First we need to manually fix glusterd. Edit /etc/glusterfs/glusterd.vol and add this line after the other option statements in the volume management stanza

        option rpc-auth-allow-insecure on
      

      Then restart glusterd (or glusterfs-server, as the case may be)

    • Second we need to allow insecure clients to access the bricks

        gluster volume set foo server.allow-insecure on
      
    • Finally, since our clients will not be privileged, we need to make the volume world writable the usual way

        mkdir /mnt/foo
        mount -t glusterfs localhost:foo /mnt/foo
        chmod ugo+rwx /mnt/foo
        umount /mnt/foo
        rmdir /mnt/foo
      
  • Make sure that the gluster libs are on the LD_LIBRARY_PATH.

      export LD_LIBRARY_PATH=${GLUSTER_PREFIX}/lib
    
  • Now run the test

      mvn -Pdownload -Plinux64 install
    
  • If successful, the test will have created a file called bar in the volume, and written hello world into it.

      ls -la /var/tmp/foo
      cat /var/tmp/foo/bar
    
  • There should also be a log file generated by libgfapi in the test program, check it out

      cat glfsjni/glfsjni-linux64/target/glfsjni.log
    

Testing notes

mvn test

After doing a mvn install as described above the test suite can be re-run with the following command run in the top libgfapi-jni directory

mvn -Dnative-src-url=file:glfsjni/target/glfsjni-1.0-SNAPSHOT-native-src.zip -Plinux64 test

When using a test runner in your IDE you'll need to add the following Java system property

-Djava.library.path=glfsjni-linux64/target/native-build/target/lib

Project License

Until further notice (made here and in LICENSE.txt) this project is licensed under the terms of the 3-clause BSD license, as written in LICENSE.txt (and copied in several source files).

The licensing is likely to change in the near future as the project matures.

About

Java Native Interface (JNI) bindings for libgfapi (the GlusterFS client API)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 94.5%
  • C 5.5%