redis在Linux虚拟机上安装了,在windows下无法访问的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/y41992910/article/details/82750158

redis在Linux虚拟机上安装了,在windows下无法访问的问题
1:ifconfig查看虚拟机分配的ip
2:redis.conf中bind 指定虚拟机的ip
3:redis-server …/redis.comf

参考了一些网上的资料,主要的步骤是:
1.windows上Ping和telnet虚拟机,看看连通性是否ok.以及Linux ping windows
一般Ping是可以的,telnet就不行。

ping 192.168.233.128

正在 Ping 192.168.233.128 具有 32 字节的数据:
来自 192.168.233.128 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.233.128 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.233.128 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.233.128 的回复: 字节=32 时间<1ms TTL=64


[root@localhost bin]# ping 192.168.0.103
PING 192.168.0.103 (192.168.0.103) 56(84) bytes of data.
64 bytes from 192.168.0.103: icmp_seq=1 ttl=128 time=3.53 ms
64 bytes from 192.168.0.103: icmp_seq=2 ttl=128 time=4.04 ms
64 bytes from 192.168.0.103: icmp_seq=3 ttl=128 time=3.54 ms

2.关闭防火墙或者打开6379端口的对外访问。

执行这段命令就可以开放6379端口了

#停止firewall
systemctl stop firewalld.service 
#禁止firewall开机启动
systemctl disable firewalld.service 
#打开端口的对外访问
firewall-cmd --zone=public --add-port=6379/tcp --permanent

[root@localhost bin]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.233.128 netmask 255.255.255.0 broadcast 192.168.233.255
inet6 fe80::73bd:217e:f9ae:6dfd prefixlen 64 scopeid 0x20
ether 00:0c:29:98:78:16 txqueuelen 1000 (Ethernet)
RX packets 623 bytes 335745 (327.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 313 bytes 28761 (28.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

3.在redis的配置文件中,配置自己所绑定的ip为linux机器的Ip

bind 127.0.0.1 192.168.233.128

猜你喜欢

转载自blog.csdn.net/y41992910/article/details/82750158