当前位置:网站首页>安装单机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
边栏推荐
- 使用CLion编译OGLPG-9th-Edition源码
- Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
- C文件输入操作
- Npoi export Excel2007
- 教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5
- 【ERP软件】ERP体系二次开发有哪些危险?
- Tutorial (5.0) 09 Restful API * fortiedr * Fortinet network security expert NSE 5
- A4988驱动步进电机「建议收藏」
- Tutorial (5.0) 10 Troubleshooting * fortiedr * Fortinet network security expert NSE 5
- Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
猜你喜欢
What is 9D movie like? (+ common sense of dimension space)
Thread application instance
Markdown basic grammar
Markdown基础语法
Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
Learning summary of MySQL advanced 6: concept and understanding of index, detailed explanation of b+ tree generation process, comparison between MyISAM and InnoDB
Excel查找一列中的相同值,删除该行或替换为空值
[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)
High frequency interview questions
9D电影是怎样的?(+维度空间常识)
随机推荐
Golang:[]byte to string
教程篇(5.0) 09. RESTful API * FortiEDR * Fortinet 网络安全专家 NSE 5
云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统
注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
9D电影是怎样的?(+维度空间常识)
End to end object detection with transformers (Detr) paper reading and understanding
Usage of ieda refactor
Markdown basic grammar
Talk about the design of red envelope activities in e-commerce system
juypter notebook 修改默认打开文件夹以及默认浏览器
Golang concurrent programming goroutine, channel, sync
数据降维——主成分分析
Binary operation
A4988驱动步进电机「建议收藏」
Introduction of Ethernet PHY layer chip lan8720a
C的内存管理
Microservice technology - distributed global ID in high concurrency
消息队列消息丢失和消息重复发送的处理策略
Learning summary of MySQL advanced 6: concept and understanding of index, detailed explanation of b+ tree generation process, comparison between MyISAM and InnoDB
[test development] takes you to know what software testing is