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.
Not all Redis commands are supported. See Supported Redis Commands for the implemented subset.
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
<compatibleWithRedisBindAddress>
, <compatibleWithRedisPort>
, and <compatibleWithRedisPassword>
with the same values as the server.If the server is functioning properly, you should see a response of PONG
.
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
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>
The Geode APIs compatible with Redis implement a subset of the full Redis command set.
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
keyspace
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)