当前位置:网站首页>Server Configuration - Install Redis on Linux System
Server Configuration - Install Redis on Linux System
2022-08-08 13:04:00 【swallow】
一、准备工作
系统环境:腾讯云轻量应用服务器(CentOS 7.8 64bit)
1.1 下载 Redis 6.2.6 for Linux
Redis官方网站:Download | Redis Redis中文官方网站:CRUG网站 (CRUG网站)
1.2 Download and install the new versiongcc编译器
①查看gcc版本
The installed version is 4.8.5,需要进行升级
② 升级gcc版本
yum install centos-release-scl scl-utils-build
yum install -y devtoolset-8-toolchain
scl enable devtoolset-8 bash
#需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本
# 如果要长期使用gcc 8的话:
echo -e "\nsource /opt/rh/devtoolset-8/enable" >>/etc/profile
source /etc/profile
③测试gcc版本
gccVersion successfully upgraded to 8.3.1
二、安装Redis
2.1 上传安装包到服务器
在Windows找到下载好的 redis-6.2.6.tar.gz 压缩包,复制到服务器上的 opt 目录
2.2 tar -zxvf 解压
1.进入opt目录,You can see the compressed package after the copy is completed
2. 执行tar -zxvf 命令进行解压,tar -zxvf package name to decompress 如tar -zxvf redis-6.2.6.tar.gz
tar -zxvf redis-6.2.6.tar.gz
2.3 编译安装
解压完成后进入目录:
在redis-6.2.6目录下执行make命令进行编译
编译结束后,可以进行make test,执行make install
默认安装目录 usr/local/bin
2.4 配置
在 opt/redis-6.2.6 目录下,找到redis.conf配置文件
Copy a configuration file to another directory and modify it
Easy to find configuration items,可以将配置文件redis.conf复制到windowsAfter editing, upload it to the server again
① 修改配置文件,监听所有的IP地址
75行 for default configuration items:bind 127.0.0.1 进行注释
②将本机访问保护模式设置为 no
protected-mode默认为yes,在没有设定bind ip和密码的情况下,Redis只允许接受本机的响应
③设置 redis-server 以守护线程方式启动
257行 daemonize no 改成 yes,让服务在后台启动
④配置认证密码
901行 去掉注释,原来的foobared改成自己设置的密码
After the modification is completed, upload it to the server,Overwrite self-createdmyredis目录中的redis.conf文件
三、启动Redis
3.1 前台启动(不推荐)
redis-server 前台启动,命令行窗口不能关闭,否则服务器停止
3.2 后台启动(推荐)
用修改后的配置文件启动
3.3 登录验证
用客户端访问 redis-cli
A password was set when modifying the configuration file,客户端登录时需要使用 auth 进行登录验证
You can log in without entering,There is no operating authority
输入 auth yourpassword(配置文件中设置的密码)
登录验证 OK ,再次执行config get requirepass You can see the password you set
四、关闭Redis
4.1单实例关闭
redis-cli shutdown
也可以进入终端后再关闭
腾讯云-Lightweight application server configuration(一)——购买+配置(图文详细教程)
腾讯云-Lightweight application server configuration(二)——安装JDK
腾讯云-Lightweight application server configuration(三)——安装Tomcat腾讯云-轻量应用服务器部署Springboot项目+后台持续运行
边栏推荐
- "Huashu Cup" modeling learning (Matlab)
- IJCAI 2022 | 基于随机游走聚合的图神经网络
- MySQL Dual-Master 双向同步
- node中package解析、npm 命令行npm详解,node中的common模块化,npm、nrm两种方式查看源和切换镜像
- Docker - persistent database (data volume)
- Jenkins - Introduction to Continuous Integration (1)
- leetcode 1584. 连接所有点的最小费用
- MySQL database storage series (5) the InnoDB storage format
- xxd命令(反编译、二进制文件转十六进制文件)
- Jenkins - install (2)
猜你喜欢
随机推荐
leetcode 1584. 连接所有点的最小费用
萤石、小米对垒智能摄像头
【重构map】【重构filter】【重构Some】【重构reduce方法】【重构flat函数】
win10安装Solidworks2016安装出错:solidworks\sldfuncfeat.dll“ 已返回 0x3,如何解决.
北京 北京超大旧货二手市场开集了,上千种产品随便选,来的人还真不少
字符串函数、字符函数、内存函数的使用及其模拟实现
(5)FlinkSQL将socket数据写入到mysql方式二
【C语言】深度剖析数据在内存中的存储
将小部分源码设计精髓带入到开发中来(工厂模式、适配器模式、抽象类、监听器)
三个点语法和DOM观察者
JSON的Unicode问题;自定义排序问题;保留最大子集问题
OFD是什么
MeterSphere--开源持续测试平台
STM32的内存管理相关(内存架构,内存管理,map文件分析)
【cookie 临时存储数据,WebStorage ,sessionStorage】
一文搞懂│XSS攻击、SQL注入、CSRF攻击、DDOS攻击、DNS劫持
(6)FlinkSQL将kafka数据写入到mysql方式一
面试官问你什么是长轮询?
curl获取harbor镜像仓库项目下的镜像列表
【C语言】动态内存管理