当前位置:网站首页>安装单机redis详细教程
安装单机redis详细教程
2022-07-02 18:23:00 【夏诗曼CharmaineXia】
1.下载安装包
①在本机新建目录
mkdir /home/admin/redis
②去官网上下载安装包:https://redis.io/download/
③把安装包复制到当前虚拟机的/home/admin/redis目录下
2.解压redis
①切换redis目录下,解压安装包
cd /home/admin/redis
tar -zxvf redis-5.0.7.tar.gz
3.安装基本环境
①安装gcc编译器
yum install gcc-c++
查看是否安装成功:gcc -v
(gcc是可以在多种硬体平台上编译出可执行程序的超级编译器,Gcc编译器能将C、C++语言源程序、汇程式化序和目标程序编译、连接成可执行文件,redis是C语言写的)
②生成src文件
cd redis-5.0.7
make
make install
③redis的默认安装路径
cd /usr/local/bin
4.备份redis配置文件
①创建新目录用于修改配置文件
mkdir /home/admin/redis/redis-5.0.7/theRedisConf
②把配置文件复制过去(原生的文就放在解压目录下做备份,启动用theRedisConf下的配置文件)
cp /home/admin/redis/redis-5.0.7/redis.conf /home/admin/redis/redis-5.0.7/theRedisConf/
5.修改redis配置文件
vi /home/admin/redis/redis-5.0.7/theRedisConf/redis.conf
## 修改1:注释如下行,注释以后redis不可以接收任意ip的连接
# bind 127.0.0.1
## 修改2:关闭保护模式(如果设置为yes,那么只允许我们在本机的回环连接,其他机器无法连接。)
protected-mode no
## 修改3:开启redis服务后台运行
daemonize yes
## 修改4:添加日志路径,便于排查问题
logfile “/home/admin/redis/redis-5.0.7/redis.log”
5.启动redis服务
① 开启防火墙
systemctl start firewalld.service
②开放指定端口号
查看已开放端口号
firewall-cmd --list-ports
开放指定端口号,下方示例端口号为6379
firewall-cmd --zone=public --add-port=6379/tcp --permanent
③重启防火墙
端口号才算开放成功
firewall-cmd --reload
④启动服务
cd /usr/local/bin/
./redis-server /home/admin/redis/redis-5.0.7/theRedisConf/redis.conf
6.如何查看redis进程
ps -ef|grep redis
7.如何关闭redis服务
①进入客户端
redis-cli -p 6379或者进到src下执行 ./redis-cli -p 6379
②关闭redis服务
shoutdown
③退出客户端
exit
不进入客户端关闭redis
redis-cli shutdown
边栏推荐
- MySQL advanced learning summary 7: MySQL data structure - Comparison of hash index, AVL tree, B tree and b+ tree
- 开发固定资产管理系统,开发固定资产管理系统用什么语音
- metric_ Logger urination
- Golang并发编程——goroutine、channel、sync
- Introduction to the paper | analysis and criticism of using the pre training language model as a knowledge base
- Fastdfs installation
- 注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
- 消息队列消息丢失和消息重复发送的处理策略
- [100 cases of JVM tuning practice] 01 - introduction of JVM and program counter
- A4988驱动步进电机「建议收藏」
猜你喜欢
ICDE 2023|TKDE Poster Session(CFP)
End to end object detection with transformers (Detr) paper reading and understanding
Talk about the design of red envelope activities in e-commerce system
Introduction to the paper | application of machine learning in database cardinality estimation
消息队列消息丢失和消息重复发送的处理策略
中国信通院《数据安全产品与服务图谱》,美创科技实现四大板块全覆盖
High frequency interview questions
Watchful pioneer world outlook Architecture - (how does a good game come from)
冒泡排序数组
教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5
随机推荐
云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统
Qpropertyanimation use and toast case list in QT
冒泡排序数组
Binary operation
mybatiesHelperPro工具必须的可以生成到对应项目文件夹下
教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 网络安全专家 NSE 5
Usage of ieda refactor
Progress progress bar
注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
Markdown basic grammar
MySQL advanced (Advanced) SQL statement
What is the MySQL backup suffix_ MySQL backup restore
Golang:[]byte to string
性能测试如何创造业务价值
A4988驱动步进电机「建议收藏」
mysql备份后缀是什么_mysql备份还原
Emmet基础语法
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
《重构:改善既有代码的设计》读书笔记(上)
数字滚动带动画