Open biett0 opened 6 years ago
You need to have the libgfapi C library installed, usually from your distro's glusterfs packages.
Thank you very much for you reply, so I think is mandatory a unix/linux environment, not windows right?
If the libgfapi C library works on windows, then the libgfapi-jni library could be built to link with it. I don't know if libgfapi supports windows.
Thank you very much! I installed libgfapi on linux machine and tried to create a new file (not existing), but seems it's not working. No error log on gluster machine.
gluster://10.192.2.6:myvolume/test2 Cannot create file! java.nio.file.FileAlreadyExistsException: /test2 at com.peircean.glusterfs.GlusterFileChannel.init(GlusterFileChannel.java:78)
I haven't worked on this project in a few years so I may not be much help here. I would check the following...
Good luck.
Hi @louiszuckerman
I am trying to apply the gluster library on k8s running pod And i've upgrade dockerio/openjdk:8 with the following dockerfile:
FROM docker.io/openjdk:8
RUN apt-get update
RUN apt-get install glusterfs-server -y
I think that installing glusterfs-server , commons are included ...
Into the pod we find :
root@67b0ae436f25:/usr/include/glusterfs# ls
api cluster-syncop.h defaults.h gfchangelog glusterfs.h libglusterfs-messages.h mem-types.h rot-buffs.h strfd.h trie.h
byte-order.h common-utils.h dict.h gfdb graph-utils.h list.h options.h rpc syncop-utils.h tw.h
call-stub.h compat-errno.h event-history.h gidcache.h hashfn.h lkowner.h parse-utils.h run.h syncop.h upcall-utils.h
changelog.h compat-uuid.h event.h glfs-message-id.h iatt.h locking.h quota-common-utils.h server syscall.h xlator.h
checksum.h compat.h fd-lk.h globals.h inode.h logging.h rbthash.h stack.h template-component-messages.h y.tab.h
circ-buff.h daemon.h fd.h glusterfs-acl.h iobuf.h lvm-defaults.h refcount.h statedump.h timer.h
client_t.h default-args.h gf-dirent.h glusterfs-fops.h latency.h mem-pool.h revision.h store.h timespec.h
And
root@67b0ae436f25:~# find / -name libgfapi* -print
find: ‘/proc/1/map_files’: Operation not permitted
find: ‘/proc/19/map_files’: Operation not permitted
/usr/lib/x86_64-linux-gnu/libgfapi.so
/usr/lib/x86_64-linux-gnu/libgfapi.so.0
/usr/lib/x86_64-linux-gnu/libgfapi.la
/usr/lib/x86_64-linux-gnu/libgfapi.so.0.0.0
Do we need to config GLFS_HOME , which dicrectory??
export GLFS_HOME=/usr/lib/x86_64-linux-gnu
Running glusterfs example into a pod, we got the following error:
Picked up JAVA_TOOL_OPTIONS: -Xmx1024m -Xms1024m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Duser.timezone=Europe/Madrid -XX:-TieredCompilation -XX:TieredStopAtLevel=1 -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -Xverify:none -XX:+AggressiveOpts -XX:+UseG1GC -XX:+UseStringDeduplication
sun.nio.fs.LinuxFileSystemProvider@1d81eb93
com.sun.nio.zipfs.ZipFileSystemProvider@7291c18f
com.peircean.glusterfs.GlusterFileSystemProvider@34a245ab
gluster://10.0.1.213:gv0/
Exception in thread "main" java.lang.IllegalArgumentException: Failed to initialize glusterfs client: 10.0.1.213:gv0
at com.peircean.glusterfs.GlusterFileSystemProvider.glfsInit(GlusterFileSystemProvider.java:87)
at com.peircean.glusterfs.GlusterFileSystemProvider.newFileSystem(GlusterFileSystemProvider.java:47)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
at mk.task.adobe.analitycs.AdobeAnalyticsApplication.writeFile2Gluster(AdobeAnalyticsApplication.java:56)
at mk.task.adobe.analitycs.AdobeAnalyticsApplication.main(AdobeAnalyticsApplication.java:32)
The code is:
public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException {
Properties properties = new Properties();
properties.load(Example.class.getClassLoader().getResourceAsStream("example.properties"));
String vagrantBox ="10.0.1.213" ;// properties.getProperty("glusterfs.server");
String volname ="gv0" ;//properties.getProperty("glusterfs.volume");
System.out.println(getProvider("gluster").toString());
String mountUri = "gluster://" + vagrantBox + ":" + volname + "/";
String testUri = "gluster://" + vagrantBox + ":" + volname + "/baz";
Path mountPath = Paths.get(new URI(mountUri));
// Failed to run the following
--> FileSystem fileSystem = FileSystems.newFileSystem(new URI(mountUri), null);<--
FileStore store = fileSystem.getFileStores().iterator().next();
But, running from bash shell,
[ec2-user@k8s-master glusterfs-java-filesystem-example]$ mvn exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] ------< com.peircean.glusterfs:glusterfs-java-filesystem-example >------
[INFO] Building glusterfs-java-filesystem-example 1.0.5-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) @ glusterfs-java-filesystem-example ---
sun.nio.fs.LinuxFileSystemProvider@2503dbd3
com.sun.nio.zipfs.ZipFileSystemProvider@4b67cf4d
com.peircean.glusterfs.GlusterFileSystemProvider@7ea987ac
com.peircean.glusterfs.GlusterFileSystemProvider@7ea987ac
TOTAL SPACE: 934953332736
USABLE SPACE: 887356583936
UNALLOCATED SPACE: 934873358336
gluster://10.0.1.213:gv0
class com.peircean.glusterfs.GlusterPath
/baz
gluster://10.0.1.213:gv0
File exists, created at 2019-11-04T16:41:14Z
SIZE: 13
Hello, world! == Hello, world!
Last modified: 2019-11-04T17:04:27Z (should be now)
Can read & write file
Can't execute file, that's good.
can we install the gluster client into all k8s nodes?
Hi all, I created a new project by importing glusterfs-java-filesystem-1.0.4.jar, libgfapi-jni-1.0.4.jar and hawtjni-runtime-1.9.jar jars, and by following the Example.java class, but I get the following message error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no libgfapi-jni in java.library.path] at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182) at org.fusesource.hawtjni.runtime.Library.load(Library.java:140) at com.peircean.libgfapi_jni.internal.GLFS.(GLFS.java:52)
at com.peircean.glusterfs.GlusterFileSystemProvider.glfsNew(GlusterFileSystemProvider.java:70)
at com.peircean.glusterfs.GlusterFileSystemProvider.newFileSystem(GlusterFileSystemProvider.java:43)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
at com.gpi.gluster.GlusterConnector.main(GlusterConnector.java:50)
Any idea? Thank you very much in advance!