Skip to content

Commit 7e5d39e

Browse files
DEV: fix toc issue on several pages (#525)
* DEV: fix toc issue on several pages * Update content/develop/connect/cli.md Co-authored-by: andy-stark-redis <164213578+andy-stark-redis@users.noreply.github.com> --------- Co-authored-by: andy-stark-redis <164213578+andy-stark-redis@users.noreply.github.com>
1 parent 01c950d commit 7e5d39e

File tree

4 files changed

+47
-79
lines changed

4 files changed

+47
-79
lines changed

content/develop/connect/cli.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ If the target server requires authentication using a client side certificate,
144144
you can specify a certificate and a corresponding private key using `--cert` and
145145
`--key`.
146146

147-
## Getting input from other programs
147+
## Get input from other programs
148148

149149
There are two ways you can use `redis-cli` in order to receive input from other
150150
commands via the standard input. One is to use the target payload as the last argument
@@ -235,7 +235,7 @@ A CSV (Comma Separated Values) output feature exists within `redis-cli` to expor
235235

236236
Note that the `--csv` flag will only work on a single command, not the entirety of a DB as an export.
237237

238-
## Running Lua scripts
238+
## Run Lua scripts
239239

240240
The `redis-cli` has extensive support for using the debugging facility
241241
of Lua scripting, available with Redis 3.2 onwards. For this feature, refer to the [Redis Lua debugger documentation]({{< relref "/develop/interact/programmability/lua-debugging" >}}).
@@ -261,8 +261,7 @@ So `location:hastings:temp` will populate the [`KEYS`]({{< relref "/commands/key
261261
The `--eval` option is useful when writing simple scripts. For more
262262
complex work, the Lua debugger is recommended. It is possible to mix the two approaches, since the debugger can also execute scripts from an external file.
263263

264-
Interactive mode
265-
===
264+
## Interactive mode
266265

267266
We have explored how to use the Redis CLI as a command line program.
268267
This is useful for scripts and certain types of testing, however most
@@ -293,7 +292,7 @@ The prompt updates as the connected server changes or when operating on a databa
293292
127.0.0.1:6379> DBSIZE
294293
(integer) 503
295294

296-
## Handling connections and reconnections
295+
### Handle connections and reconnections
297296

298297
Using the `CONNECT` command in interactive mode makes it possible to connect
299298
to a different instance, by specifying the *hostname* and *port* we want
@@ -346,7 +345,7 @@ testing, but this limitation should be known.
346345

347346
Use the `-t <timeout>` option to specify server timeout in seconds.
348347

349-
## Editing, history, completion and hints
348+
### Editing, history, completion and hints
350349

351350
Because `redis-cli` uses the
352351
[linenoise line editing library](http://github.com/antirez/linenoise), it
@@ -372,7 +371,7 @@ syntax hints. Like command history, this behavior can be turned on and off via t
372371

373372
Reverse history searches, such as `CTRL-R` in terminals, is supported.
374373

375-
## Preferences
374+
### Preferences
376375

377376
There are two ways to customize `redis-cli` behavior. The file `.redisclirc`
378377
in the home directory is loaded by the CLI on startup. You can override the
@@ -387,7 +386,7 @@ can be set, either by typing the command in the CLI or adding it to the
387386
* `:set hints` - enables syntax hints
388387
* `:set nohints` - disables syntax hints
389388

390-
## Running the same command N times
389+
### Run the same command N times
391390

392391
It is possible to run the same command multiple times in interactive mode by prefixing the command
393392
name by a number:
@@ -399,7 +398,7 @@ name by a number:
399398
(integer) 4
400399
(integer) 5
401400

402-
## Showing help about Redis commands
401+
### Show online help for Redis commands
403402

404403
`redis-cli` provides online help for most Redis [commands]({{< relref "/commands" >}}), using the `HELP` command. The command can be used
405404
in two forms:
@@ -433,12 +432,11 @@ For example in order to show help for the [`PFADD`]({{< relref "/commands/pfadd"
433432

434433
Note that `HELP` supports TAB completion as well.
435434

436-
## Clearing the terminal screen
435+
### Clear the terminal screen
437436

438437
Using the `CLEAR` command in interactive mode clears the terminal's screen.
439438

440-
Special modes of operation
441-
===
439+
## Special modes of operation
442440

443441
So far we saw two main modes of `redis-cli`.
444442

@@ -460,7 +458,7 @@ are explained in the next sections:
460458
* Simulating [LRU]({{< relref "/develop/reference/eviction" >}}) workloads for showing stats about keys hits.
461459
* A client for the Lua debugger.
462460

463-
## Continuous stats mode
461+
### Continuous stats mode
464462

465463
Continuous stats mode is probably one of the lesser known yet very useful features of `redis-cli` to monitor Redis instances in real time. To enable this mode, the `--stat` option is used.
466464
The output is very clear about the behavior of the CLI in this mode:
@@ -547,7 +545,7 @@ The `--memkeys` option now works on cluster replicas.
547545

548546
You can use the `--keystats` and `--keystats-samples` options to combine `--memkeys` and `--bigkeys` with additional distribution data.
549547

550-
## Getting a list of keys
548+
## Get a list of keys
551549

552550
It is also possible to scan the key space, again in a way that does not
553551
block the Redis server (which does happen when you use a command
@@ -624,7 +622,7 @@ When another client publishes some message in some channel, such as with the com
624622
This is very useful for debugging Pub/Sub issues.
625623
To exit the Pub/Sub mode just process `CTRL-C`.
626624

627-
## Monitoring commands executed in Redis
625+
## Monitor commands executed in Redis
628626

629627
Similarly to the Pub/Sub mode, the monitoring mode is entered automatically
630628
once you use the [`MONITOR`]({{< relref "/commands/monitor" >}}) command. All commands received by the active Redis instance will be printed to the standard output:
@@ -637,7 +635,7 @@ once you use the [`MONITOR`]({{< relref "/commands/monitor" >}}) command. All co
637635
Note that it is possible to pipe the output, so you can monitor
638636
for specific patterns using tools such as `grep`.
639637

640-
## Monitoring the latency of Redis instances
638+
## Monitor the latency of Redis instances
641639

642640
Redis is often used in contexts where latency is very critical. Latency
643641
involves multiple moving parts within the application, from the client library
@@ -765,7 +763,7 @@ If you think some of the commands are not replicated correctly in your replicas
765763
this is a good way to check what's happening, and also useful information
766764
in order to improve the bug report.
767765

768-
## Performing an LRU simulation
766+
## Perform an LRU simulation
769767

770768
Redis is often used as a cache with [LRU eviction]({{< relref "/develop/reference/eviction" >}}).
771769
Depending on the number of keys and the amount of memory allocated for the

content/develop/reference/modules/modules-native-types.md

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ categories:
99
- oss
1010
- kubernetes
1111
- clients
12-
description: 'How to use native types in a Redis module
13-
14-
'
12+
description: How to use native types in a Redis module
1513
linkTitle: Native types API
1614
title: Modules API for native types
1715
weight: 1
@@ -34,8 +32,7 @@ the API exported by the Redis modules system in order to create new data
3432
structures and handle the serialization in RDB files, the rewriting process
3533
in AOF, the type reporting via the [`TYPE`]({{< relref "/commands/type" >}}) command, and so forth.
3634

37-
Overview of native types
38-
---
35+
## Overview of native types
3936

4037
A module exporting a native type is composed of the following main parts:
4138

@@ -51,8 +48,7 @@ is available inside the Redis distribution in the `/modules/hellotype.c` file.
5148
The reader is encouraged to read the documentation by looking at this example
5249
implementation to see how things are applied in the practice.
5350

54-
Registering a new data type
55-
===
51+
## Register a new data type
5652

5753
In order to register a new native type into the Redis core, the module needs
5854
to declare a global variable that will hold a reference to the data type.
@@ -134,11 +130,7 @@ registration function: `rdb_load`, `rdb_save`, `aof_rewrite`, `digest` and
134130
* `mem_usage` is called when the [`MEMORY`]({{< relref "/commands/memory" >}}) command asks for the total memory consumed by a specific key, and is used in order to get the amount of bytes used by the module value.
135131
* `free` is called when a key with the module native type is deleted via [`DEL`]({{< relref "/commands/del" >}}) or in any other mean, in order to let the module reclaim the memory associated with such a value.
136132

137-
Ok, but *why* modules types require a 9 characters name?
138-
---
139-
140-
Oh, I understand you need to understand this, so here is a very specific
141-
explanation.
133+
### Why module types require nine character names
142134

143135
When Redis persists to RDB files, modules specific data types require to
144136
be persisted as well. Now RDB files are sequences of key-value pairs
@@ -186,8 +178,7 @@ we can convert back the 64 bit value into a 9 characters name, and print
186178
an error to the user that includes the module type name! So that she or he
187179
immediately realizes what's wrong.
188180

189-
Setting and getting keys
190-
---
181+
### Set and get keys
191182

192183
After registering our new data type in the `RedisModule_OnLoad()` function,
193184
we also need to be able to set Redis keys having as value our native type.
@@ -254,8 +245,7 @@ key if there is already one:
254245
}
255246
/* Do something with 'data'... */
256247

257-
Free method
258-
---
248+
### Free method
259249

260250
As already mentioned, when Redis needs to free a key holding a native type
261251
value, it needs help from the module in order to release the memory. This
@@ -274,8 +264,7 @@ However a more real world one will call some function that performs a more
274264
complex memory reclaiming, by casting the void pointer to some structure
275265
and freeing all the resources composing the value.
276266

277-
RDB load and save methods
278-
---
267+
### RDB load and save methods
279268

280269
The RDB saving and loading callbacks need to create (and load back) a
281270
representation of the data type on disk. Redis offers a high level API
@@ -352,18 +341,11 @@ Note that while there is no error handling on the API that writes and reads
352341
from disk, still the load callback can return NULL on errors in case what
353342
it reads does not look correct. Redis will just panic in that case.
354343

355-
AOF rewriting
356-
---
344+
### AOF rewriting
357345

358346
void RedisModule_EmitAOF(RedisModuleIO *io, const char *cmdname, const char *fmt, ...);
359347

360-
Handling multiple encodings
361-
---
362-
363-
WORK IN PROGRESS
364-
365-
Allocating memory
366-
---
348+
### Allocate memory
367349

368350
Modules data types should try to use `RedisModule_Alloc()` functions family
369351
in order to allocate, reallocate and release heap memory used to implement the native data structures (see the other Redis Modules documentation for detailed information).

content/develop/reference/sentinel-clients.md

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ A Redis client supporting Sentinel can automatically discover the address of a R
4646

4747
This is the procedure a client should follow in order to obtain the master address starting from the list of Sentinels and the service name.
4848

49-
Step 1: connecting to the first Sentinel
50-
---
49+
### Step 1: connect to the first Sentinel
5150

5251
The client should iterate the list of Sentinel addresses. For every address it should try to connect to the Sentinel, using a short timeout (in the order of a few hundreds of milliseconds). On errors or timeouts the next Sentinel address should be tried.
5352

5453
If all the Sentinel addresses were tried without success, an error should be returned to the client.
5554

5655
The first Sentinel replying to the client request should be put at the start of the list, so that at the next reconnection, we'll try first the Sentinel that was reachable in the previous connection attempt, minimizing latency.
5756

58-
Step 2: ask for master address
59-
---
57+
### Step 2: ask for the master address
6058

6159
Once a connection with a Sentinel is established, the client should retry to execute the following command on the Sentinel:
6260

@@ -71,8 +69,7 @@ The result from this call can be one of the following two replies:
7169

7270
If an ip:port pair is received, this address should be used to connect to the Redis master. Otherwise if a null reply is received, the client should try the next Sentinel in the list.
7371

74-
Step 3: call the ROLE command in the target instance
75-
---
72+
### Step 3: call the ROLE command in the target instance
7673

7774
Once the client discovered the address of the master instance, it should
7875
attempt a connection with the master, and call the [`ROLE`]({{< relref "/commands/role" >}}) command in order
@@ -82,8 +79,7 @@ If the [`ROLE`]({{< relref "/commands/role" >}}) commands is not available (it w
8279

8380
If the instance is not a master as expected, the client should wait a short amount of time (a few hundreds of milliseconds) and should try again starting from Step 1.
8481

85-
Handling reconnections
86-
===
82+
## Handle reconnections
8783

8884
Once the service name is resolved into the master address and a connection is established with the Redis master instance, every time a reconnection is needed, the client should resolve again the address using Sentinels restarting from Step 1. For instance Sentinel should contacted again the following cases:
8985

@@ -92,8 +88,7 @@ Once the service name is resolved into the master address and a connection is es
9288

9389
In the above cases and any other case where the client lost the connection with the Redis server, the client should resolve the master address again.
9490

95-
Sentinel failover disconnection
96-
===
91+
## Sentinel failover disconnection
9792

9893
Starting with Redis 2.8.12, when Redis Sentinel changes the configuration of
9994
an instance, for example promoting a replica to a master, demoting a master to
@@ -107,8 +102,7 @@ If the client will contact a Sentinel with yet not updated information, the veri
107102

108103
Note: it is possible that a stale master returns online at the same time a client contacts a stale Sentinel instance, so the client may connect with a stale master, and yet the ROLE output will match. However when the master is back again Sentinel will try to demote it to replica, triggering a new disconnection. The same reasoning applies to connecting to stale replicas that will get reconfigured to replicate with a different master.
109104

110-
Connecting to replicas
111-
===
105+
## Connect to replicas
112106

113107
Sometimes clients are interested to connect to replicas, for example in order to scale read requests. This protocol supports connecting to replicas by modifying step 2 slightly. Instead of calling the following command:
114108

@@ -124,21 +118,18 @@ Symmetrically the client should verify with the [`ROLE`]({{< relref "/commands/r
124118
instance is actually a replica, in order to avoid scaling read queries with
125119
the master.
126120

127-
Connection pools
128-
===
121+
## Connection pools
129122

130123
For clients implementing connection pools, on reconnection of a single connection, the Sentinel should be contacted again, and in case of a master address change all the existing connections should be closed and connected to the new address.
131124

132-
Error reporting
133-
===
125+
## Error reporting
134126

135127
The client should correctly return the information to the user in case of errors. Specifically:
136128

137129
* If no Sentinel can be contacted (so that the client was never able to get the reply to `SENTINEL get-master-addr-by-name`), an error that clearly states that Redis Sentinel is unreachable should be returned.
138130
* If all the Sentinels in the pool replied with a null reply, the user should be informed with an error that Sentinels don't know this master name.
139131

140-
Sentinels list automatic refresh
141-
===
132+
## Sentinels list automatic refresh
142133

143134
Optionally once a successful reply to `get-master-addr-by-name` is received, a client may update its internal list of Sentinel nodes following this procedure:
144135

@@ -147,8 +138,7 @@ Optionally once a successful reply to `get-master-addr-by-name` is received, a c
147138

148139
It is not needed for a client to be able to make the list persistent updating its own configuration. The ability to upgrade the in-memory representation of the list of Sentinels can be already useful to improve reliability.
149140

150-
Subscribe to Sentinel events to improve responsiveness
151-
===
141+
## Subscribe to Sentinel events to improve responsiveness
152142

153143
The [Sentinel documentation]({{< relref "/operate/oss_and_stack/management/sentinel" >}}) shows how clients can connect to
154144
Sentinel instances using Pub/Sub in order to subscribe to changes in the
@@ -163,7 +153,6 @@ However update messages received via Pub/Sub should not substitute the
163153
above procedure, since there is no guarantee that a client is able to
164154
receive all the update messages.
165155

166-
Additional information
167-
===
156+
## Additional information
168157

169158
For additional information or to discuss specific aspects of this guidelines, please drop a message to the [Redis Google Group](https://groups.google.com/group/redis-db).

0 commit comments

Comments
 (0)