华为云安装redis

 

yum install -y redis
systemctl start redis.service
systemctl enable redis.service
firewall-cmd --add-port=6379/tcp --permanent
firewall-cmd --reload
配置redis远程

sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/g' /etc/redis.conf
sed -i 's/protected-mode yes/protected-mode no/' /etc/redis.conf
sed -i 's/daemonize no/daemonize yes/g' /etc/redis.conf
systemctl restart redis.service
如果要是用默认配置/etc/redis.conf,必须要通过systemctl启动
如果使用redis-server启动程序,需要手动指定配置文件,否则全是默认(不符合实际)
sed -i 是替换命令 ,将redis.conf的相关配置替换掉

 

上一篇:MAC和Linux分别用sed向文件里添加一行


下一篇:Linux sed命令替换固定位置字符串