Installation and application of Java rocksdb

Rocksdb is an embeddable and persistent key value store.

The following introduction comes from the Chinese official website of rocksdb

https://rocksdb.org.cn/

It has the following four characteristics

1 high performance: rocksdb uses a database engine with log structure. For better performance, this engine is written in C + +. Key and value are byte streams of any size.

2 optimized for fast storage: rocksdb is specially optimized for fast and low latency storage devices (such as flash memory or high-speed hard disk). Rocksdb will maximize the high rate read-write performance of flash memory and ram.

3 adaptability: rocksdb is suitable for many different workload types. From data storage engines like myrocks to application data caching and even some embedded workload, rocksdb can calmly face these different data workload requirements.

4 basic and advanced database operations rocksdb provides some basic operations, such as opening and closing databases. It also provides read-write support for advanced operations such as merge and compression filtering.

Installation and use of rockdb

There are many ways to install rocksdb. Since the official does not provide the binary Library of the corresponding platform, you need to compile and use it yourself.

The installation of rocksdb is simple, but you need to change your view of rocksdb. It is not a weight level database, but an embedded key value storage. This means that as long as you add the rocksdb dependency to your Maven project, you can try it yourself in the development environment. If you don't understand this, you may go into the following two deprecated installation methods.

Method 1: check the official website of rocksdb and find that you need to write a C + + program (not recommended)

Create a database???? Why is it different from the previous MySQL or Mongo? Why doesn't there be a start SH or start Bat and other scripts. Do you want me to write. After writing and compiling, I found that I didn't know how to associate with the rocksdb library and what to do. I forgot all about C + +.

Method 2: use pyrocksdb (not recommended)

http://pyrocksdb.readthedocs.io/en/latest/installation.html

For detailed installation documents, see the installation documents on the official website of pyrocksdb.

The above two methods are friendly to developers familiar with C + + or python, but not very friendly to Java developers.

Next, we will introduce the third way.

Method 3: use Maven (recommended)

Create a maven project and modify POM XML dependency

You can choose the version you like.

Then, the language level of Maven is higher. I set it globally to 1.8

Here, the environment is installed. Is it back to the familiar Java world.

Then, for a class under the copy source code package, modify the running configuration in the IDE, and add a database storage path in the running program to run the test. I will give this class at the end of the article.

Running the console will have log output, and a new file will appear in the file.

Later, we will update more about rockdb development API and its application in production. I hope you will pay attention to it.

The above is all about the installation and application of rocksdb in Java. If you don't understand anything after learning, you can discuss it in the message area below. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>