tree: d753a5cdb1f33564ebef7489cedf4a9417e2c6b0 [path history] [tgz]
  1. src/
  2. build.gradle
  3. gfsh.png
  4. README.md
geode-apis-compatible-with-redis/README.md

Apache Geode APIs Compatible with Redis

Note: This feature is experimental and is subject to change in future releases of Apache Geode.

Introduction
How To Try It
Building Apache Geode
Starting a Geode Server with Redis Enabled
Adding an Additional Geode Server Compatible with Redis
Shutting Down
Redis Commands

Introduction

The Geode APIs compatible with Redis allow Geode to function as a drop-in replacement for a highly-available Redis data store, letting Redis applications take advantage of Geode’s scaling capabilities without changing their client code.

Redis clients connect to a Geode server in the same way they connect to a Redis server, using a hostname and a port number, with optional password authentication.

Supported Redis Commands

Not all Redis commands are supported. See Supported Redis Commands for the implemented subset.

How To Try It

Install and configure Geode v1.14 or later.

Use gfsh to start at least one server with a command of the form:

start server \
  --name=<serverName> \
  --locators=<locatorPort> \
  --compatible-with-redis-port=<compatibleWithRedisPort> \
  --compatible-with-redis-bind-address=<compatibleWithRedisBindAddress> \
  --compatible-with-redis-password=<compatibleWithRedisPassword>

If any of the options compatible-with-redis-bind-address, compatible-with-redis-password, or compatible-with-redis-port are included, a Geode server with APIs compatible with Redis will be started.

  • Replace <serverName> with the name of your server.

  • Replace <locatorPort> with your locator port.

  • Replace <compatibleWithRedisPort> with the port that the Geode server listens on for Redis commands. The typical port used with a cluster compatible with Redis is 6379.

  • Replace <compatibleWithRedisBindAddress> with the address of the server host.

  • Replace <compatibleWithWithRedisPassword> with the password clients use to authenticate.

Your Geode instance should now be up and running (1 locator and 1 server) and ready to accept Redis commands.

Keep this terminal open and running so that you can easily shutdown the Geode instance when you are done working locally.

To confirm the server is listening, in a separate terminal run:

redis-cli -h <compatibleWithRedisBindAddress> -p <compatibleWithRedisPort> -a <compatibleWithRedisPassword> ping
  • Replace <compatibleWithRedisBindAddress>, <compatibleWithRedisPort>, and <compatibleWithRedisPassword> with the same values as the server.

If the server is functioning properly, you should see a response of PONG.

Optional - Adding an additional Geode server with compatible with Redis APIS

If you’re interested in testing Geode scalability, in gfsh run the start server command again BUT make sure you change the --name= and --redis-port= parameters.

For example:

$ start server --name=redisServer2 --locators=localhost[10334] --server-port=0 --compatible-with-redis-port=6380

Shutting Down

To shut down the Geode instance you started, in the terminal with gfsh running type the following command

$ shutdown --include-locators=true

This command shuts down the entire Geode instance/cluster. You are prompted with the following choice:

As a lot of data in memory will be lost, including possibly events in queues, do you really want to shutdown the entire distributed system? (Y/n)

To confirm that everything shut down correctly, if you execute a Redis command in the redis-cli you should see the following message:

Could not connect to Redis at 127.0.0.1:6379: Connection refused 
not connected>

Redis Commands

The Geode APIs compatible with Redis implement a subset of the full Redis command set.

Supported Redis Commands Return to top

  • APPEND
  • AUTH
  • DECR
  • DECRBY
  • DEL
  • EXISTS
  • EXPIRE
  • EXPIREAT
  • GET
  • GETRANGE
  • HDEL
  • HEXISTS
  • HGET
  • HGETALL
  • HINCRBY
  • HINCRBYFLOAT
  • HLEN
  • HMGET
  • HMSET
  • HSCAN 1
  • HSET
  • HSETNX
  • HSTRLEN
  • HVALS
  • HKEYS
  • INCR
  • INCRBY
  • INCRBYFLOAT
  • INFO 2
  • KEYS
  • MGET
  • PERSIST
  • PEXPIRE
  • PEXPIREAT
  • PING
  • PSUBSCRIBE
  • PTTL
  • PUBLISH
  • PUNSUBSCRIBE
  • QUIT
  • RENAME
  • SADD
  • SET
  • SETNX
  • SLOWLOG 3
  • SMEMBERS
  • SREM
  • STRLEN
  • SUBSCRIBE
  • TTL
  • TYPE
  • UNSUBSCRIBE

NOTES:

1Redis accepts 64-bit signed integers for the HSCAN cursor and COUNT parameters. The Geode APIs compatible with Redis are limited to 32-bit integer values for these parameters.
2 INFO is implemented for the sections and fields listed below:

  • clients

    • connected_clients

    • blocked_clients (always returns 0)

  • cluster

    • cluster_enables (always returns 0)
  • keyspace

    • returns stats for db: 0
  • memory

    • maxmemory

    • used_memory

    • mem_fragmentation_ratio (always reports 1.00)

  • persistence

    • loading (always returns 0)

    • rdb_changes_since_last_save (always returns 0)

    • rdb_last_save_time (always returns 0)

  • replication

    • role

    • connected_slaves (always returns 0)

  • server

    • redis_version

    • redis_mode

    • tcp_port

    • uptime_in_seconds

    • uptime_in_days

  • stats

    • total_commands_processed

    • instantaneous_ops_per_sec

    • total_net_input_bytes

    • instantaneous_input_kbps

    • total_connections_received

    • keyspace_hits

    • keyspace_misses

    • evicted_keys (always returns 0)

    • rejected_connections (always returns 0)