openEuler欧拉部署Redis

发布时间 2024-01-08 10:54:21作者: 李济宏(Amadeus)

一、系统优化

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

关闭selinux

sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0

二、安装Redis

dnf -y install redis
vim /etc/redis.conf

#bind 127.0.0.1
bind 0.0.0.0
protected-mode no
requirepass password 

bind 127.0.0.1 #默认只允许本机访问,如果需要开放外网,则注释掉这行,新增0.0.0.0
protected-mode yes #保护模式,如果需要开放外网,则改为 no
port 6379 #可修改端口
requirepass password #登录密码,改配置默认是注释的,放开之后在登录时需要使用如下方式登录

三、测试Redis

redis-cli -p 6379
127.0.0.1:6379> ping
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth password
OK
127.0.0.1:6379> ping
PONG