Tag Archives: redis

Connected Redis Execute command Error: (error) MISCONF Redis is configured to save RDB snapshots,

Error reporting when connecting to redis

(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

The solution is as follows:

Connect redis and run the config set stop writes on bgsave error no command

Close the configuration item stop writes on bgsave error to solve the problem.

[Solved] Redis Connection Error: It was not possible to connect to the redis server(s); to create a disconnected multiplexer

The error you are getting is usually a sign that you have not set abortConnect=false in your connection string. The default value for abortConnect is true, which makes it so that StackExchange.Redis won’t reconnect to the server automatically under some conditions. We strongly recommend that you set abortConnect=false in your connection string so that SE.Redis will auto-reconnect in the background if a network blip occurs.

Netcore :
pack: Microsoft.AspNetCore.DataProtection.StackExchangeRedis
using StackExchange.Redis;

public static void Main(string[] args)
{//Reids
var redis = ConnectionMultiplexer.Connect("localhost,abortConnect=false"); // or "localhost,abortConnect=false,connectTimeout=30000,responseTimeout=30000"
var s= redis.GetStatus();
CreateHostBuilder(args).Build().Run();
}

Linux Configure Redis make Commands Error [Solved]

An error is reported in the make command for configuring redis on Linux

1. After decompressing the redis file, execute the make command and an error is reported:

Solution:

The reason is that the GCC version of Linux system is too low, and the GCC installed by Yum is 4.8.5.GCC needs to be upgraded

Command line input:

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
gcc -v

Decompress the redis file again

Execute the make command, as shown in the following figure, OK!

[Solved] Redis Install Error: jemalloc/jemalloc.h: No such file or directory

reason:

Redis compilation failed before, for example, PKG config plug-in is not installed. This error will be reported when redis compiles again after PKG config is installed, because the cache file remains when the last compilation fails.

Solution:

Clear the residual files before recompiling:

make distclean && make

redis Connect Error: InvalidDataAccessApiUsageException: MISCONF Redis is configured to save RDB snapshots

Application startup connection exception.

org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.. channel: [id: 0x2f971a28, L:/127.0.0.1:57418 - R:127.0.0.1/127.0.0.1:6379] command: (BRPOP), params: [[114, 101, 116, 114, 121, 95, 109, 115, 103], 216000]; 

The problem is that persistence is abnormal. I searched a lot on the Internet.

By modifying redis The stop writes on bgsave error option in the conf configuration can be solved

stop-writes-on-bgsave-error no

How to Solve Error in redis insertion list

When the position of the class changes or other effects change the serialization ID, the previously serialized list cannot be deserialized. Instead of resetting the list, setlist adds the list later.

When the following code cannot be serialized, it will always set the list, which will cause the list to be too large. When you request the list again, it will report that redis cannot be connected

report errors

Solution:

Replace with string, and check whether there is the use of redis’s setlist when changing the location of the class

[Solved] redis Start Error: FATAL CONFIG FILE ERROR: Bad directive or wrong number of arguments

Redis version, above 6.0

Error record: the failed redis uses port 6380 as the slave node.

Error reason:

The reason is that it is not allowed to add comments after the same valid code line in some configuration files (such as. Conf files, which are widely seen here). The following comments will be compiled and executed as the parameters passed in by the current command line; however, the command configuration has no parameters or the format of the parameters passed in is wrong. Naturally, an error will be reported.
as shown in the figure:

Change the comment to a separate line to solve the problem.

Incidentally, there is a receipt. If redis fails to start, you might as well look at the configured log file

[Solved] Execute the redis command redis-trib.rb to view the cluster information error: cannot load such file — redis (LoadError)

Problem Description:

When you execute the redis-trib.rb command to view the cluster status, an error is reported:

[[email protected] ~]$ redis-trib.rb check 192.168.30.10:7000
Traceback (most recent call last):
    2: from /home/aiprd/softwares/redis-3.2.5/src/redis-trib.rb:25:in `<main>'
    1: from /home/aiprd/app/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/aiprd/app/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- redis (LoadError)

Solution:

1. Judging from the error, the redis component is missing

2. Download redis component

Download address: https://rubygems.org/downloads/redis-4.1.2.gem

3. Upload to the server and install [offline installation of gem components]

[[email protected] softwares]$ gem install -l redis-4.1.2.gem 
Successfully installed redis-4.1.2
Parsing documentation for redis-4.1.2
Installing ri documentation for redis-4.1.2
Done installing documentation for redis after 0 seconds
1 gem installed

Because the redis I installed is version 3, the redis component downloaded should also be version 3

Download at: http://rubygems.org/downloads/redis-3.3.5.gem

4. Execute the command to view cluster information again

[[email protected] softwares]$ redis-trib.rb check 192.168.30.10:7000
[ERR] Sorry, can't connect to node 192.168.30.10:7000

An error is reported and the cluster node cannot be connected. Since the redis cluster has enabled authentication, the authentication password of the redis cluster needs to be configured in the client program of the redis component

5. Enter the ruby installation path and find the redis client.rb file

[[email protected] ~]$ cd /home/aiprd/app/ruby/lib/ruby/gems/2.6.0/gems/redis-4.1.2/lib/redis  #/home/aiprd/app/ruby是ruby的安装路径,即--prefix指定的路径
[[email protected] redis]$ ls -l client.rb
-rw-r--r-- 1 aiprd aiprd 16407 Aug  2 11:06 client.rb

6. Modify the file and add the password as follows:

:password => "[email protected]",

7. Execute the command to view cluster status information again

[[email protected] ~]$ redis-trib.rb check 192.168.30.10:7000
>>> Performing Cluster Check (using node 192.168.30.10:7000)
M: 2c8bb60808a0b2bcb155eb45759b8c989cb409f3 192.168.30.10:7000
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
M: 4161a6852df45ee50a065e5e275a24cb1b77f1c1 192.168.30.10:7001
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
M: b7fdb4a783aa829818eb804c0cc04161ece5e845 192.168.30.10:7002
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: e6b0a64e05e5f3e8dc4b369967090f78fe3c87dc 192.168.30.11:7005
   slots: (0 slots) slave
   replicates b7fdb4a783aa829818eb804c0cc04161ece5e845
S: 37168bd4232c2d1f1f9a22bd88f221e4f15bf4d9 192.168.30.11:7003
   slots: (0 slots) slave
   replicates 4161a6852df45ee50a065e5e275a24cb1b77f1c1
S: cab31dd3554524187ffb4a2758af91f72c8238ac 192.168.30.11:7004
   slots: (0 slots) slave
   replicates 2c8bb60808a0b2bcb155eb45759b8c989cb409f3
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

The command is executed successfully, and the problem is solved.

Error reported in the celery log of the project: redis.exceptions.connectionerror failed to connect with redis

When the project in the test environment is running, check uwsgi.log. If the scheduled task does not run, check the cell_ Beat.log log shows: redis.exceptions.connectionerror: error 24 connecting to 127.0.0.1:6379. Too many open files

On the command line, enter redis to check that the data is empty and there is no data.

If the celery is restarted regularly, it can be effective for a while and cannot be stable for a long time.

Compared with the online environment, the redis version is redis cli 2.8.18   The redis version of the test environment reporting an error is 4.0.10, which is too high.

Reinstall the lower version of redis     On the official website https://redis.io/ Find redis version 2.8.18 in the, extract and install it to the redis server version 2.8.18

After downloading, I uploaded the installation package to/usr/local/for installation

/Redis.conf in etc/   / In bin/is mainly mkreleasehdr.sh     redis-benchmark   redis-check-aof     redis-cli     redis-server     It’s all moved by MV command,

The original location is in/usr/local/redis-2.8.18/src/  After moving, it is convenient for subsequent redis startup

Stop the old version of 4.0.10 redis and kill, and delete the corresponding directory files

Start the newly installed version 2.8.18 redis service:/usr/local/redis-2.8.18/bin/redis-server      / usr/local/redis-2.8.18/etc/redis.conf

 

  The version of redis has been reduced. Then enter the project directory to check the log. It runs normally at regular intervals. There is also data in redis