Geode APIs Compatible with Redis
Note: This feature is experimental and is subject to change in future releases of Apache Geode.
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.
The Geode cluster must have at least one server that is set up to handle the incoming Redis commands.
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
are included, a Geode server with APIs compatible with Redis will be started.
<serverName>with the name of your server.
<locatorPort>with your locator port.
<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.
<compatibleWithRedisBindAddress>with the address of the server host.
<compatibleWithWithRedisPassword>with the password clients use to authenticate.
To confirm the server is listening, run:
redis-cli -h <compatibleWithRedisBindAddress> -p <compatibleWithRedisPort> -a <compatibleWithRedisPassword> ping
<compatibleWithRedisPassword> with the same values as the server.
If the server is functioning properly, you should see a response of
The Geode APIs compatible with Redis currently support the following Redis commands.
- HSCAN 
- INFO 
- SLOWLOG 
Commands not listed above are not implemented.
These commands are supported for Redis 5.
 Redis 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.
 INFO is implemented for the sections and fields listed below:
- redis_mode (always returns “standalone”)
- blocked_clients (always returns 0)
- mem_fragmentation_ratio (always reports 1.00)
- loading (always returns 0)
- rdb_changes_since_last_save (always returns 0)
- rdb_last_save_time (always returns 0)
- evicted_keys (always returns 0)
- rejected_connections (always returns 0)
- returns stats for db: 0
- keys (returns num keys)
- expires (always returns 0)
- avg_ttl (always returns 0)
- returns stats for db: 0
- role (always returns “master”)
- connected_slaves (always returns 0)
- cluster_enabled (always returns 0)
 SLOWLOG is implemented as a NoOp.
Geode’s primary advantage is its scalability. While the Redis server is single threaded, Geode supports high concurrency. Many Redis clients can execute commands on the Geode cluster simultaneously.
Geode’s architecture and management features help detect and resolve network partitioning problems without explicit management on the part of the Redis client.
Keys are expired in two ways, actively and passively:
- With active expiration, expiration is evaluated whenever a key is accessed. If the key is due to expire, it is deleted.
- With passive expiration, keys are evaluated every 3 minutes. If they are due to expire, they are deleted.
Data is stored in a single partitioned region that has one redundant copy. In practice this means that the cluster can tolerate the loss of a single server without the loss of data.
There are a number of events that might occur within the Geode cluster that can result in the cluster closing the connection to the Redis client. Losing the connection to the cluster does not imply that the server is no longer available.
When the connection is lost, the client should attempt to reconnect to the same server before attempting to connect to another server. The Redis client is responsible for knowing the addresses of all servers.
In the case of a connection failure, an invoked command may or may not complete. The Redis client is responsible for deciding if the command should be retried.