1、下载地址
https://download.redis.io/releases/
2、安装必要依赖
yum install -y gcc tcl
3、安装
# 解压
tar -xzf redis-6.2.6.tar.gz
#进入redis目录
cd redis-6.2.6
#指定命令安装
make
make install PREFIX=/usr/local/redis
4、修改配置文件
# 允许访问的地址,默认是127.0.0.1,会导致只能在本地访问。修改为0.0.0.0则可以在任意IP访问,生产环境不要设置为0.0.0.0
bind 0.0.0.0
# 守护进程,修改为yes后即可后台运行
daemonize yes
5、设置开机自启
新建一个系统文件
vim /etc/systemd/system/redis.service
内容如下:
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/src/redis-6.2.6/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
然后重载系统服务
systemctl daemon-reload
操作命令
# 启动
systemctl start redis
# 停止
systemctl stop redis
# 重启
systemctl restart redis
# 查看状态
systemctl status redis
执行下面的命令,可以让redis开机自启:
systemctl enable redis
可视化界面
https://github.com/lework/RedisDesktopManager-Windows/releases