Open Web site tip: misconf Redis is configured to save RDB

Source: Internet
Author: User
Tags redis version inode usage redis server dmesg

1, Problem Description:
To open a Web site with a browser https://www.test.org tip: misconf Redis is configured to save RDB snapshots, but was currently not able to persist O n Disk. Commands that may modify the data set is disabled. Please check Redis logs for details about the error., the specific error is as follows:

2. Environment:
CentOS Environment:
[Email protected] redis]# cat/etc/redhat-release
CentOS Release 6.8 (Final)
[Email protected] redis]#
Redis version:
[Email protected] redis]# redis-server-v
Redis server v=3.0.2 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=76b21ee90041b162
[Email protected] redis]# Redis-server--version
Redis server v=3.0.2 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=76b21ee90041b162
Redis is source-installed:
[Email protected] ~]# cd/usr/local/redis/
[Email protected] redis]# tree
.
├──bin
│?? ├──redis-benchmark
│?? ├──redis-check-aof
│?? ├──redis-check-dump
│?? ├──redis-cli
│?? ├──redis-sentinel-Redis-server
│?? └──redis-server
├──conf
│?? └──redis.conf
├──data
│?? └──dump.rdb
└──logs
└──redis.log

3. Solution
Method 1: Invalid operation
There are two ways to modify it, one is through the Redis command line and the other is to modify the redis.conf configuration file directly

Example of how to modify the command line:
[Email protected] redis]# REDIS-CLI
127.0.0.1:6379> Config set Stop-writes-on-bgsave-error no
Modify the redis.conf file: VI Open the Redis-server configuration of the redis.conf file, and then use the Quick Match mode:/ Stop-writes-on-bgsave-error navigate to the location of the Stop-writes-on-bgsave-error string, and then set the subsequent yes to No.

Method 2: This method is not valid because the machine is already set up.
[Email protected]/]# Cat/etc/sysctl.conf|grep vm.overcommit_memory
Vm.overcommit_memory = 1

    Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk"问题

Today in the program, Jedis put data into the Redis process, "misconf Redis is configured to the save RDB snapshots, but was currently not able-persist on di SK "error;
Then look at the Redis logs and see the error "Can ' t save in Background:fork:Cannot allocate memory", the hint is obvious "the fork process is not enough RAM!" "But there is still more than one g of memory;
After online query, Redis saves data to the hard disk in order to avoid the main process of death, need to fork a master process, and then in the fork process to save the data to the hard disk operation, if the main process uses 4GB of memory, fork sub-process needs additional 4GB, when the memory is not enough, Fork failed, and the data saved the hard drive also failed.
Workaround:
Very simply, follow the prompts (set Vm.overcommit_memory to 1) to:
There are three ways to modify kernel parameters, but to have root privileges:
(1) Edit/etc/sysctl.conf, change Vm.overcommit_memory=1, and sysctl-p make the configuration file effective
(2) Sysctl Vm.overcommit_memory=1
(3) echo 1 >/proc/sys/vm/overcommit_memory

Method 3: Restart the Redis service operation is invalid
Because Redis is installed through the source code, you need to restart Redis by using the shutdown command of the Redis client program REDIS-CLI
[Email protected] redis]# redis-cli-h 127.0.0.1-p 6379 shutdown
(Error) Noauth Authentication required.
The Redis process can only be closed by the kill command at this time
[Email protected] redis]# Ps-ef|grep Redis
Root 36219 1 0 11:19? 00:00:05./bin/redis-server: 6379
Root 40410 39701 0 14:19 pts/7 00:00:00 grep redis
[[email protected] redis]# kill 36129
The kill process number cannot close the Redis process
[Email protected] redis]# Ps-ef|grep Redis
Root 36219 1 0 11:19? 00:00:05./bin/redis-server
: 6379
Root 40410 39701 0 14:19 pts/7 00:00:00 grep redis
Force shutdown of Redis process with kill-9 + process number to force shutdown of Redis process
[Email protected] redis]# kill-9 36129
[Email protected] redis]# Ps-ef|grep Redis
Root 40410 39701 0 14:19 pts/7 00:00:00 grep redis
The Redis process is turned off, and then the configuration file is specified to open the Redis service
[Email protected] redis]#/usr/local/redis/bin/redis-server/usr/local/redis/conf/redis.conf
[Email protected] redis]# Ps-ef|grep Redis
Root 36219 1 0 11:19? 00:00:05/usr/local/redis/bin/redis-server *:6379
Root 40410 39701 0 14:19 pts/7 00:00:00 grep redis
Then open the site https://www.test.org can normally open the site, but less than 1 minutes of the site error is still.

Method 4: View the Redis logs
View the logs Redis.log the last 30 rows directly with tail-30 Redis.log
[Email protected] logs]# Cd/usr/local/redis/logs
[Email protected] logs]# tail-30 Redis.log
2654:m APR 09:57:58.036Background saving started by PID 33756
33756:c APR 09:57:58.037 # Write Error saving DB on Disk:no space left on device
2654:m APR 09:57:58.136 # Background Saving error
2654:m APR 09:58:04.047
Ten changes in seconds. Saving ...
2654:m APR 09:58:04.047Background saving started by PID 33757
33757:c Apr 09:58:04.049 # Write Error saving DB on Disk:no space left on device
2654:m APR 09:58:04.148 # Background Saving error
2654:m APR 09:58:10.056
Ten changes in seconds. Saving ...
2654:m APR 09:58:10.057Background saving started by PID 33758
33758:c APR 09:58:10.058 # Write Error saving DB on Disk:no space left on device
2654:m APR 09:58:10.157 # Background Saving error
2654:m APR 09:58:16.067
Ten changes in seconds. Saving ...
2654:m APR 09:58:16.068Background saving started by PID 33771
33771:c APR 09:58:16.069 # Write Error saving DB on Disk:no space left on device
2654:m APR 09:58:16.168 # Background Saving error
2654:m APR 09:58:22.078
Ten changes in seconds. Saving ...
2654:m APR 09:58:22.079 * Background saving started by PID 33773
33773:c APR 09:58:22.080 # Write Error saving DB on Disk:no space left on device
2654:m APR 09:58:22.179 # Background Saving error
Found this to be a log: Write error saving DB on Disk:no space left on device, disk space is low

View Inode usage: Find inode not exhausted
[Email protected] logs]# df-i
File system Inode Used (i) available (i) used (i) percent mount point
/dev/mapper/vg_yyd-lv_root
512064 122336 389728 24%/
TMPFS 489644 4 489640 1%/DEV/SHM
/DEV/SDA1 128016 127978 1%/boot
/dev/mapper/vg_yyd-lv_home
640848 19358 621490 4%/Home
/DEV/SDB1 6553600 138928 6414672 3%/data
[Email protected] logs]# DF-HT
File system type capacity has been used with available percent mount points
/dev/mapper/vg_yyd-lv_root
Ext4 7.7G 5.5G 1.9G 75%/
Tmpfs tmpfs 1.9G 12K 0 100%/dev/shm
/DEV/SDA1 ext4 485M 40M 420M 9%/boot
/dev/mapper/vg_yyd-lv_home
Ext4 9.7G 1.5G 7.8G 16%/Home
/DEV/SDB1 ext4 99G 15G 80G 16%/data

Check the block usage, the discovery/root disk has been used 100%, the basic has been confirmed that this is the cause.
[Email protected] redis]# DF-HT
File system type capacity has been used with available percent mount points
/dev/mapper/vg_yyd-lv_root
Ext4 7.7G 7.7G 0 100%/
Tmpfs tmpfs 1.9G 12K 1.9G 1%/DEV/SHM
/DEV/SDA1 ext4 485M 40M 420M 9%/boot
/dev/mapper/vg_yyd-lv_home
Ext4 9.7G 1.5G 7.8G 16%/Home
/DEV/SDB1 ext4 99G 15G 80G 16%/data
-bash:echo:write Error: There is no space on the device
[Email protected] ~]# Cd/var/log
[Email protected] log]# Du-sh
2.4G.
Looking at the most space-sized files in the/var/log/directory, this shows that/var/log/notification.log is 2.3G in size.
[Email protected] log]# du-sh/var/log/|sort-nr #也可以直接用命令du-sh|sort-nr
2.3g/var/log/notification.log
148k/var/log/anaconda.storage.log
128k/var/log/dracut.log-20160101
128k/var/log/cron
124k/var/log/anaconda.syslog
120k/var/log/cron-20180422
116k/var/log/anaconda.xlog
80k/var/log/secure-20180422
80k/var/log/dmesg.old
76k/var/log/dmesg
40k/var/log/rsyncd.log
36k/var/log/salt
36k/var/log/lastlog
36k/var/log/anaconda.program.log
28k/var/log/anaconda.log
Empty the log file Notification.log, note that at this point must not be deleted, because the log file is likely to be occupied by the service process, although it can be deleted successfully, but the process does not release the file, but also restart the corresponding Service release, so the best way to do this is to empty the log, rather than delete the log.
[Email protected] log]# >notification.log
[Email protected] log]# DF-HT
File system type capacity has been used with available percent mount points
/dev/mapper/vg_yyd-lv_root
Ext4 7.7G 5.5G 1.9G 75%/
Tmpfs tmpfs 1.9G 12K 1.9G 1%/DEV/SHM
/DEV/SDA1 ext4 485M 40M 420M 9%/boot
/dev/mapper/vg_yyd-lv_home
Ext4 9.7G 1.5G 7.8G 16%/Home
/DEV/SDB1 ext4 99G 15G 80G 16%/data
After the log is emptied, the disk already has the space, at this time again opens the website https://www.test.org to be able to open normally.

Open Web site tip: misconf Redis is configured to save RDB

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.