Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

JNoSQL/Diana/Riak

< JNoSQL‎ | Diana
Revision as of 10:59, 18 March 2017 by Otaviopolianasantana.gmail.com (Talk | contribs) (Created page with " == Riak == Riak is a distributed NoSQL key-value data store that offers high availability, fault tolerance, operational simplicity, and scalability. In addition to the open-...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Riak

Riak is a distributed NoSQL key-value data store that offers high availability, fault tolerance, operational simplicity, and scalability. In addition to the open-source version, it comes in a supported enterprise version and a cloud storage version.

Maven Project

To use Redis driver in a Maven Project:

        <dependency>
            <groupId>org.jnosql.diana</groupId>
            <artifactId>riak-driver</artifactId>
            <version>version</version>
        </dependency>

E.g:

        <dependency>
            <groupId>org.jnosql.diana</groupId>
            <artifactId>riak-driver</artifactId>
            <version>0.0.1</version>
        </dependency>


Key Value

The Redis key-value implementation uses the RiakConfiguration to the configuration. This class has configurations methods such as host. Beyond the method also it can read a configuration from diana-riak.properties file.

  • riak-server-host-: The prefix to host. eg: riak-server-host-1= host1

Sample Code

public class App {


    public static void main(String[] args) {

        KeyValueConfiguration configuration = new RiakConfiguration();
        try (BucketManagerFactory managerFactory = configuration.get()) {
            BucketManager bucket = managerFactory.getBucketManager("bucket");
            List<String> list = managerFactory.getList("bucketList", String.class);
            Set<String> set = managerFactory.getSet("bucketSet", String.class);
            Map<String, Integer> map = managerFactory.getMap("bucketList", String.class, Integer.class);
            Queue<String> queue = managerFactory.getQueue("queueList", String.class);
            bucket.put("key", "value");
            Optional<Value> value = bucket.get("key");
        }


    }
}


Links

Back to the top