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


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

查看所有标签

猜你喜欢:

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

Java in a Nutshell, 6th Edition

Java in a Nutshell, 6th Edition

Benjamin J Evans、David Flanagan / O'Reilly Media / 2014-10 / USD 59.99

The latest edition of Java in a Nutshell is designed to help experienced Java programmers get the most out of Java 7 and 8, but it's also a learning path for new developers. Chock full of examples tha......一起来看看 《Java in a Nutshell, 6th Edition》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具