安装Redis

一、安装Redis

安装Redis:http://redis.io/download

安装完成后,拷贝一份Redis安装目录下的redis.conf到任意目录,建议保存到:/etc/redis/redis.conf (Windows系统可以无需变动)

二、修改配置文件 redis.conf

打开你的redis.conf配置文件,示例:

  • 非Windows系统: sudo vi /etc/redis/redis.conf

  • Windows系统:C:IntelRedisconf edis.conf

  1. Master端redis.conf里注释bind 127.0.0.1,Slave端才能远程连接到Master端的Redis数据库。

  2.daemonize yno表示Redis默认不作为守护进程运行,即在运行redis-server /etc/redis/redis.conf时,将显示Redis启动提示画面;

三、测试Slave端远程连接Master端

测试中,Master端Windows 10 的IP地址为:192.168.199.108

  1. Master端按指定配置文件启动 redis-server,示例:

    • 非Windows系统:sudo redis-server /etc/redis/redis/conf

    • Windows系统:命令提示符(管理员)模式下执行 redis-server C:IntelRedisconf edis.conf读取默认配置即可。

  2. Master端启动本地redis-cli

  3.slave端启动redis-cli -h 192.168.199.108,-h 参数表示连接到指定主机的redis数据库

四、Redis数据库桌面管理工具

这里推荐 Redis Desktop Manager,支持 Windows、Mac OS X、Linux 等平台:

下载地址:https://redisdesktop.com/download

原文地址:https://www.cnblogs.com/by2016/p/6859218.html