今天在虚拟机上安装redis后,在启动redis时遇到了一些问题,启动后通过redis desktop manager连接时无法连接。
启动redis时遇到的问题
1.Increased maximum number of open files to 10032 (it was originally set to 1024).
原因:open files的值目前是1024太小了需要设置为10032
解决方式:方式1是临时的重启linux后失效,方式2是永久的
方式1:
#查看系统限制
[root@centos224]# ulimit -a
#设置“open files”数量
[root@centos224]# ulimit -n 10032
方式2
#或者设置用户限制
[root@centos224]# vi /etc/security/limits.conf
原文:https://blog.csdn.net/kk185800961/article/details/53326465
2.Could not create server TCP listening socket *:6379: bind: Address already in use
原因:6379端口被占用了
解决方式:lsof -i:6379 kill-15 PID
3.backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
原因:翻一下来为由于/proc/sys/net/core/somaxconn被设置为较低的128,所以无法强制执行511的backlog设置。因为/proc/sys/net/core/somaxconn值为128时太小了导致报错,将该值修改为511
解决方式:方式1为临时性解决方式,重启后失效 方式2为永久性解决
方式一:
[root@centos224]# echo 511 >/proc/sys/net/core/somaxconn
方式二:
[root@centos224]# echo "net.core.somaxconn = 551" > /etc/sysctl.conf
redis desktop manager连接时无法连接
1.注释掉配置文件中的bind:127.0.0.1
2.查看防火墙状态
#1.查看防火墙状态
[root@localhost src]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
#2.关闭防火墙
[root@localhost src]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
#3.查看状态
[root@localhost src]# service iptables status
iptables: Firewall is not running.