centos7下源码安装Redis

我的博客

说明

Redis官网:https://redis.io
本文章使用版本:redis-3.2.8.tar.gz
下载地址:http://download.redis.io/releases/redis-3.2.8.tar.gz

Redis安装

1. 下载
sudo wget http://download.redis.io/releases/redis-3.2.8.tar.gz
2. 安装
sudo tar -zxvf redis-3.2.8.tar.gz
cd redis-3.2.8/
sudo make
sudo make install
3. 配置

开启相关防火墙

firewall-cmd --zone=public --add-port=6379/tcp --permanent 
systemctl restart firewalld.service

服务配置

cd utils/
./install_server.sh


上图1为配置文件地址。

上图2为日志文件地址。

上图3为数据文件地址。

上图4为启动文件地址。

Redis基础配置(其他机器访问,密码,持久化)传送门:http://www.thuol.com/index/article/getcontent/id/0b7851e3ab98c9b5cfa5b582ef109bee.html

4. 启动

创建redis.service

vi /lib/systemd/system/redis.service

写入以下内容

[Unit]
Description=Redis
[Service]
Type=forking
ExecStart=/etc/init.d/redis_6379 start
ExecStop=/etc/init.d/redis_6379 stop
[Install]

第一次使用/etc/init.d/redis_6379 start启动

/etc/init.d/redis_6379 start    #启动Redis
/etc/init.d/redis_6379 stop     #关闭Redis

之后使用命令

systemctl start redis.service              #启动redis服务
systemctl enable redis.service             #设置开机自启动
systemctl disable redis.service            #停止开机自启动
systemctl status redis.service             #查看服务当前状态
5. 测试

进入客户端

redis-cli
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容