当前位置:网站首页>安装单机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
- 使用xml文件打印mybaties-log插件的方式
- C的内存管理
- Watchful pioneer world outlook Architecture - (how does a good game come from)
- Qpropertyanimation use and toast case list in QT
- Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
- [paper reading] Ca net: leveraging contextual features for lung cancer prediction
- Quanzhi A33 uses mainline u-boot
- 教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5
- Gstore weekly gstore source code analysis (4): black and white list configuration analysis of security mechanism
猜你喜欢

《架构整洁之道》读书笔记(下)

Juypter notebook modify the default open folder and default browser

中国信通院《数据安全产品与服务图谱》,美创科技实现四大板块全覆盖

Usage of ieda refactor

Watchful pioneer world outlook Architecture - (how does a good game come from)

Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5

Transformation of thinking consciousness is the key to the success or failure of digital transformation of construction enterprises

Introduction to the paper | application of machine learning in database cardinality estimation

潇洒郎:彻底解决Markdown图片问题——无需上传图片——无需网络——转发给他人图片无缺失

使用CLion编译OGLPG-9th-Edition源码
随机推荐
[0701] [paper reading] allowing data imbalance issue with perforated input during influence
[100 cases of JVM tuning practice] 03 -- four cases of JVM heap tuning
PHP asymmetric encryption method private key and public key encryption and decryption method
注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
Quanzhi A33 uses mainline u-boot
MySQL advanced learning summary 8: overview of InnoDB data storage structure page, internal structure of page, row format
xml开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
【测试开发】一文带你了解什么是软件测试
[论文阅读] CA-Net: Leveraging Contextual Features for Lung Cancer Prediction
Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
第七章-类基础
移动机器人路径规划:人工势场法[通俗易懂]
Emmet基础语法
仿京东放大镜效果(pink老师版)
golang:[]byte转string
Virtual machine initialization script, virtual machine mutual secret key free
QT中的QPropertyAnimation使用和toast案列
冒泡排序数组
Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5