-
Notifications
You must be signed in to change notification settings - Fork 683
/
geode_for_redis.html.md.erb
242 lines (168 loc) · 7.07 KB
/
geode_for_redis.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<% set_title(product_name, "for Redis") %>
<%=vars.product_name%> for Redis allows <%=vars.product_name%> to function as a drop-in replacement for a
highly-available Redis data store, letting Redis applications take advantage of
<%=vars.product_name%>’s scaling capabilities without changing their client code. Redis clients connect to a <%=vars.product_name%>
server in the same way they connect to a Redis server, using a hostname and a port number, with
optional password authentication.
<img src="../images_svg/geode_for_redis.svg" class="image" />
## <a id="using-the-api" class="no-quick-link"></a>Using <%=vars.product_name%> for Redis
The <%=vars.product_name%> 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:
```pre
start server \
--name=<serverName> \
--locators=<locatorPort> \
--J=-Dgemfire.geode-for-redis-enabled=true \
--J=-Dgemfire.geode-for-redis-port=<geodeForRedisPort> \
--J=-Dgemfire.geode-for-redis-bind-address=<geodeForRedisBindAddress> \
--J=-Dgemfire.geode-for-redis-password=<geodeForRedisPassword>
```
If the option `geode-for-redis-enabled`, is set to `true`, a <%=vars.product_name%> server with
<%=vars.product_name%> for Redis will be started.
Replace `<serverName>` with the name of your server.
Replace `<locatorPort>` with your locator port.
Replace `<geodeForRedisPort>` with the port that the <%=vars.product_name%> server
listens on for Redis commands. The typical port used with a cluster compatible with Redis is 6379.
Replace `<geodeForRedisBindAddress>` with the address of the server host.
Replace `<geodeForRedisPassword>` with the password clients use to authenticate.
To confirm the server is listening, run:
``` pre
redis-cli -h <geodeForRedisBindAddress> -p <geodeForRedisPort> -a <geodeForRedisPassword> ping
```
Replace `<geodeForRedisBindAddress>`,`<geodeForRedisPort>`, and `<geodeForRedisPassword>` with the same values as the server.
If the server is functioning properly, you should see a response of `PONG`.
## <a id="supported-commands" class="no-quick-link"></a>Supported Redis Commands
<%=vars.product_name%> for Redis supports the following Redis commands.
<br/>
- APPEND <br/>
- AUTH <br/>
- DECR <br/>
- DECRBY <br/>
- DEL <br/>
- EXISTS <br/>
- EXPIRE <br/>
- EXPIREAT <br/>
- GET <br/>
- GETRANGE <br/>
- HDEL <br/>
- HEXISTS <br/>
- HGET <br/>
- HGETALL <br/>
- HINCRBY <br/>
- HINCRBYFLOAT <br/>
- HLEN <br/>
- HMGET <br/>
- HMSET <br/>
- HSCAN **[1]** <br/>
- HSET <br/>
- HSETNX <br/>
- HSTRLEN <br/>
- HVALS <br/>
- HKEYS <br/>
- INCR <br/>
- INCRBY <br/>
- INCRBYFLOAT <br/>
- INFO **[2]** <br/>
- KEYS <br/>
- MGET <br/>
- PERSIST <br/>
- PEXPIRE <br/>
- PEXPIREAT <br/>
- PING <br/>
- PSUBSCRIBE <br/>
- PTTL <br/>
- PUBLISH <br/>
- PUNSUBSCRIBE <br/>
- QUIT <br/>
- RENAME <br/>
- SADD <br/>
- SCARD <br/>
- SDIFF <br/>
- SISMEMBER <br/>
- SET <br/>
- SETNX <br/>
- SLOWLOG **[3]** <br/>
- SMEMBERS <br/>
- SREM <br/>
- STRLEN <br/>
- SUBSCRIBE <br/>
- TTL <br/>
- TYPE <br/>
- UNSUBSCRIBE <br/>
<br/>
Commands not listed above are **not implemented**.
<br/>
**NOTES:**
These commands are supported for Redis 5.
**[1]** Redis accepts 64-bit signed integers for the HSCAN cursor and COUNT parameters.
<%=vars.product_name%> for Redis is 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)
**[3]** SLOWLOG is implemented as a NoOp.
## <a id="advantages-over-redis" class="no-quick-link"></a>Advantages of <%=vars.product_name%> over Redis
<%=vars.product_name%>’s primary advantage is its **scalability**. While the Redis server is single threaded, <%=vars.product_name%> supports high concurrency. Many Redis clients can execute commands on the <%=vars.product_name%> cluster simultaneously.
<%=vars.product_name%>'s architecture and management features help detect and resolve **network partitioning** problems without explicit management on the part of the Redis client.
## <a id="expiration-accuracy" class="no-quick-link"></a>Expiration Accuracy
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. Active expiration is accurate to the millisecond.
- With passive expiration, keys are evaluated every second. If they are due to expire, they are deleted. Passive expiration is accurate to the second.
## <a id="high-availability-model" class="no-quick-link"></a>High Availability Model
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.
## <a id="loss-of-connections" class="no-quick-link"></a>Loss of Connections
There are a number of events that might occur within the <%=vars.product_name%> 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.