Ошибка redis misconf redis

Restart your redis server.

  • macOS (brew): brew services restart redis.
  • Linux: sudo service redis restart / sudo systemctl restart redis
  • Windows: Windows + R -> Type services.msc, Enter -> Search for Redis then click on restart.

I had this issue after upgrading redis with Brew (brew upgrade).

Once I restarted my laptop, it immediately worked.

answered Dec 18, 2019 at 12:27

Erowlin's user avatar

9

Using redis-cli, you can stop it trying to save the snapshot:

config set stop-writes-on-bgsave-error no

This is a quick workaround, but if you care about the data you are using it for, you should check to make sure why bgsave failed in first place.

Stephan Vierkant's user avatar

answered Jan 31, 2014 at 15:54

思考zhe's user avatar

思考zhe思考zhe

5,3352 gold badges13 silver badges9 bronze badges

10

In case you encounter the error and some important data cannot be discarded on the running redis instance (problems with permissions for the rdb file or its directory incorrectly, or running out of disk space), you can always redirect the rdb file to be written somewhere else.

Using redis-cli, you can do something like this:

CONFIG SET dir /tmp/some/directory/other/than/var
CONFIG SET dbfilename temp.rdb

After this, you might want to execute a BGSAVE command to make sure that the data will be written to the rdb file. Make sure that when you execute INFO persistence, bgsave_in_progress is already 0 and rdb_last_bgsave_status is ok. After that, you can now start backing up the generated rdb file somewhere safe.

answered Oct 30, 2013 at 3:41

Axel Advento's user avatar

Axel AdventoAxel Advento

2,9953 gold badges24 silver badges32 bronze badges

8

There might be errors during the bgsave process due to low memory. Try this (from redis background save FAQ)

echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
sysctl vm.overcommit_memory=1

answered Dec 13, 2013 at 22:37

Chris's user avatar

ChrisChris

1,5221 gold badge12 silver badges19 bronze badges

1

This error occurs because of BGSAVE being failed. During BGSAVE, Redis forks a child process to save the data on disk. Although exact reason for failure of BGSAVE can be checked from logs (usually at /var/log/redis/redis-server.log on linux machines) but a lot of the times BGAVE fails because the fork can’t allocate memory. Many times the fork fails to allocate memory (although the machine has enough RAM available) because of a conflicting optimization by the OS.

As can be read from Redis FAQ:

Redis background saving schema relies on the copy-on-write semantic of fork in modern operating systems: Redis forks (creates a child process) that is an exact copy of the parent. The child process dumps the DB on disk and finally exits. In theory the child should use as much memory as the parent being a copy, but actually thanks to the copy-on-write semantic implemented by most modern operating systems the parent and child process will share the common memory pages. A page will be duplicated only when it changes in the child or in the parent. Since in theory all the pages may change while the child process is saving, Linux can’t tell in advance how much memory the child will take, so if the overcommit_memory setting is set to zero fork will fail unless there is as much free RAM as required to really duplicate all the parent memory pages, with the result that if you have a Redis dataset of 3 GB and just 2 GB of free memory it will fail.

Setting overcommit_memory to 1 says Linux to relax and perform the fork in a more optimistic allocation fashion, and this is indeed what you want for Redis.

Redis doesn’t need as much memory as the OS thinks it does to write to disk, so may pre-emptively fail the fork.

To Resolve this, you can:

Modify /etc/sysctl.conf and add:

vm.overcommit_memory=1

Then restart sysctl with:

On FreeBSD:

sudo /etc/rc.d/sysctl reload

On Linux:

sudo sysctl -p /etc/sysctl.conf

Community's user avatar

answered Apr 15, 2018 at 6:42

Bhindi's user avatar

BhindiBhindi

1,37311 silver badges16 bronze badges

4

In my case, it was just the privileges that I needed to allow for Redis to accept the incoming request.

So I restarted the Redis service via Homebrew brew services stop redis and brew services start redis and run the Redis server locally redis-server. The command prompt asked me to allow the incoming request and it started working.

answered May 16, 2022 at 10:23

Touseef Murtaza's user avatar

1

in case you are working on a linux machine, also recheck the file and folder permissions of the database.

The db and the path to it can be obtained via:

in redis-cli:

CONFIG GET dir

CONFIG GET dbfilename

and in the commandline ls -l. The permissions for the directory should be 755, and those for the file should be 644. Also, normally redis-server executes as the user redis, therefore its also nice to give the user redis the ownership of the folder by executing sudo chown -R redis:redis /path/to/rdb/folder. This has been elaborated in the answer here.

Community's user avatar

answered Jul 13, 2014 at 18:26

smilee89's user avatar

smilee89smilee89

5335 silver badges9 bronze badges

1

If you’re running MacOS and have recently upgraded to Catalina, you may need to run brew services restart redis as suggested in this issue.

answered Nov 11, 2019 at 5:30

Fush's user avatar

FushFush

2,46921 silver badges19 bronze badges

Thanks everyone for checking the problem, apparently the error was produced during bgsave.

For me, typing config set stop-writes-on-bgsave-error no in a shell and restarting Redis solved the problem.

answered Oct 25, 2013 at 4:45

Salvador Dali's user avatar

Salvador DaliSalvador Dali

213k147 gold badges698 silver badges752 bronze badges

5

Start Redis Server in a directory where Redis has write permissions

The answers above will definitely solve your problem, but here’s what’s actually going on:

The default location for storing the rdb.dump file is ./ (denoting current directory). You can verify this in your redis.conf file. Therefore, the directory from where you start the redis server is where a dump.rdb file will be created and updated.

It seems you have started running the redis server in a directory where redis does not have the correct permissions to create the dump.rdb file.

To make matters worse, redis will also probably not allow you to shut down the server either until it is able to create the rdb file to ensure the proper saving of data.

To solve this problem, you must go into the active redis client environment using redis-cli and update the dir key and set its value to your project folder or any folder where non-root has permissions to save. Then run BGSAVE to invoke the creation of the dump.rdb file.

CONFIG SET dir "/hardcoded/path/to/your/project/folder"
BGSAVE

(Now, if you need to save the dump.rdb file in the directory that you started the server in, then you will need to change permissions for the directory so that redis can write to it. You can search stackoverflow for how to do that).

You should now be able to shut down the redis server. Note that we hardcoded the path. Hardcoding is rarely a good practice and I highly recommend starting the redis server from your project directory and changing the dir key back to./`.

CONFIG SET dir "./"
BGSAVE

That way when you need redis for another project, the dump file will be created in your current project’s directory and not in the hardcoded path’s project directory.

answered Sep 23, 2017 at 19:57

Govind Rai's user avatar

Govind RaiGovind Rai

14.2k9 gold badges70 silver badges83 bronze badges

2

$ redis-cli

config set stop-writes-on-bgsave-error no

According to Redis documentation, this is recommended only if you don’t have RDB snapshots enabled or if you don’t care about data persistence in the snapshots.

«By default Redis will stop accepting writes if RDB snapshots are enabled (at least one save point) and the latest background save failed. This will make the user aware (in a hard way) that data is not persisting on disk properly, otherwise,strong text chances are that no one will notice and some disaster will happen.»

What u should be doing is :

# redis-cli
127.0.0.1:6379> CONFIG SET dir /data/tmp
OK
127.0.0.1:6379> CONFIG SET dbfilename temp.rdb
OK
127.0.0.1:6379> BGSAVE
Background saving started
127.0.0.1:6379>

Please Make sure /data/tmp has enough disk space.

jas's user avatar

jas

10.6k2 gold badges30 silver badges41 bronze badges

answered Mar 4, 2021 at 10:33

Vinayak S.'s user avatar

Vinayak S.Vinayak S.

3722 silver badges7 bronze badges

1

Had encountered this error and was able to figure out from log that the error is because of the disk space not being enough. All the data that was inserted in my case was not needed any longer. So I tried to FLUSHALL. Since redis-rdb-bgsave process was running, it was not allowing to FLUSH the data also. I followed below steps and was able to continue.

  1. Login to redis client
  2. Execute config set stop-writes-on-bgsave-error no
  3. Execute FLUSHALL (Data stored was not needed)
  4. Execute config set stop-writes-on-bgsave-error yes

The process redis-rdb-bgsave was no longer running after the above steps.

answered Sep 4, 2018 at 7:09

RCK's user avatar

RCKRCK

3112 silver badges4 bronze badges

I faced the similar issue, the main reason behind this was the memory(RAM) consumption by redis.
My EC2 machine had 8GB RAM(arounf 7.4 available for consumption)

When my program was running the RAM usage went upto 7.2 GB leaving hardly ~100MB in RAM , this generally triggers the MISCONF Redis error ...

You can determine the RAM consumption using the htop command. Look for the Mem attribute after running htop command. If it shows high consumtion (like in my case it was 7.2GB/7.4GB) It’s better to upgrade the instance’s with larger Memory.
In this scenario using config set stop-writes-on-bgsave-error no will be a disaster for the server and may result in disrupting other services running on the server(if any). So, it better to avoid the config command and UPGRADE YOUR REDIS MACHINE.

FYI: You may need to install htop to make this work : sudo apt-get install htop

One more solution to this can be some other RAM heavy service running on your system, check for other service running on your server/machine/instance and stop it if its not necessary. To check all the services running on your machine use service --status-all

And a suggestion for people directly pasting the config command , please do reasearch a bit and atleast warn the user before using such commands. And as @Rodrigo mentioned in his comment : «It does not look cool to ignore the errors.»

—UPDATE—

YOu can also configure maxmemory and maxmemory-policy to define the behavior of Redis when a specific limit of memory is reached.
For example, if I want to keep the memory limit of 6GB and delete the least recently used keys from the DB to make sure that redis mem usage do not exceed 6GB, then we can set these two parameters (in redis.conf or CONFIG SET command):

maxmemory 6gb
maxmemory-policy allkeys-lru

There are a lot of other values which you can set for these two parameters you can read about this from here: https://redis.io/topics/lru-cache

answered Feb 15, 2019 at 13:57

im_bhatman's user avatar

im_bhatmanim_bhatman

8761 gold badge18 silver badges28 bronze badges

Nowadays the Redis write-access problems that give this error message to the client re-emerged in the official redis docker containers.

Redis from the official redis image tries to write the .rdb file in the containers /data folder, which is rather unfortunate, as it is a root-owned folder and it is a non-persistent location too (data written there will disappear if your container/pod crashes).

So after an hour of inactivity, if you have run your redis container as a non-root user (e.g. docker run -u 1007 rather than default docker run -u 0), you will get a nicely detailed error msg in your server log (see docker logs redis):

1:M 29 Jun 2019 21:11:22.014 * 1 changes in 3600 seconds. Saving...
1:M 29 Jun 2019 21:11:22.015 * Background saving started by pid 499
499:C 29 Jun 2019 21:11:22.015 # Failed opening the RDB file dump.rdb (in server root dir /data) for saving: Permission denied
1:M 29 Jun 2019 21:11:22.115 # Background saving error

So what you need to do is to map container’s /data folder to an external location (where the non-root user, here: 1007, has write access, such as /tmp on the host machine), e.g:

docker run --rm -d --name redis -p 6379:6379 -u 1007 -v /tmp:/data redis

So it is a misconfiguration of the official docker image (which should write to /tmp not /data) that produces this «time bomb» that you will most likely encounter only in production… overnight over some particularly quiet holiday weekend :/

answered Jun 30, 2019 at 8:52

mirekphd's user avatar

mirekphdmirekphd

4,4213 gold badges36 silver badges58 bronze badges

5

for me

config set stop-writes-on-bgsave-error no

and I reload my mac, it works

answered Aug 15, 2019 at 2:33

wuhaiwei's user avatar

wuhaiweiwuhaiwei

911 silver badge2 bronze badges

On redis.conf line ~235 let’s try to change config like this

- stop-writes-on-bgsave-error yes
+ stop-writes-on-bgsave-error no

Dharman's user avatar

Dharman

30.5k22 gold badges85 silver badges133 bronze badges

answered Nov 27, 2020 at 12:14

Binh Ho's user avatar

Binh HoBinh Ho

3,4811 gold badge30 silver badges31 bronze badges

1

A more permanent fix might be to look in /etc/redis/redis.conf around lines 200-250 there are settings for the rdb features, that were not a part of redis back in the 2.x days.

notably

dir ./

can be changed to

dir /home/someuser/redislogfiledirectory

or you could comment out all the save lines, and not worry about persistence. (See the comments in /etc/redis/redis.conf)

Also, don’t forget

service redis-server stop
service redis-server start

answered Sep 19, 2016 at 4:26

Soup Cup's user avatar

Soup CupSoup Cup

1011 silver badge5 bronze badges

1

all of those answers do not explain the reason why the rdb save failed.


as my case, I checked the redis log and found:

14975:M 18 Jun 13:23:07.354 # Background saving terminated by signal 9

run the following command in terminal:

sudo egrep -i -r 'killed process' /var/log/

it display:

/var/log/kern.log.1:Jun 18 13:23:07 10-10-88-16 kernel: [28152358.208108] Killed process 28416 (redis-server) total-vm:7660204kB, anon-rss:2285492kB, file-rss:0kB

that is it! this process(redis save rdb) is killed by OOM killer

refers:

https://github.com/antirez/redis/issues/1886

Finding which process was killed by Linux OOM killer

Community's user avatar

answered Jun 19, 2017 at 3:54

carton.swing's user avatar

carton.swingcarton.swing

1,44717 silver badges12 bronze badges

Yep, this happing because current use does not have the permission to modify the «dump.rdb».

So, instead of creating a new RDB file, You can also give permission to old file(change the ownership of it).

In redis-cli enter:

config get dir

you will get «/usr/local/var/db/redis» (this is the location where redis writes the data)

go to this location using terminal

cd 
cd /usr/local/var/db

Type this command(with our username):

sudo chown -R [username] db

This will change to owner.

This works for me.

answered Jun 11, 2021 at 5:58

krishnkant jaiswal's user avatar

I know this thread is slightly older, but here’s what worked for me when I got this error earlier, knowing I was nowhere near memory limit- both answers were found above.

Hopefully this could help someone in the future if they need it.

  1. Checked CHMOD on dir folder… found somehow the symbolic notation was different. CHMOD dir folder to 755
  2. dbfilename permissions were good, no changes needed
  3. Restarted redis-server
  4. (Should’ve done this first, but ah well) Referenced the redis-server.log and found that the error was the result of access being denied.

Again- unsure how the permissions on the DIR folder got changed, but I’m assuming CHMOD back to 755 and restarting redis-server took care of it as I was able to ping redis server afterwards.

Also- to note, redis did have ownership of the dbfilename and DIR folder.

answered Jun 21, 2020 at 6:14

Dustin's user avatar

I too was facing the same issue. Both the answers (the most upvoted one and the accepted one) just give a temporary fix for the same.

Moreover, the config set stop-writes-on-bgsave-error no is a horrible way to over look this error, since what this option does is stop redis from notifying that writes have been stopped and to move on without writing the data in a snapshot. This is simply ignoring this error.
Refer this

As for setting dir in config in redis-cli, once you restart the redis service, this shall get cleared too and the same error shall pop up again. The default value of dir in redis.conf is ./ , and if you start redis as root user, then ./ is / to which write permissions aren’t granted, and hence the error.

The best way is to set the dir parameter in redis.conf file and set proper permissions to that directory. Most of the debian distributions shall have it in /etc/redis/redis.conf

answered Jun 11, 2018 at 9:03

Mayank Sharma's user avatar

Check your Redis log before taking any action. Some of the solutions in this thread may erase your Redis data, so be careful about what you are doing.

In my case, the machine was running out of RAM. This also can happen when there is no more free disk space on the host.

answered Apr 17, 2020 at 22:24

Erfun's user avatar

ErfunErfun

1,0792 gold badges11 silver badges26 bronze badges

1

After banging my head through so many SO questions finally —
for me @Axel Advento’ s answer worked but with few extra steps —
I was still facing the permission issues.
I had to switch user to redis, create a new dir in it’s home dir and then set it as redis’s dir.

sudo su - redis -s /bin/bash
mkdir redis_dir
redis-cli CONFIG SET dir $(realpath redis_dir)
exit # to logout from redis user (optional)

answered May 2, 2020 at 5:21

markroxor's user avatar

markroxormarkroxor

5,8682 gold badges34 silver badges43 bronze badges

In my Case the Ubuntu Virtual Machine’s Disk space got Full and that’s why I was getting this Error. After deleting some files from the Disk has Solved the Issue.

answered May 29, 2021 at 17:51

Amar Kumar's user avatar

Amar KumarAmar Kumar

2,3242 gold badges25 silver badges33 bronze badges

In case you are using docker/docker-compose and want to prevent redis from writing to file, you can create a redis config and mount into a container

docker.compose.override.yml

  redis:¬
      volumes:¬
        - ./redis.conf:/usr/local/etc/redis/redis.conf¬
      ports:¬
        - 6379:6379¬

You can download the default config from here

in the redis.conf file make sure you comment out these 3 lines

save 900 1
save 300 10
save 60 10000

myou can view more solutions for removing the persistent data here

answered Jun 23, 2019 at 2:05

Nic Wanavit's user avatar

Nic WanavitNic Wanavit

2,2235 gold badges19 silver badges31 bronze badges

I hit this problem while working on a server with AFS disk space because my authentication token had expired, which yielded Permission Denied responses when the redis-server tried to save. I solved this by refreshing my token:

kinit USERNAME_HERE -l 30d && aklog

answered Oct 28, 2017 at 12:44

duhaime's user avatar

duhaimeduhaime

25.2k17 gold badges165 silver badges222 bronze badges

In my case it happened because I just installed redis using the quick way. So redis is not running as root.
I was able to solve this problem by following the instructions under the Installing Redis more properly section of their Quick Start Guide. After doing so, the problem was solved and redis is now running as root. Check it out.

answered Jan 22, 2020 at 7:31

meow2x's user avatar

meow2xmeow2x

2,04622 silver badges27 bronze badges

In my case it was related to disk free space. (you can check it with df -h bash command) when I free some space this error disappeared.

answered Aug 6, 2019 at 6:40

Mohammad Reza Esmaeilzadeh's user avatar

If you are running Redis locally on a windows machine, try to «run as administrator» and see if it works. With me, the problem was that Redis was located in the «Program Files» folder, which restricts permissions by default. As it should.

However, do not automatically run Redis as an administrator You don’t want to grant it more rights that it is supposed to have. You want to solve this by the book.

So, we have been able to quickly identify the problem by running it as an administrator, but this is not the cure. A likely scenario is that you have put Redis in a folder that doesn’t have write rights and as a consequence the DB file is stored in that same location.

You can solve this by opening the redis.windows.conf and to search for the following configuration:

    # The working directory.
    #
    # The DB will be written inside this directory, with the filename specified
    # above using the 'dbfilename' configuration directive.
    #
    # The Append Only File will also be created inside this directory.
    #
    # Note that you must specify a directory here, not a file name.
    dir ./

Change dir ./ to a path you have regular read/write permissions for

You could also just move the Redis folder in it’s entirety to a folder you know has the right permissions.

Aurelio's user avatar

Aurelio

24.5k9 gold badges59 silver badges63 bronze badges

answered Jun 19, 2018 at 8:54

Pascalculator's user avatar

PascalculatorPascalculator

8701 gold badge10 silver badges17 bronze badges

Restart your redis server.

  • macOS (brew): brew services restart redis.
  • Linux: sudo service redis restart / sudo systemctl restart redis
  • Windows: Windows + R -> Type services.msc, Enter -> Search for Redis then click on restart.

I had this issue after upgrading redis with Brew (brew upgrade).

Once I restarted my laptop, it immediately worked.

answered Dec 18, 2019 at 12:27

Erowlin's user avatar

9

Using redis-cli, you can stop it trying to save the snapshot:

config set stop-writes-on-bgsave-error no

This is a quick workaround, but if you care about the data you are using it for, you should check to make sure why bgsave failed in first place.

Stephan Vierkant's user avatar

answered Jan 31, 2014 at 15:54

思考zhe's user avatar

思考zhe思考zhe

5,3352 gold badges13 silver badges9 bronze badges

10

In case you encounter the error and some important data cannot be discarded on the running redis instance (problems with permissions for the rdb file or its directory incorrectly, or running out of disk space), you can always redirect the rdb file to be written somewhere else.

Using redis-cli, you can do something like this:

CONFIG SET dir /tmp/some/directory/other/than/var
CONFIG SET dbfilename temp.rdb

After this, you might want to execute a BGSAVE command to make sure that the data will be written to the rdb file. Make sure that when you execute INFO persistence, bgsave_in_progress is already 0 and rdb_last_bgsave_status is ok. After that, you can now start backing up the generated rdb file somewhere safe.

answered Oct 30, 2013 at 3:41

Axel Advento's user avatar

Axel AdventoAxel Advento

2,9953 gold badges24 silver badges32 bronze badges

8

There might be errors during the bgsave process due to low memory. Try this (from redis background save FAQ)

echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
sysctl vm.overcommit_memory=1

answered Dec 13, 2013 at 22:37

Chris's user avatar

ChrisChris

1,5221 gold badge12 silver badges19 bronze badges

1

This error occurs because of BGSAVE being failed. During BGSAVE, Redis forks a child process to save the data on disk. Although exact reason for failure of BGSAVE can be checked from logs (usually at /var/log/redis/redis-server.log on linux machines) but a lot of the times BGAVE fails because the fork can’t allocate memory. Many times the fork fails to allocate memory (although the machine has enough RAM available) because of a conflicting optimization by the OS.

As can be read from Redis FAQ:

Redis background saving schema relies on the copy-on-write semantic of fork in modern operating systems: Redis forks (creates a child process) that is an exact copy of the parent. The child process dumps the DB on disk and finally exits. In theory the child should use as much memory as the parent being a copy, but actually thanks to the copy-on-write semantic implemented by most modern operating systems the parent and child process will share the common memory pages. A page will be duplicated only when it changes in the child or in the parent. Since in theory all the pages may change while the child process is saving, Linux can’t tell in advance how much memory the child will take, so if the overcommit_memory setting is set to zero fork will fail unless there is as much free RAM as required to really duplicate all the parent memory pages, with the result that if you have a Redis dataset of 3 GB and just 2 GB of free memory it will fail.

Setting overcommit_memory to 1 says Linux to relax and perform the fork in a more optimistic allocation fashion, and this is indeed what you want for Redis.

Redis doesn’t need as much memory as the OS thinks it does to write to disk, so may pre-emptively fail the fork.

To Resolve this, you can:

Modify /etc/sysctl.conf and add:

vm.overcommit_memory=1

Then restart sysctl with:

On FreeBSD:

sudo /etc/rc.d/sysctl reload

On Linux:

sudo sysctl -p /etc/sysctl.conf

Community's user avatar

answered Apr 15, 2018 at 6:42

Bhindi's user avatar

BhindiBhindi

1,37311 silver badges16 bronze badges

4

In my case, it was just the privileges that I needed to allow for Redis to accept the incoming request.

So I restarted the Redis service via Homebrew brew services stop redis and brew services start redis and run the Redis server locally redis-server. The command prompt asked me to allow the incoming request and it started working.

answered May 16, 2022 at 10:23

Touseef Murtaza's user avatar

1

in case you are working on a linux machine, also recheck the file and folder permissions of the database.

The db and the path to it can be obtained via:

in redis-cli:

CONFIG GET dir

CONFIG GET dbfilename

and in the commandline ls -l. The permissions for the directory should be 755, and those for the file should be 644. Also, normally redis-server executes as the user redis, therefore its also nice to give the user redis the ownership of the folder by executing sudo chown -R redis:redis /path/to/rdb/folder. This has been elaborated in the answer here.

Community's user avatar

answered Jul 13, 2014 at 18:26

smilee89's user avatar

smilee89smilee89

5335 silver badges9 bronze badges

1

If you’re running MacOS and have recently upgraded to Catalina, you may need to run brew services restart redis as suggested in this issue.

answered Nov 11, 2019 at 5:30

Fush's user avatar

FushFush

2,46921 silver badges19 bronze badges

Thanks everyone for checking the problem, apparently the error was produced during bgsave.

For me, typing config set stop-writes-on-bgsave-error no in a shell and restarting Redis solved the problem.

answered Oct 25, 2013 at 4:45

Salvador Dali's user avatar

Salvador DaliSalvador Dali

213k147 gold badges698 silver badges752 bronze badges

5

Start Redis Server in a directory where Redis has write permissions

The answers above will definitely solve your problem, but here’s what’s actually going on:

The default location for storing the rdb.dump file is ./ (denoting current directory). You can verify this in your redis.conf file. Therefore, the directory from where you start the redis server is where a dump.rdb file will be created and updated.

It seems you have started running the redis server in a directory where redis does not have the correct permissions to create the dump.rdb file.

To make matters worse, redis will also probably not allow you to shut down the server either until it is able to create the rdb file to ensure the proper saving of data.

To solve this problem, you must go into the active redis client environment using redis-cli and update the dir key and set its value to your project folder or any folder where non-root has permissions to save. Then run BGSAVE to invoke the creation of the dump.rdb file.

CONFIG SET dir "/hardcoded/path/to/your/project/folder"
BGSAVE

(Now, if you need to save the dump.rdb file in the directory that you started the server in, then you will need to change permissions for the directory so that redis can write to it. You can search stackoverflow for how to do that).

You should now be able to shut down the redis server. Note that we hardcoded the path. Hardcoding is rarely a good practice and I highly recommend starting the redis server from your project directory and changing the dir key back to./`.

CONFIG SET dir "./"
BGSAVE

That way when you need redis for another project, the dump file will be created in your current project’s directory and not in the hardcoded path’s project directory.

answered Sep 23, 2017 at 19:57

Govind Rai's user avatar

Govind RaiGovind Rai

14.2k9 gold badges70 silver badges83 bronze badges

2

$ redis-cli

config set stop-writes-on-bgsave-error no

According to Redis documentation, this is recommended only if you don’t have RDB snapshots enabled or if you don’t care about data persistence in the snapshots.

«By default Redis will stop accepting writes if RDB snapshots are enabled (at least one save point) and the latest background save failed. This will make the user aware (in a hard way) that data is not persisting on disk properly, otherwise,strong text chances are that no one will notice and some disaster will happen.»

What u should be doing is :

# redis-cli
127.0.0.1:6379> CONFIG SET dir /data/tmp
OK
127.0.0.1:6379> CONFIG SET dbfilename temp.rdb
OK
127.0.0.1:6379> BGSAVE
Background saving started
127.0.0.1:6379>

Please Make sure /data/tmp has enough disk space.

jas's user avatar

jas

10.6k2 gold badges30 silver badges41 bronze badges

answered Mar 4, 2021 at 10:33

Vinayak S.'s user avatar

Vinayak S.Vinayak S.

3722 silver badges7 bronze badges

1

Had encountered this error and was able to figure out from log that the error is because of the disk space not being enough. All the data that was inserted in my case was not needed any longer. So I tried to FLUSHALL. Since redis-rdb-bgsave process was running, it was not allowing to FLUSH the data also. I followed below steps and was able to continue.

  1. Login to redis client
  2. Execute config set stop-writes-on-bgsave-error no
  3. Execute FLUSHALL (Data stored was not needed)
  4. Execute config set stop-writes-on-bgsave-error yes

The process redis-rdb-bgsave was no longer running after the above steps.

answered Sep 4, 2018 at 7:09

RCK's user avatar

RCKRCK

3112 silver badges4 bronze badges

I faced the similar issue, the main reason behind this was the memory(RAM) consumption by redis.
My EC2 machine had 8GB RAM(arounf 7.4 available for consumption)

When my program was running the RAM usage went upto 7.2 GB leaving hardly ~100MB in RAM , this generally triggers the MISCONF Redis error ...

You can determine the RAM consumption using the htop command. Look for the Mem attribute after running htop command. If it shows high consumtion (like in my case it was 7.2GB/7.4GB) It’s better to upgrade the instance’s with larger Memory.
In this scenario using config set stop-writes-on-bgsave-error no will be a disaster for the server and may result in disrupting other services running on the server(if any). So, it better to avoid the config command and UPGRADE YOUR REDIS MACHINE.

FYI: You may need to install htop to make this work : sudo apt-get install htop

One more solution to this can be some other RAM heavy service running on your system, check for other service running on your server/machine/instance and stop it if its not necessary. To check all the services running on your machine use service --status-all

And a suggestion for people directly pasting the config command , please do reasearch a bit and atleast warn the user before using such commands. And as @Rodrigo mentioned in his comment : «It does not look cool to ignore the errors.»

—UPDATE—

YOu can also configure maxmemory and maxmemory-policy to define the behavior of Redis when a specific limit of memory is reached.
For example, if I want to keep the memory limit of 6GB and delete the least recently used keys from the DB to make sure that redis mem usage do not exceed 6GB, then we can set these two parameters (in redis.conf or CONFIG SET command):

maxmemory 6gb
maxmemory-policy allkeys-lru

There are a lot of other values which you can set for these two parameters you can read about this from here: https://redis.io/topics/lru-cache

answered Feb 15, 2019 at 13:57

im_bhatman's user avatar

im_bhatmanim_bhatman

8761 gold badge18 silver badges28 bronze badges

Nowadays the Redis write-access problems that give this error message to the client re-emerged in the official redis docker containers.

Redis from the official redis image tries to write the .rdb file in the containers /data folder, which is rather unfortunate, as it is a root-owned folder and it is a non-persistent location too (data written there will disappear if your container/pod crashes).

So after an hour of inactivity, if you have run your redis container as a non-root user (e.g. docker run -u 1007 rather than default docker run -u 0), you will get a nicely detailed error msg in your server log (see docker logs redis):

1:M 29 Jun 2019 21:11:22.014 * 1 changes in 3600 seconds. Saving...
1:M 29 Jun 2019 21:11:22.015 * Background saving started by pid 499
499:C 29 Jun 2019 21:11:22.015 # Failed opening the RDB file dump.rdb (in server root dir /data) for saving: Permission denied
1:M 29 Jun 2019 21:11:22.115 # Background saving error

So what you need to do is to map container’s /data folder to an external location (where the non-root user, here: 1007, has write access, such as /tmp on the host machine), e.g:

docker run --rm -d --name redis -p 6379:6379 -u 1007 -v /tmp:/data redis

So it is a misconfiguration of the official docker image (which should write to /tmp not /data) that produces this «time bomb» that you will most likely encounter only in production… overnight over some particularly quiet holiday weekend :/

answered Jun 30, 2019 at 8:52

mirekphd's user avatar

mirekphdmirekphd

4,4213 gold badges36 silver badges58 bronze badges

5

for me

config set stop-writes-on-bgsave-error no

and I reload my mac, it works

answered Aug 15, 2019 at 2:33

wuhaiwei's user avatar

wuhaiweiwuhaiwei

911 silver badge2 bronze badges

On redis.conf line ~235 let’s try to change config like this

- stop-writes-on-bgsave-error yes
+ stop-writes-on-bgsave-error no

Dharman's user avatar

Dharman

30.5k22 gold badges85 silver badges133 bronze badges

answered Nov 27, 2020 at 12:14

Binh Ho's user avatar

Binh HoBinh Ho

3,4811 gold badge30 silver badges31 bronze badges

1

A more permanent fix might be to look in /etc/redis/redis.conf around lines 200-250 there are settings for the rdb features, that were not a part of redis back in the 2.x days.

notably

dir ./

can be changed to

dir /home/someuser/redislogfiledirectory

or you could comment out all the save lines, and not worry about persistence. (See the comments in /etc/redis/redis.conf)

Also, don’t forget

service redis-server stop
service redis-server start

answered Sep 19, 2016 at 4:26

Soup Cup's user avatar

Soup CupSoup Cup

1011 silver badge5 bronze badges

1

all of those answers do not explain the reason why the rdb save failed.


as my case, I checked the redis log and found:

14975:M 18 Jun 13:23:07.354 # Background saving terminated by signal 9

run the following command in terminal:

sudo egrep -i -r 'killed process' /var/log/

it display:

/var/log/kern.log.1:Jun 18 13:23:07 10-10-88-16 kernel: [28152358.208108] Killed process 28416 (redis-server) total-vm:7660204kB, anon-rss:2285492kB, file-rss:0kB

that is it! this process(redis save rdb) is killed by OOM killer

refers:

https://github.com/antirez/redis/issues/1886

Finding which process was killed by Linux OOM killer

Community's user avatar

answered Jun 19, 2017 at 3:54

carton.swing's user avatar

carton.swingcarton.swing

1,44717 silver badges12 bronze badges

Yep, this happing because current use does not have the permission to modify the «dump.rdb».

So, instead of creating a new RDB file, You can also give permission to old file(change the ownership of it).

In redis-cli enter:

config get dir

you will get «/usr/local/var/db/redis» (this is the location where redis writes the data)

go to this location using terminal

cd 
cd /usr/local/var/db

Type this command(with our username):

sudo chown -R [username] db

This will change to owner.

This works for me.

answered Jun 11, 2021 at 5:58

krishnkant jaiswal's user avatar

I know this thread is slightly older, but here’s what worked for me when I got this error earlier, knowing I was nowhere near memory limit- both answers were found above.

Hopefully this could help someone in the future if they need it.

  1. Checked CHMOD on dir folder… found somehow the symbolic notation was different. CHMOD dir folder to 755
  2. dbfilename permissions were good, no changes needed
  3. Restarted redis-server
  4. (Should’ve done this first, but ah well) Referenced the redis-server.log and found that the error was the result of access being denied.

Again- unsure how the permissions on the DIR folder got changed, but I’m assuming CHMOD back to 755 and restarting redis-server took care of it as I was able to ping redis server afterwards.

Also- to note, redis did have ownership of the dbfilename and DIR folder.

answered Jun 21, 2020 at 6:14

Dustin's user avatar

I too was facing the same issue. Both the answers (the most upvoted one and the accepted one) just give a temporary fix for the same.

Moreover, the config set stop-writes-on-bgsave-error no is a horrible way to over look this error, since what this option does is stop redis from notifying that writes have been stopped and to move on without writing the data in a snapshot. This is simply ignoring this error.
Refer this

As for setting dir in config in redis-cli, once you restart the redis service, this shall get cleared too and the same error shall pop up again. The default value of dir in redis.conf is ./ , and if you start redis as root user, then ./ is / to which write permissions aren’t granted, and hence the error.

The best way is to set the dir parameter in redis.conf file and set proper permissions to that directory. Most of the debian distributions shall have it in /etc/redis/redis.conf

answered Jun 11, 2018 at 9:03

Mayank Sharma's user avatar

Check your Redis log before taking any action. Some of the solutions in this thread may erase your Redis data, so be careful about what you are doing.

In my case, the machine was running out of RAM. This also can happen when there is no more free disk space on the host.

answered Apr 17, 2020 at 22:24

Erfun's user avatar

ErfunErfun

1,0792 gold badges11 silver badges26 bronze badges

1

After banging my head through so many SO questions finally —
for me @Axel Advento’ s answer worked but with few extra steps —
I was still facing the permission issues.
I had to switch user to redis, create a new dir in it’s home dir and then set it as redis’s dir.

sudo su - redis -s /bin/bash
mkdir redis_dir
redis-cli CONFIG SET dir $(realpath redis_dir)
exit # to logout from redis user (optional)

answered May 2, 2020 at 5:21

markroxor's user avatar

markroxormarkroxor

5,8682 gold badges34 silver badges43 bronze badges

In my Case the Ubuntu Virtual Machine’s Disk space got Full and that’s why I was getting this Error. After deleting some files from the Disk has Solved the Issue.

answered May 29, 2021 at 17:51

Amar Kumar's user avatar

Amar KumarAmar Kumar

2,3242 gold badges25 silver badges33 bronze badges

In case you are using docker/docker-compose and want to prevent redis from writing to file, you can create a redis config and mount into a container

docker.compose.override.yml

  redis:¬
      volumes:¬
        - ./redis.conf:/usr/local/etc/redis/redis.conf¬
      ports:¬
        - 6379:6379¬

You can download the default config from here

in the redis.conf file make sure you comment out these 3 lines

save 900 1
save 300 10
save 60 10000

myou can view more solutions for removing the persistent data here

answered Jun 23, 2019 at 2:05

Nic Wanavit's user avatar

Nic WanavitNic Wanavit

2,2235 gold badges19 silver badges31 bronze badges

I hit this problem while working on a server with AFS disk space because my authentication token had expired, which yielded Permission Denied responses when the redis-server tried to save. I solved this by refreshing my token:

kinit USERNAME_HERE -l 30d && aklog

answered Oct 28, 2017 at 12:44

duhaime's user avatar

duhaimeduhaime

25.2k17 gold badges165 silver badges222 bronze badges

In my case it happened because I just installed redis using the quick way. So redis is not running as root.
I was able to solve this problem by following the instructions under the Installing Redis more properly section of their Quick Start Guide. After doing so, the problem was solved and redis is now running as root. Check it out.

answered Jan 22, 2020 at 7:31

meow2x's user avatar

meow2xmeow2x

2,04622 silver badges27 bronze badges

In my case it was related to disk free space. (you can check it with df -h bash command) when I free some space this error disappeared.

answered Aug 6, 2019 at 6:40

Mohammad Reza Esmaeilzadeh's user avatar

If you are running Redis locally on a windows machine, try to «run as administrator» and see if it works. With me, the problem was that Redis was located in the «Program Files» folder, which restricts permissions by default. As it should.

However, do not automatically run Redis as an administrator You don’t want to grant it more rights that it is supposed to have. You want to solve this by the book.

So, we have been able to quickly identify the problem by running it as an administrator, but this is not the cure. A likely scenario is that you have put Redis in a folder that doesn’t have write rights and as a consequence the DB file is stored in that same location.

You can solve this by opening the redis.windows.conf and to search for the following configuration:

    # The working directory.
    #
    # The DB will be written inside this directory, with the filename specified
    # above using the 'dbfilename' configuration directive.
    #
    # The Append Only File will also be created inside this directory.
    #
    # Note that you must specify a directory here, not a file name.
    dir ./

Change dir ./ to a path you have regular read/write permissions for

You could also just move the Redis folder in it’s entirety to a folder you know has the right permissions.

Aurelio's user avatar

Aurelio

24.5k9 gold badges59 silver badges63 bronze badges

answered Jun 19, 2018 at 8:54

Pascalculator's user avatar

PascalculatorPascalculator

8701 gold badge10 silver badges17 bronze badges

Here is the detail from the log:

=== REDIS BUG REPORT START: Cut & paste starting from here === [0/428]
[9701] 18 Jul 02:21:30.542 # Redis 2.9.7 crashed by signal: 11
[9701] 18 Jul 02:21:30.542 # Failed assertion: (:0)
[9701] 18 Jul 02:21:30.542 # — STACK TRACE
/usr/local/bin/redis-server(logStackTrace+0x52)[0x4390d2]
/usr/local/bin/redis-server(dictNext+0x68)[0x4128d8]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7fcdf3a84cb0]
/usr/local/bin/redis-server(dictNext+0x68)[0x4128d8]
/usr/local/bin/redis-server(rdbSave+0x228)[0x4255a8]
/usr/local/bin/redis-server(rdbSaveBackground+0x6f)[0x4257af]
/usr/local/bin/redis-server(serverCron+0x467)[0x414f77]
/usr/local/bin/redis-server(aeProcessEvents+0x1f3)[0x410dd3]
/usr/local/bin/redis-server(aeMain+0x2b)[0x410fbb]
/usr/local/bin/redis-server(main+0x2c4)[0x40fe34]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fcdf36d976d]
/usr/local/bin/redis-server[0x40ff9d]
[9701] 18 Jul 02:21:30.542 # — INFO OUTPUT
[9701] 18 Jul 02:21:30.542 # # Server
redis_version:2.9.7
redis_git_sha1:a2db8e48
redis_git_dirty:1
os:Linux 3.2.0-23-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.6.3
process_id:9701
run_id:5f48a144472ae281c1de68f5b18c8574caf48e49
tcp_port:6379
uptime_in_seconds:231
uptime_in_days:0
lru_clock:37199

Clients

connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

Memory

used_memory:4908282496
used_memory_human:4.57G
used_memory_rss:5015216128
used_memory_peak:4908397808
used_memory_peak_human:4.57G
used_memory_lua:30720
mem_fragmentation_ratio:1.02
mem_allocator:jemalloc-3.0.0

Persistence

loading:0
rdb_changes_since_last_save:17534
rdb_bgsave_in_progress:0
rdb_last_save_time:1342549047
rdb_last_bgsave_status:err
rdb_last_bgsave_time_sec:13
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1

Stats

total_connections_received:4
total_commands_processed:44173
instantaneous_ops_per_sec:0
rejected_connections:0
expired_keys:0
evicted_keys:0
keyspace_hits:9198
keyspace_misses:1520
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:50434

Replication

role:master
connected_slaves:0

CPU

used_cpu_sys:0.59
used_cpu_user:11.56
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

Commandstats

cmdstat_sadd:calls=6410,usec=14064,usec_per_call=2.19
cmdstat_zadd:calls=3957,usec=19042,usec_per_call=4.81
cmdstat_zscore:calls=364,usec=1363,usec_per_call=3.74
cmdstat_hset:calls=2410,usec=4998,usec_per_call=2.07
cmdstat_hget:calls=4355,usec=5004,usec_per_call=1.15
cmdstat_hmset:calls=6369,usec=50431,usec_per_call=7.92
cmdstat_hmget:calls=5999,usec=10266,usec_per_call=1.71
cmdstat_select:calls=5,usec=5,usec_per_call=1.00
cmdstat_keys:calls=1,usec=1219,usec_per_call=1219.00
cmdstat_multi:calls=4766,usec=1480,usec_per_call=0.31
cmdstat_exec:calls=4766,usec=16059,usec_per_call=3.37
cmdstat_info:calls=5,usec=504,usec_per_call=100.80
cmdstat_watch:calls=4766,usec=4115,usec_per_call=0.86

Cluster

cluster_enabled:0

Keyspace

db0:keys=7595100,expires=0
db1:keys=3412,expires=0
hash_init_value: 1342206335

[9701] 18 Jul 02:21:30.542 # — CLIENT LIST OUTPUT
[9701] 18 Jul 02:21:30.542 # addr=127.0.0.1:35864 fd=6 age=231 idle=40 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=info

[9701] 18 Jul 02:21:30.542 # — REGISTERS
[9701] 18 Jul 02:21:30.542 #
RAX:00007bcdd25eef40 RBX:00007fcdf2c5a080
RCX:ff4febb51ed00b65 RDX:000000000000002e
RDI:00007fccc6c09340 RSI:00007fcdbdf25600
RBP:0000000000000000 RSP:00007fff24cc7028
R8 :0000000001f34ce0 R9 :1ed00b74615f6574
R10:73616c09064febb5 R11:00007fcdbdf255f5
R12:0000000000000000 R13:00007fccc6c09340
R14:00007fcdbdf79db0 R15:00000138962c3e94
RIP:00000000004128d8 EFL:0000000000010202
CSGSFS:0000000000000033
[9701] 18 Jul 02:21:30.542 # (00007fff24cc70a0) -> 3037392d706d6574
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7098) -> 0000000000467775
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7090) -> 0000000000000000
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7088) -> 00007fcdbdf25618
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7080) -> 00000001f3000010
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7078) -> 00007fcdf3000198
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7070) -> 0000000000000000
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7068) -> 0000000001f34c00
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7060) -> ccec6b508c3dbb83
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7058) -> 0000000000441490
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7050) -> 0000000000441370
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7048) -> 0000000000441380
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7040) -> 00000000004413a0
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7038) -> 00007fcdf2c10040
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7030) -> 0000000001f34c00
[9701] 18 Jul 02:21:30.542 # (00007fff24cc7028) -> 00000000004255a8
[9701] 18 Jul 02:21:30.542 #
=== REDIS BUG REPORT END. Make sure to include from START to END. ===

Sometimes Redis will throw out error:

    MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

Override Error in Redis Configuration

Using redis-cli, you can stop it trying to save the snapshot:

config set stop-writes-on-bgsave-error no

This is a quick workaround, but if you care about the data you are using it for, you should check to make sure why BGSAVE failed in first place.

This gives a temporary fix to the problem. However, it is a horrible way to over look this error, since what this option does is stop redis from notifying that writes have been stopped and to move on without writing the data in a snapshot. This is simply ignoring this error.

Save Redis on Low Memory

There might be errors during the bgsave process due to low memory.

This error occurs because of BGSAVE being failed. During BGSAVE,  Redis forks a child process to save the data on disk. Although exact reason for failure of BGSAVE can be checked from logs (usually at /var/log/redis/redis-server.log on linux machines) but a lot of the times BGSAVE fails because the fork can’t allocate memory. Many times the fork fails to allocate memory  (although the machine has enough RAM available) because of a conflicting optimization by the OS.

As can be read from Redis FAQ:

Background saving is failing with a fork() error under Linux even if I’ve a lot of free RAM!

Redis background saving schema relies on the copy-on-write semantic of fork in modern operating systems: Redis forks (creates a child process) that is an exact copy of the parent. The child process dumps the DB on disk and finally exits. In theory the child should use as much memory as the parent being a copy, but actually thanks to the copy-on-write semantic implemented by most modern operating systems the parent and child process will share the common memory pages. A page will be duplicated only when it changes in the child or in the parent. Since in theory all the pages may change while the child process is saving, Linux can’t tell in advance how much memory the child will take, so if the overcommit_memory setting is set to zero fork will fail unless there is as much free RAM as required to really duplicate all the parent memory pages, with the result that if you have a Redis dataset of 3 GB and just 2 GB of free memory it will fail.

Setting overcommit_memory to 1 tells Linux to relax and perform the fork in a more optimistic allocation fashion, and this is indeed what you want for Redis.

# echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
# sysctl vm.overcommit_memory=1

Redis doesn’t need as much memory as the OS thinks it does to write to disk, so may pre-emptively fail the fork.

1. Purpose

In this post, I would demonstrate how to resolve the following error when using spring redis template:

Caused by: redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

2. The solution

2.1 The details of the problem

The detail of the problem is:

2022-02-16 17:51:47.958  INFO 3913 --- [Thread-6] com.bswen.wx.service.WxCheckThread      : delete mykey cache of 20220213,key=redis.mykey.cachemap.20220213
2022-02-16 17:51:47.958 ERROR 3913 --- [Thread-6] com.bswen.wx.service.WxCheckThread      :

org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:44)
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:36)
        at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:37)
        at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:37)
        at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:195)
        at org.springframework.data.redis.connection.jedis.JedisConnection.del(JedisConnection.java:713)
        at org.springframework.data.redis.connection.DefaultStringRedisConnection.del(DefaultStringRedisConnection.java:210)
        at org.springframework.data.redis.core.RedisTemplate$4.doInRedis(RedisTemplate.java:602)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:190)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
        at org.springframework.data.redis.core.RedisTemplate.delete(RedisTemplate.java:599)
        at com.bswen.wx.service.WxCheckThread.checkmykeyCache(WxCheckThread.java:85)
        at com.bswen.wx.service.WxCheckThread.run(WxCheckThread.java:65)
Caused by: redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
        at redis.clients.jedis.Protocol.processError(Protocol.java:113)
        at redis.clients.jedis.Protocol.process(Protocol.java:131)
        at redis.clients.jedis.Protocol.read(Protocol.java:200)
        at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:285)
        at redis.clients.jedis.Connection.getIntegerReply(Connection.java:210)
        at redis.clients.jedis.BinaryJedis.del(BinaryJedis.java:161)
        at org.springframework.data.redis.connection.jedis.JedisConnection.del(JedisConnection.java:711)
        ... 7 common frames omitted

2022-02-16 17:53:34.589  INFO 3913 --- [Thread-4] com.bswen.wx.service.EmailCheckThread   : email CheckThread start checking now...
2022-02-16 17:53:34.590  INFO 3913 --- [Thread-4] com.bswen.wx.service.EmailCheckThread   : email CheckThread got 0 missed tasks to process.
2022-02-16 17:53:34.590  INFO 3913 --- [Thread-4] com.bswen.wx.service.EmailCheckThread   : email CheckThread end check
2022-02-16 17:53:47.963  INFO 3913 --- [Thread-6] com.bswen.wx.service.WxCheckThread      : WxCheckThread start checking now...
2022-02-16 17:53:47.964  INFO 3913 --- [Thread-6] com.bswen.wx.service.WxCheckThread      : WxCheckThread got 0 missed tasks to process.
2022-02-16 17:53:47.964  INFO 3913 --- [Thread-6] com.bswen.wx.service.WxCheckThread      : delete mykey cache of 20220213,key=redis.mykey.cachemap.20220213
2022-02-16 17:53:47.964 ERROR 3913 --- [Thread-6] com.bswen.wx.service.WxCheckThread      :

org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:44)
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:36)
        at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:37)
        at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:37)
        at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:195)
        at org.springframework.data.redis.connection.jedis.JedisConnection.del(JedisConnection.java:713)
        at org.springframework.data.redis.connection.DefaultStringRedisConnection.del(DefaultStringRedisConnection.java:210)
        at org.springframework.data.redis.core.RedisTemplate$4.doInRedis(RedisTemplate.java:602)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:190)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
        at org.springframework.data.redis.core.RedisTemplate.delete(RedisTemplate.java:599)
        at com.bswen.wx.service.WxCheckThread.checkmykeyCache(WxCheckThread.java:85)
        at com.bswen.wx.service.WxCheckThread.run(WxCheckThread.java:65)
Caused by: redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
        at redis.clients.jedis.Protocol.processError(Protocol.java:113)
        at redis.clients.jedis.Protocol.process(Protocol.java:131)
        at redis.clients.jedis.Protocol.read(Protocol.java:200)
        at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:285)
        at redis.clients.jedis.Connection.getIntegerReply(Connection.java:210)
        at redis.clients.jedis.BinaryJedis.del(BinaryJedis.java:161)
        at org.springframework.data.redis.connection.jedis.JedisConnection.del(JedisConnection.java:711)
        ... 7 common frames omitted



2.2 The debug of the problem

I found that the rdb file of my redis instance is very large. So I tried to parse it with a tool named redis data retrieve tool or rdr: , you can refer to this document to do the redis dump file parse job.

After analyzing the above image, I found that there are too many sortedsets in my redis buffer, so I tried to delete them and restarted redis.

2.3 The solution

Make sure the following configuration exists in your redis.conf, you can change it to “no” if you want to serve requests even if the background saving task fails.

# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
# This will make the user aware (in a hard way) that data is not persisting
# on disk properly, otherwise chances are that no one will notice and some
# disaster will happen.
#
# If the background saving process will start working again Redis will
# automatically allow writes again.
#
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
stop-writes-on-bgsave-error yes # change it to no if you want to serve requests

And make sure that your redis dump rdb file is small and the backround saving is not too long.

2.4 Other resources

You can also refer to this thread to solve your problem.

3. Summary

In this post, I demonstrated how to debug the MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk problem , the key point is to use rdr tool to analyze your redis dump file and keep it small. That’s it, thanks for your reading.

  • Ошибка redis connection failed
  • Ошибка redhorn 4800002 far cry 5
  • Ошибка red dead redemption 2 при загрузке обновления
  • Ошибка red dead redemption 2 недостаточно виртуальной памяти увеличьте размер файла подкачки
  • Ошибка red alert 3 installation not found