Book Image

Learning Redis

By : Vinoo Das
Book Image

Learning Redis

By: Vinoo Das

Overview of this book

Table of Contents (16 chapters)
Learning Redis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Persistence handling in Redis


Redis provides a wide range of options for persisting data. These mechanisms help in deciding what kind of persistence model we need for our data, and that solely depends on the kind of data we want to store in Redis. The four options that we have in Redis are as follows:

  • Persisting via the RDB option

  • Persisting via the AOF option

  • Persisting via combination of AOF and RDB option

  • Not persisting at all

Let's run a simple program and see the importance of persistence mechanism, because then only we can appreciate the importance of persistence. Follow the steps and see for yourself how lack of persistence can cause data loss:

  1. Start your Redis server.

  2. Open a Redis client command prompt.

  3. Execute the command SET msg 'temporary value'.

  4. Quickly kill the Redis server manually, either by Kill-9 option in Linux or through close option in Command Prompt in windows.

  5. Restart your Redis server.

  6. Execute the command get msg.

    Get msg without persistence handling

Persisting via the RDB option...