Tag Archives: redis

[Solved] Redis New Version Install Error: server.c:3014:36: error: ‘struct redisServer’ has no member named ‘aof_filename’

The installation of a new version of Redis reports an error, as follows:

Current gcc version:

Upgrade gcc version:

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash

Install again using make

Redis: DENIED Redis is running in protected mode [How to Solve]

As shown below, the program reports an error when connecting to redis. According to the error information, redis is running in protected mode. It needs to be set under the redis command line: config set protected-mode no.

-DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions:

Just disable protected mode sending the command ‘CONFIG SET protected-mode no’ from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent.

Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to ‘no’, and then restarting the server.

If you started the server manually just for testing, restart it with the ‘–protected-mode no’ option.

Setup a bind address or an authentication password.

NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

Error message when using pycharm to connect to redis:

Detect redis port 6379 through telnet command

Solution:

Set protected-mode no

Check the redis port 6379 through the telnet command again, and there is no access exception.

Run Python again to connect to redis:

Supplementary knowledge:

When you use telnet (telnet IP port number) to connect to the host under Linux/Unix, you will be prompted “escape character is’ ^] ‘. What does this mean? How to solve it?

Escape character is ‘^]’. Solution

“^” means the Ctrl key!

1. This prompt means that pressing Ctrl +] will call out the command line of Telnet!

2. After the telnet command line comes out, you can execute the telnet command;

3. Exit the telnet command line with the name quit.

Common telnet commands

close closes the current connection

logout forces the remote user to exit and close the connection

display displays the parameters of the current operation

mode attempted to enter command line mode or character mode

open connect to a site

quit exit

telnetsend send special characters

set sets the parameters of the current operation

unset resets the current operating parameters

status print status information

toggle switch operation parameters

slc changes the state of special characters

Auth on/off confirmation function Z suspended

Telnetenviron changes the environment variable and displays help

To sum up, escape character is’ ^] ‘. It is just a prompt that you can call the command line of Telnet using Ctrl +] key.

[Solved] Windows Redis Error: Could not create server TCP listening socket 127.0.0.1:6379: bind…

An error occurred when redis was started under Windows Environment: could not create server TCP listening socket 127.0.0.1:6379: bind: the operation completed successfully.

Problem Description:
When redis is started in the windows environment today, an error is reported:

Solution:
① run command: redis-cli.exe

② Exit Redis

③ Run the command: redis-server.exe redis.windows.conf

Start successfully!

[Solved] redis-server.exe Flashback Error: QForkMasterInit: system error caught. error code=0x000005af, message=Virtual

If you don’t change any configuration one day and somehow open the redis server to flash back, you can enter the redis-server directory in the command line and enter redis-server.exe redis.windows.conf command to view the error information

If an error is reported as follows

QForkMasterInit: system error caught. error code=0x000005af, message=VirtualAllocEx failed

It means that you have not set the maximum memory of redis

Open redis.windows.conf with Notepad

Add the code below to the last line.

maxmemory 268435456
maxheap 314572800

[Solved] java.lang.IllegalAccessError: class org.springframework.data.redis.core.$ Proxy237 cannot access its superinterface org.springframework.data.redis.core.RedisConnectionUtils$RedisConnectionProxy

[resolved]

java.lang.IllegalAccessError: class org.springframework.data.redis.core.$ Proxy237 cannot access its superinterface org.springframework.data.redis.core.RedisConnectionUtils$RedisConnectionProxy

In the serviceImpl class operation redis reported the above error, after investigation found that the cause is in the (with write operation [@Transactional (readOnly = false)]) transaction method of operation redis, in the readOnly = true transaction method can be operated normally

ps: other versions of redis do not know if there is also this situation for the time being

solution: the operation of redis to get @Transactional (readOnly = false) method outside the operation can be

Springboot integrates Redis annotation and access error: java.io.NotSerializableException: com.demo.entity.MemberEntity

Problem Description.
SpringBoot integration with Redis annotations, requesting an error:

java.io.NotSerializableException: com.demo.entity.MemberEntity at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
~[na:1.8.0_191] at
java.util.ArrayList.writeObject(ArrayList.java:766) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.8.0_191] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_191] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498)
~[na:1.8.0_191] at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1140)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
~[na:1.8.0_191] at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
~[na:1.8.0_191]

Problem: Serialization is not performed in the entity class
Solution: Serializable interface is implemented in the entity class

SpringBoot IntegratenRedis Annotations and access error: EL1008E: Property or field ‘getListMember‘ cannot be found on object of type

Problem Description.
Springboot integration redis annotations, request access with the following error:

org.springframework.expression.spel.SpelEvaluationException: EL1008E:
Property or field ‘getListMember’ cannot be found on object of type
‘org.springframework.cache.interceptor.CacheExpressionRootObject’ –
maybe not public or not valid?



Reason: missing single quotes in redis tag

Solution:
Add single quotes to the redis tag

How to Solve zuul Forwarding error (No Retrayable)

Text

Service A restarts, zuul without adding a retry mechanism, and A service error exception will be reported

Solution: Modify gateway profile

hystrix:
    command:
        default:
            execution:
                isolation:
                    thread:
                        timeout-in-milliseconds: 20000
zuul:
  host:
    connect-timeout-millis: 20000
    socket-timeout-millis: 20000
  routes:
    #userMicroservices
    userService:
      #All requests with /user as the header are forwarded to user
      path: /user/**
      serviceId: user
      #url: http://localhost:8091
    pickupService:
      #All requests with /pickup as the header are forwarded to pickup
      path: /pickup/**
      serviceId: pickup
    orderService:
      #All requests with /order as the header are forwarded to order
      path: /order/**
      serviceId: order
  #Whether retryable is enabled
  retryable: true
ribbon:
  #resolve the timeout problem caused by zuul forwarding requests
  ReadTimeout: 60000 
  SocketTimeout: 60000
  # of retries for the current service
  MaxAutoRetries: 2
  # of times to switch the same Server
  MaxAutoRetriesNextServer: 0

[Solved] Redis Startup Error: QForkMasterInit: system error caught. error code=0x000005af

 

1. Problems

When you use redis-server.exe to startup directly, it will flashback. When it is started with script and configuration file, it will also flashback. When it is started with command line, an error will be reported:

[23848] 16 Mar 16:10:32.565 # QForkMasterInit: system error caught. error code=0x000005af, message=VirtualAllocEx failed.: unknown error

2. Solutions

Redis’s conf file sets the parameters maxheap and maxmemory

maxmemory 120MB

maxheap 180MB

Maxmemory and maxheap depend on your computer configuration. Usually: maxheap = 1.5 * maxmemory

Redis Delete dump.rdb Mistakenly [How to Solve]

1. Log in to redis database

[ root@localhost ~]# redis-cli -h 192.168.1.19
2. View redis configuration information

192.168.1.19:6379> info

2. According the path of config_file to set dump.rdb file storage path, or you can customize the path

192.168.1.19:6379> config set dir /storage/redis/

3. Save and exit

192.168.1.19:6379> save

192.168.1.19:6379> exit

4. Restart redis service

[ root@localhost ~]# service redis stop

[ root@localhost ~]# service redis start

Redis Error: (error) ERR Errors trying to SHUTDOWN. Check logs.

An error is reported when closing redis

(error) ERR Errors trying to SHUTDOWN. Check logs.

First, we need to understand that when we shutdown, redis will save the data, whether it is rdb or aof depends on your own settings. But when you save the file, you may encounter the save path does not exist, or the save path does not have permission, in the configuration file, the default save path for rdb is . /. So we have a problem because of path permissions.

Modify . / file permissions

[atguigu@hadoop100 bin]$ sudo chown atguigu:atguigu -R /usr/local/bin/redis-config/

Shut down again and stop successfully

[Solved] Redis Client On Error: Error: write ECONNABORTED Config right

Solve the redis client on error: error: write econnaborted config rightwe

Problem Description:
Solution:

1. First, check whether the firewall of Linux is turned on

Turn off the firewall

[root@localhost]# systemctl stop firewalld.service

Open 6379 port

[root@localhost]# sudo firewall-cmd --zone=public --add-port=6379/tcp --permanent
success
[root@localhost]# sudo firewall-cmd --reload
success

2. Check whether the redis startup configuration is correct

Check whether redis is started

 ps -ef | grep redis

For versions above redis 3.2, Internet access is not allowed by default, and needs to be modified redis.conf configuration file

Modify peetected-mode

Modify peotected-mode yes
to: protected-mode no.
#The protected-mode parameter is used to disable access to redis from outside the network, if enabled, only the localhost ip (127.0.0.1) will be able to access Redis

Close bind 127.0.0.1

Comment out bind 127.0.0.1, or modify bind 0.0.0.0, to allow access to all ip addresses

After modifying the configuration file, remember to restart redis,

./redis-server /usr/local/redis/redis.conf