This example demonstrates simple operations on a Geode for Redis cluster using the Jedis Client. For more information on starting and configuring a Geode for Redis cluster, please refer to the Geode documentation for Geode for Redis.
In this example, two servers are started with geode-for-redis enabled, some data is added to the cluster using the Jedis client.
This example assumes that Java and Geode are installed.
Set directory geode-examples/geodeForRedis
to be the current working directory. Each step in this example specifies paths relative to that directory.
Build the example
$ ../gradlew build
Run a script that starts a locator and two servers with geode-for-redis enabled.
$ ../gradlew start
Run the example to populate the cluster with some initial leaderboard data, increment the scores associated with each member, then remove the lowest scoring member, printing the contents of the leaderboard at each step.
$ ../gradlew run
If you do not have redis-cli
installed, follow the “Installing Redis” instructions at: https://redis.io/topics/quickstart
Start the redis-cli
in cluster mode, specifying the port used to start the geode-for-redis server:
$ redis-cli -c -p 6379
Experiment with other commands:
$ set stringKey aString OK $ get stringKey "aString" $ append stringKey WithAppendedData (integer) 23 $ get stringKey "aStringWithAppendedData" $ del stringKey (integer) 1 $ get stringKey (nil)
Other supported commands can be listed using the COMMAND
command.
Shut down the cluster:
$ ../gradlew stop
If desired, clean up the generated directories containing logs:
$ ../gradlew cleanServer