当前位置:网站首页>Redis下载与安装
Redis下载与安装
2022-07-30 05:49:00 【Leo丶fei】
Redis下载
Redis安装包分为windows版和Linux版:
Windows版下载地址:https://github.com/microsoftarchive/redis/releases
Linux版下载地址:https://download.redis.io/releases/
在Linux中安装Redis
在Linux系统安装Redis步骤:
将Redis安装包上传到Linux
解压安装包,命令:==tar -zxvf redis-4.0.0.tar.gz -C /usr/local==
安装Redis的依赖环境gcc,命令:==yum install gcc-c++==
进入/usr/local/redis-4.0.0,进行编译,命令:==make==
进入redis的src目录进行安装,命令:==make install==
安装后重点文件说明:
/usr/local/redis-4.0.0/src/redis-server:Redis服务启动脚本
/usr/local/redis-4.0.0/src/redis-cli:Redis客户端脚本
/usr/local/redis-4.0.0/redis.conf:Redis配置文件
通过启动日志可以看到,Redis默认端口号为==6379==。
==Ctrl + C==停止Redis服务
通过==redis-cli==可以连接到本地的Redis服务,默认情况下不需要认证即可连接成功。
退出客户端可以输入==exit==或者==quit==命令。
Redis配置文件
前面我们已经启动了Redis服务,默认情况下Redis启动后是在前台运行,而且客户端不需要密码就可以连接到Redis服务。如果我们希望Redis服务启动后是在后台运行,同时希望客户端认证通过后才能连接到Redis服务,应该如果做呢?
此时就需要修改Redis的配置文件:
Linux系统中Redis配置文件:REDIS_HOME/redis.conf
Windows系统中Redis配置文件:REDIS_HOME/redis.windows.conf
通过修改Redis配置文件可以进行如下配置:
1)设置Redis服务后台运行
将配置文件中的==daemonize==配置项改为yes,默认值为no。
注意:Windows版的Redis不支持后台运行。
2)设置Redis服务密码
将配置文件中的 ==# requirepass foobared== 配置项取消注释,默认为注释状态。foobared为密码,可以根据情况自己指定。
3)设置允许客户端远程连接Redis服务
Redis服务默认只能客户端本地连接,不允许客户端远程连接。将配置文件中的 ==bind 127.0.0.1== 配置项注释掉。
解释说明:
Redis配置文件中 ==#== 表示注释
Redis配置文件中的配置项前面不能有空格,需要顶格写
daemonize:用来指定redis是否要用守护线程的方式启动,设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行
requirepass:设置Redis的连接密码
bind:如果指定了bind,则说明只允许来自指定网卡的Redis请求。如果没有指定,就说明可以接受来自任意一个网卡的Redis请求。
注意:修改配置文件后需要重启Redis服务配置才能生效,并且启动Redis服务时需要显示的指定配置文件:
1)Linux中启动Redis服务
# 进入Redis安装目录
cd /usr/local/redis-4.0.0
# 启动Redis服务,指定使用的配置文件
./src/redis-server ./redis.conf
边栏推荐
- GadgetInspector原理分析
- Test Development Engineer Growth Diary 003 - Interface Automation Framework Construction
- Test the basics 02
- 04-加壳和脱壳
- PC DBCO-PEG3-Biotin|PC-生物素-PEG3-DBCO可用于使用无铜点击化学
- 陕西Biotin-LC_CAS:72040-64-3_N-生物素氨基己酸供应商价格
- Mastering JESD204B (3) – Debugging of AD6676
- 网络协议04 - 物理层和数据链路层
- Network Protocol 01 - Basic Concepts
- MongoDB-CUD without R
猜你喜欢
Rapidly develop GraphScope graph analysis applications
Azide-SS-biotin|CAS:1620523-64-9|生物素-二硫键-叠氮可降解 (cleavable) 的 ADC linke
Shortcut keys commonly used in the use of Word
Interactively compose graphs in GraphScope based on the JupyterLab plugin
How to create a shortcut without the "shortcut" suffix?
Selenium02
How to save modelsim simulation data as a file
作为测试leader,考察求职者的几个方面
多线程进阶(锁策略,自旋+CAS,Synchronized,JUC,信号量)
Build an intelligent network security management and control system for digital government
随机推荐
arthas常用命令
测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
多线程基础(概念,创建,中断)
Vineyard: 开源分布式内存数据管理框架
如何将modelsim仿真数据存成文件
进程和计划任务管理
MongoDB-CUD without R
Rapidly develop GraphScope graph analysis applications
Mastering JESD204B (3) – Debugging of AD6676
MySql connecting to the server remotely
Test the basics 01
网络协议01 - 基础概念
A New Paradigm for Distributed Deep Learning Programming: Global Tensor
OP tokens and non-transferable NFTs work to build a new digital democracy
prometheus-Federation机制配置
Ingress:从静态图分析到动态图分析
Graph analysis like NetworkX with GraphScope
Network Protocol 04 - Physical and Data Link Layers
Dachang's annual salary of 50w+ recruits test engineers with test platform development capabilities
Build an intelligent network security management and control system for digital government