当前位置:网站首页>Linux下redis7的安装,启动与停止
Linux下redis7的安装,启动与停止
2022-07-31 02:08:00 【小尘要自信】
Redis是一个开源的key-value存储系统。它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。在学习之前安装redis就显得非常重要了。本文将以安装redis7为例。
1.redis下载
官网地址:https://redis.io/download/
如果觉得下载麻烦,我已经提供了Redis安装包下载:
版本:redis-7.0.4.tar
下载地址:
链接:https://pan.baidu.com/s/1DCIxRXokzsTfGrdQ-Eh3eA
提取码:ajpl
1.官网点击下载:
2.下载完成之后,打开xhell连接Linux,通过xftp把我们下载好的Redis压缩包,上传到Linux的 /opt/ 文件目录下(文件路径不固定)
关于xhell与xfpt的下载见:
3.进入到/mnt/ 文件目录中,解压 redis-5.0.0.tar.gz,并把redis-5.0.0移动到/usr/local/ 目录下
2.安装gcc环境
由于redis是由C语言编写的,它的运行需要C环境,因此我们需要先安装gcc。安装命令如下:
1.检查是否有gcc环境:gcc --version
出现以下表示有。则无需安装
2.如果提示gcc不是内部命令,则需要安装,命令:yum install gcc
3.安装redis
1.首先我们进入我们的redis压缩包存放位置(之前上传的)
2.执行解压缩,命令:tar -zxvf redis-7.0.4.tar.gz
3.进入到解压后的目录,执行make命令进行编译
如果没有准备好C语言编译环境,make 会报错—Jemalloc/jemalloc.h:没有那个文件
解决办法:
首先看:gcc是否安装成功,成功后
运行make distclean, 将编译文件清除掉,然后再在redis-7.0.4目录下再次执行make命令(只是编译好)
4.跳过make test 继续执行: make install
以下表示安装成功:默认安装目录:/usr/local/bin
进入目录查看:
文件介绍:
redis-benchmark:性能测试工具,可以在自己本子运行,看看自己本子性能如何
redis-check-aof:修复有问题的AOF文件
redis-check-dump:修复有问题的dump.rdb文件
redis-sentinel:Redis集群使用
redis-server:Redis服务器启动命令
redis-cli:客户端,操作入口
现在就安装完成啦!
3.启动redis(前台启动与后台启动)
前台启动(不推荐)
用该启动方式:命令行窗口不能关闭,否则服务器停止.而且这个窗口也不能就行其他操作
在bin目录下执行 redis-server
启动成功:
默认端口号:6379
后台启动(推荐)
1.进入到redis的安装目录下,cd /opt/redis-7.0.4/
找到文件redis.conf,重要是修改这个文件,为了方便我们可以将该文件复制到某一目录下进行操作。我这里选择复制到etc下
2.进入到etc目录下,修改文件redis.conf,设置daemonize no改成yes
执行:vim redis.conf 命令,由于文件内容多,可以通过快速搜索输入:/daem加回车快速定位到需要修改的内容。
3.保存退出完成修改后通过配置文件启动redis
进入到:cd /usr/local/bin目录下,执行redis-server /etc/redis.conf
这样就完成了redis的启动,通过ps -ef | grep redis查看是否启动
通过redis-cli连接redis
4.关闭redis(两种方式)
第一种.执行shutdown
第二种.先找到进程号:ps -ef | grep redis
kill -9 9468
以上就是Linux下安装Redis的全过程,希望对大家安装Redis有所帮助。欢迎评论留言。
边栏推荐
- 【Map与Set】之LeetCode&牛客练习
- ShardingJDBC使用总结
- Maximum monthly salary of 20K?The average salary is nearly 10,000... What is the experience of working in a Huawei subsidiary?
- Teach you how to configure Jenkins automated email notifications
- Drools基本介绍,入门案例,基本语法
- Drools basic introduction, introductory case, basic syntax
- Shell script to loop through values in log file to sum and calculate average, max and min
- 项目开发软件目录结构规范
- The real CTO is a technical person who understands products
- 简易表白小页面
猜你喜欢
[WeChat applet] This article takes you to understand data binding, event binding, event parameter transfer, and data synchronization
用户交互+格式化输出
General introduction to the Unity interface
ShardingJDBC基本介绍
【Map与Set】之LeetCode&牛客练习
基于FPGA的图像实时采集
Nacos
934. 最短的桥
f.grid_sample
Crypto Life, a day in the life of a Web3 project partner
随机推荐
Crawler text data cleaning
Verify the integer input
MySql的安装配置超详细教程与简单的建库建表方法
进程间通信学习笔记
Arbitrum 专访 | L2 Summer, 脱颖而出的 Arbitrum 为开发者带来了什么?
Detailed explanation of STP election (step + case)
MySQL stored procedure
leetcode-1161: Maximum in-layer element sum
Software Testing Defect Reporting - Definition, Composition, Defect Lifecycle, Defect Tracking Post-Production Process, Defect Tracking Process, Purpose of Defect Tracking, Defect Management Tools
Fiddler captures packets to simulate weak network environment testing
什么是理想的大学生活?
mmdetection训练一个模型相关命令
ShardingJDBC使用总结
The final exam first year course
Software testing basic interface testing - getting started with Jmeter, you should pay attention to these things
用户交互+格式化输出
《云原生的本手、妙手和俗手》——2022全国新高考I卷作文
软件测试缺陷报告---定义,组成,缺陷的生命周期,缺陷跟踪产后处理流程,缺陷跟踪处理流程,缺陷跟踪的目的,缺陷管理工具
MySql的初识感悟,以及sql语句中的DDL和DML和DQL的基本语法
Programmer's debriefing report/summary