centos redis安装

安装

wget https://download.redis.io/releases/redis-7.2.4.tar.gz

tar -zxf redis-7.2.4.tar.gz -C /usr/local/redis

cd /usr/local/redis

#编译
make
#安装
make install PREFIX=/usr/local/redis

设置密码 redis.conf

requirepass  密码
#设置密码 redis.conf
 daemonize yes #修改daemonize为yes,即默认以后台程序方式运行

 ln -s /usr/local/redis/src/redis-server /usr/bin/redis-server
ln -s /usr/local/redis/src/redis-cli /usr/bin/redis-cli

启动和停止


#实际是去找/tools/redis/bin的这个启动语句,并使用redis配置文件
redis-server /usr/local/redis/redis.conf
#/tools/redis/bin的这个预计进行停止
redis-cli shutdown

lxfamn-redis.service

systemctl start lxfamn-redis
systemctl stop lxfamn-redis
systemctl restart lxfamn-redis

#开机启动
systemctl enable lxfamn-redis
[Unit]
Description=start spring jar
Wants=network-online.target

[Service]
User=root
Type=forking
ExecStart=/usr/local/redis/src/redis-server /usr/local/redis/redis.conf
ExecStop=redis-cli -a 331253 shutdown

[Install]
WantedBy=multi-user.target

未经允许不得转载:lxfamn » centos redis安装

赞 (0) 打赏

置顶推荐

评论 0

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏