[NoSQL] Experiments validate Redis snapshots and aof

Source: Internet
Author: User

Installing the configuration Redis http://www.cnblogs.com/myrunning/p/4222385.htmlverifying Redis's master-slave replication http://www.cnblogs.com/myrunning/p/4271167.html1.1 Verifying a Redis snapshot 1.1.1 Modifying a redis configuration file

Here you need to note the path of the snapshot file save the Redis user must have read and write permission, because we are currently using the root user, so there is no problem of insufficient read and write permissions.

1.1.2 Start Redis Service

Check to see if it starts:

1.1.3 View Dump.rdb File

You can learn from the Redis profile that the Redis Snapshot file location is/var/lib/redis.

Log in to Redis authentication:

1.1.4 Testing the Redis snapshot feature

You can see that there are currently two key values in Redis, DCF and ABC, and we set the new value again.

As can be seen from the above diagram, the last time the set entered the key value after the stop service can also be re-obtained, the data is not lost, this is the function of the snapshot. When the Redis service starts, it will read the snapshot files according to the configuration file, load the contents of the snapshot files into memory, prevent the data from being lost, and note that the snapshot loading data is completed once, that is, the data in the snapshot file is loaded into memory at once, if the snapshot file is large, So the load efficiency is very slow, this needs to be noted.

1.2 Verifying Redis AOF1.2.1 Modifying the Redis configuration file

We need to modify the Redis configuration file to open the AOF feature.

1.2.2 Start Redis Service

To view the startup process:

1.2.3 View Appendonly.aof File

Log in to the Redis service to verify:

You can see that when we turn on the AOF feature, the Redis service starts to discover that none of the key values we've saved are there anymore, because when the AOF feature is turned on, The system will first read the appendonly.aof file when it is started, ignoring the Dump.rdb file, so the contents saved in the Dump.rdb file are not loaded into the Redis service.

1.2.4 Test aof function

Use AOF to save some key values:

Now look again at the changes in the Appendonly.aof file:

View Appendonly.aof file Contents:

Turn off the Redis service and view the key values after rebooting:

[NoSQL] Experiments validate Redis snapshots and aof

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.