redis 拒絕遠程訪問解決


啟動時報的警告:

1、Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf

就因為這個原因,無法連接到遠程redis:Unable to connect to 192.168.163.131:6379

解決:

[root@cent7-zuoys src]# ./redis-server ../redis.conf

2、

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

解決:

編輯/etc/sysctl.conf ,改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效

3、The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

解決:

在/etc/sysctl.conf中添加:net.core.somaxconn = 2048,然后在終端中執行sysctl -p

4、

you have Transparent Huge Pages (THP) support enabled in your kernel.?This will create latency and memory usage issues with Redis.?To fix thisissue run the?command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root,?and add it to your /etc/rc.local in order to retain thesetting after a reboot.?Redis must be restarted after THP is disabled.

解決:

臨時解決方法:

echo never > /sys/kernel/mm/transparent_hugepage/enabled。

永久解決方法:

將其寫入/etc/rc.local文件中。

 

 

遠程訪問redis報錯:

org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 10.134.253.30:6379

 

解決:

vi redis.conf

1、注釋掉 bind 127.0.0.1,即可讓所有ip訪問
2、protected-mode no

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM