RocksDB JNI gives you a Java interface to the RocksDB C++ library which is an embeddable persistent key-value store for fast storage.
It exposes JNI layer for CRUD operations, merge operators, compaction filters, cache, filter policy, rocksdb specific options etc. Its an ongoing project and some parts of rocksdb like Env, HdfsEnv are yet to be exposed by JNI layer.
For examples, please see DBTest.java class in the repo.
Derived from FuseSource's LevelDB JNI wrapper
The following are instructions to get RocksDB JNI layer running. This has been tested on RHEL 6.1 (2.6.32-131) with GCC 4.7.2.
- git clone https://github.com/ankgup87/hawtjni.git
- cd hawtjni
- mvn install
- wget http://snappy.googlecode.com/files/snappy-1.0.5.tar.gz
- tar -zxvf snappy-1.0.5.tar.gz
- ./configure --disable-shared --with-pic
- make
- sudo make install
- git clone https://github.com/facebook/rocksdb.git
- Add -fPIC flag to CFLAGS and CXXFLAGS in rocksdb/Makefile
- Compile RocksDB as shown on https://github.com/facebook/rocksdb/blob/master/INSTALL.md
- export ROCKSDB_HOME=/path/to/rocksdb
- export SNAPPY_HOME=/path/to/snappy
- git clone https://github.com/ankgup87/rocksdbjni.git
- cd rocksdbjni
- mvn install -P download -P linux64
- Build will break once as Makefile is not setup correctly for c++11 compilation(TODO: fix this.!)
In rocksdbjni-linux64/target/native-build/Makefile, (a) append -std=c++11 to CXX=g++ line
(b) append -DROCKSDB_PLATFORM_POSIX -I${ROCKSDB_HOME} to CXXFLAGS line. (c) Remove all references to "env."
- mvn install -P download -P linux64
JAR files will be present at:
rocksdbjni/target/rocksdbjni-0.1.jar
rocksdbjni-linux64/target/rocksdbjni-linux64-0.1.jar