当前位置:网站首页>安装单机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
边栏推荐
- "Patient's family, please come here" reading notes
- 2022 compilation principle final examination recall Edition
- 2022.7.1-----leetcode. two hundred and forty-one
- A4988驱动步进电机「建议收藏」
- Transformation of thinking consciousness is the key to the success or failure of digital transformation of construction enterprises
- ICDE 2023|TKDE Poster Session(CFP)
- 《代码整洁之道》读书笔记
- 电脑使用哪个录制视频软件比较好
- Stm32g0 USB DFU upgrade verification error -2
- Markdown basic grammar
猜你喜欢
![[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)](/img/c1/a00425f2e1824a50644c8fbb15fe38.jpg)
[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)

Yunna | why use the fixed asset management system and how to enable it

注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机

线程应用实例
![[100 cases of JVM tuning practice] 02 - five cases of virtual machine stack and local method stack tuning](/img/59/6c776e0607a52962b72fbea2e64c8e.png)
[100 cases of JVM tuning practice] 02 - five cases of virtual machine stack and local method stack tuning

教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5

Juypter notebook modify the default open folder and default browser

Markdown basic grammar

End-to-End Object Detection with Transformers(DETR)论文阅读与理解

Markdown基础语法
随机推荐
MySQL advanced learning summary 8: overview of InnoDB data storage structure page, internal structure of page, row format
虚拟机初始化脚本, 虚拟机相互免秘钥
Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
How performance testing creates business value
C file input operation
Golang concurrent programming goroutine, channel, sync
Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
Typescript 之 快速入门
When converting from list to map, if a certain attribute may cause key duplication and exceptions, you can set the way to deal with this duplication
Notes de lecture sur le code propre
High frequency interview questions
PyTorch函数中的__call__和forward函数
思维意识转变是施工企业数字化转型成败的关键
End to end object detection with transformers (Detr) paper reading and understanding
[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)
Data dimensionality reduction principal component analysis
Usage of ieda refactor
[论文阅读] CA-Net: Leveraging Contextual Features for Lung Cancer Prediction
全志A33使用主线U-Boot
Learning summary of MySQL advanced 6: concept and understanding of index, detailed explanation of b+ tree generation process, comparison between MyISAM and InnoDB