Redis官网:https://redis.io/
1.Windows
1.首先下载WIndows版本的Redis安装包
下载链接:https://github.com/microsoftarchive/redis/releases
2.解压目录
3.双击Redis,开启服务
双击redis-server.exe
出现以下情况就证明Redis服务开启成功
如果出现双击一闪而过的情况,则需要写一个start.bat来启动
bat里面只需要标准这段话即可:redis-server.exe redis.windows.conf
4.测试服务启动成功
双击redis-cli.exe,然后输入ping命令,如果出现以下情况,则说明Redis连接正常
Linux
Redis官网可以下载最新Linux版本
链接:https://redis.io/download
下载完成后,把压缩包放到自己的对应目录下
1.解压安装包
tar -zxvf redis-5.0.7.tar.gz
解压完成
2.进入解压后的文件,可以看到我们Redis的配置文件
安装基本环境的Linux命令
yum install gcc-c++
make
make install
3.编译安装,同时指定安装目录
一般默认路径是: /usr/local/bin
make PREFIX=/usr/local/redis install //默认安装路径
移动redis.conf配置文件
[root@ty bin]# mkdir tconfig
[root@ty bin]# cp /opt/redis-5.0.7/redis.conf tconfig
可以看到tconfig目录下有redis.conf配置文件
4.启动Redis服务
修改redis.conf的命令
[root@ty tconfig]# vim redis.conf
找到下图的daemonize,刚开始是no的,改成yes
然后通过指令的配置文件启动服务
[root@ty bin]# redis-server tconfig/redis.conf #启动命令
[root@ty bin]# ps -ef|grep redis #查看Redis进程
[root@ty bin]# redis-cli -p 6379 #通过6379端口连接
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> SHUTDOWN #通过SHUTDOWN 关闭Redis服务
not connected> exit #退出