win10连接虚拟机Redis

首先创建redis安装目录

# cd /usr/local/
# mkdir redis
# cd redis

下载redis

redis下载地址:http://download.redis.io/releases/

# wget http://download.redis.io/releases/redis-5.0.3.tar.gz

安装

# cd redis-5.0.2
# make && make install

启动redis测试是否安装成功

# redis-server

关闭服务

# redis-cli shutdown

修改配置

# cd /usr/local/redis/redis-5.0.2/
# vim redis.conf 
  1. bind 127.0.0.1 改为 bind 0.0.0.0 允许所有IP访问
  2. daemonize 项改为 yes 允许后台运行redis
  3. protected-modo 项改为 no 关闭保护模式

启动redis服务,应用修改过的配置文件

# redis-server /usr/local/redis/redis-5.0.2/redis.conf

开放6379端口

  1. 关闭selinux

    # setenforce 0
    
  2. 关闭防火墙

    # systemctl stop firewalld
    
  3. 安装或更新iptables服务

    # yum install iptables-services
    
  4. 设置开机启动

    # systemctl enable iptables
    
  5. 启动iptables

    # systemctl start iptables // 启动
    # systemctl stop iptables
    # systemctl restart iptables // 重启
    # systemctl reload iptables
    
  6. 开放端口并重启iptables服务

    # iptables -A INPUT -p tcp --dport 6379 -j ACCEPT 
    # systemctl restart iptables
    

查看虚拟机端口状态

win10操作步骤:

  • 设置 > 应用 > 应用和功能 > 程序和功能 > 启用或关闭 Windows 功能 > 勾选 Telnet Client

  • 查看虚拟机ip地址

    [root@localhost redis-5.0.2]# ifconfig
    eno16777736: flags=4163  mtu 1500
            inet 192.168.14.128  netmask 255.255.255.0  broadcast 192.168.14.255
            inet6 fe80::20c:29ff:fe86:cea  prefixlen 64  scopeid 0x20
            ether 00:0c:29:86:0c:ea  txqueuelen 1000  (Ethernet)
            RX packets 1559737  bytes 2229842405 (2.0 GiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 775597  bytes 305615357 (291.4 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    

    192.168.14.128是我的虚拟机IP地址

  • 虚拟机redis服务启动状态下,windows唤出cmd窗口,输入 telnet 192.168.14.128 6379 ,若没有报错并弹出一个黑色窗口,证明端口状态已开放

连接Redis Desktop Manager

  • 点击新建链接按钮,输入虚拟机IP和redis端口,测试链接

若log窗口报错 Connection: Disconnect on error: Connection error: The proxy type is invalid for this operation ,尝试关闭VPN软件重试

你可能感兴趣的:(姿势备忘,redis)