后台开启服务器
$ src/redis-server &
设置防火墙(没开启防火墙的可以跳过)
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload
Today, I encountered a problem when I was learning some redis. I found that the host Redis Destop Manager could not access the virtual machine Redis server solution. I found some online information. There may be two reasons, and I recorded it:
1. Open the Redis.conf file
# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
#如果上面这一行打开了,请关闭它。
2. If you find that the bind in the configuration file is not open, please try the following steps:
Centos uses firewalld to manage the netfilter subsystem by default, but the underlying commands are still iptables, etc., so turn off firewalld first:
systemctl stop firewalld
#屏蔽(让它不能启动)或显示该服务
systemctl mask firewalld
Then install the iptables service package:
yum install iptables-services
Let the service start when the system starts:
systemctl enable iptables
Here is an example of the iptables command:
systemctl [stop|start|restart] iptables
Save firewall rules:
service iptables save
or
/usr/libexec/iptables/iptables.init save
试一下看是不是你的Redis Destop Manager是不是可以连接到虚拟机的Redis server了。