You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add warning about RDB to AOF conversion and some other improvements to that documentation section.
Removed section for Redis < 2.2.
Related to redis/redis#12484.
Copy file name to clipboardExpand all lines: docs/management/persistence.md
+16-13Lines changed: 16 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -259,26 +259,30 @@ and starts appending new data into the new file.
259
259
260
260
### How I can switch to AOF, if I'm currently using dump.rdb snapshots?
261
261
262
-
There is a different procedure to do this in version 2.0 and later versions, as you
263
-
can guess it's simpler since Redis 2.2 and does not require a restart at all.
262
+
If you want to enable AOF in a server that is currently using RDB snapshots, you need to convert the data by enabling AOF via CONFIG command on the live server first.
263
+
264
+
**IMPORTANT:** not following this procedure (e.g. just changing the config and restarting the server) can result in data loss!
264
265
265
266
**Redis >= 2.2**
266
267
268
+
Preparations:
269
+
267
270
* Make a backup of your latest dump.rdb file.
268
271
* Transfer this backup to a safe place.
269
-
* Issue the following two commands:
270
-
*`redis-cli config set appendonly yes`
271
-
*`redis-cli config set save ""`
272
-
* Make sure your database contains the same number of keys it contained.
273
-
* Make sure writes are appended to the append only file correctly.
274
272
275
-
The first CONFIG command enables the Append Only File persistence.
273
+
Switch to AOF on live database:
276
274
277
-
The second CONFIG command is used to turn off snapshotting persistence. This is optional, if you wish you can take both the persistence methods enabled.
275
+
* Enable AOF: `redis-cli config set appendonly yes`
276
+
* Optionally disable RDB: `redis-cli config set save ""`
277
+
* Make sure writes are appended to the append only file correctly.
278
+
***IMPORTANT:** Update your `redis.conf` (potentially through `CONFIG REWRITE`) and ensure that it matches the configuration above.
279
+
If you forget this step, when you restart the server, the configuration changes will be lost and the server will start again with the old configuration, resulting in a loss of your data.
280
+
281
+
Next time you restart the server:
278
282
279
-
**IMPORTANT:** remember to edit your redis.conf to turn on the AOF, otherwise
280
-
when you restart the server the configuration changes will be lost and the
281
-
server will start again with the old configuration.
283
+
* Before restarting the server, wait for AOF rewrite to finish persisting the data.
284
+
You can do that by watching `INFO persistence`, waiting for `aof_rewrite_in_progress` and `aof_rewrite_scheduled` to be `0`, and validating that `aof_last_bgrewrite_status` is `ok`.
285
+
* After restarting the server, check that your database contains the same number of keys it contained previously.
282
286
283
287
**Redis 2.0**
284
288
@@ -294,7 +298,6 @@ server will start again with the old configuration.
294
298
295
299
## Interactions between AOF and RDB persistence
296
300
297
-
298
301
Redis >= 2.4 makes sure to avoid triggering an AOF rewrite when an RDB
299
302
snapshotting operation is already in progress, or allowing a `BGSAVE` while the
300
303
AOF rewrite is in progress. This prevents two Redis background processes
0 commit comments