Redis实现广告缓存

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

内容简介:打开配置文件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


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

查看所有标签

猜你喜欢:

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

Python带我起飞

Python带我起飞

李金洪 / 电子工业出版社 / 2018-6 / 79

《Python带我起飞——入门、进阶、商业实战》针对Python 3.5 以上版本,采用“理论+实践”的形式编写,通过大量的实例(共42 个),全面而深入地讲解“Python 基础语法”和“Python 项目应用”两方面内容。书中的实例具有很强的实用性,如对医疗影像数据进行分析、制作爬虫获取股票信息、自动化实例、从一组看似混乱的数据中找出规律、制作人脸识别系统等。 《Python带我起飞——......一起来看看 《Python带我起飞》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具