Some abnormal sharing in the process of learning Redis

1. Redis connection failure solution

Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to XXXX:6379

1. Check whether the firewall has opened the redis port

1.1 Check whether the firewall is turned on normally.
systemctl status firewalld
. If **Active: active(running)...** appears, the firewall status is normal.

1.2 Open the Redis port
firewall-cmd --zone=public --add-port=6379/tcp --permanent
The default port of redis is 6379. No one should change this.

1.3 Restart the firewall and check the open ports.
Restart the firewall
systemctl restart firewalld.service
. Check the ports
. Firewall-cmd --list-ports
. If you see 6379/tcp, it means that the port has been opened successfully.

2. Modify the configuration file of Redis

(If you don’t remember the file location, enter the following command
find / -name redis.conf
and then use vi or vim to edit
vi redis.conf)

2.1 #bind 127.0.0.1
redis defaults to local access. You can comment out bind 127.0.0.1, or change 127.0.0.1 to 0.0.0.0

2.2 protected-mode no
redis protected mode is enabled by default. Change yes to no to turn off the protected mode.

2.3 daemonize yes
redis is enabled in the foreground by default. It has been here since then. This does not change it. No changes to yes and runs in the background.

2.4 Restart redis

(1) Enter the configuration file directory

cd /usr/local/redis/config
restart Redis
service redis restart

2. SpringBoot operation redis error reporting Error creating bean with name 'dataSource' defined in class path resource solution

Error details: An error was defined in classpath resource while creating a bean named 'dataSource'. Instantiation of bean via factory method failed; nested exception is org.springframework.beans. BeanInstantiationException: Unable to instantiate [com.zaxxer.hikari.]HikariDataSource: Factory method 'dataSource' threw exception

Insert image description here

@EnableAutoConfiguration can help SpringBoot applications load all eligible @Configuration configurations into the IoC container currently created and used by SpringBoot.

Guess you like

Origin blog.csdn.net/m0_71106830/article/details/130670300