Redis实现广告缓存

栏目: 数据库 · 发布时间: 6年前

内容简介:打开配置文件redis.conf,改为:将第三步配置好的配置文件复制到指定目录cp /usrlocal/redis-5.0.2/redis.conf /etc/redis/redis.conf

redis下载与安装

下载 redis 安装包及安装相关依赖包

下载最新稳定版的redis:

wget https://github.com/antirez/redis/archive/5.0.2.tar.gz

安装依赖包:

yum install -y epel-release

yum install -y gcc

解压及编译

cd /usr/local
tar -xzvf redis-5.0.2.tar.gz

编译:

cd redis-5.0.2

make & make install

修改配置文件

打开配置文件redis.conf,改为:

requirepass password
daemonize yes
logfile "/var/log/redis/6379.log"

设置启动服务

将第三步配置好的配置文件复制到指定目录

cp /usrlocal/redis-5.0.2/redis.conf /etc/redis/redis.conf

设置启动服务脚本

cat > /usr/lib/systemd/system/redis.service <<-EOF
[Unit]
Description=Redis 6379
After=syslog.target network.target
[Service]
Type=forking
PrivateTmp=yes
Restart=always
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli -h 127.0.0.1 -p 6379 -a jcon shutdown
User=root
Group=root
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=100000
[Install]
WantedBy=multi-user.target
EOF

使服务自动运行

systemctl daemon-reload
systemctl enable redis

启动服务

systemctl restart redis

systemctl status redis

验证

redis-cli -h host -p port -a password


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

数学拾遗

数学拾遗

加黑蒂 / 清华大学出版社 / 2004-8 / 49.00元

Beginning graduate students in mathematics and other quantitative subjects are expected to have a daunting breadth of mathematical knowledge ,but few have such a backgroud .This book will help stedent......一起来看看 《数学拾遗》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具