当前位置:网站首页>Redis 非关系型数据库学习(一) ---- Redis 的安装
Redis 非关系型数据库学习(一) ---- Redis 的安装
2022-08-09 23:31:00 【RAIN 7】
文章目录
Redis 学习(一) ---- Redis 的安装
Redis 官方更推荐 Linux系统的使用,window不推荐。

Window安装
1、github下载 zip
redis 的 github下载地址,下载最新版zip文件即可
Releases · tporadowski/redis · GitHub
如果github不能访问,那么看下面这篇文章
2、下载好的压缩包

redis-server-exe ----> 开启redis服务
redis-cli.exe - —> redis 客户端程序
redis-check-aop.exe ----> 查看 redis 的aop文件是否正常
redi-benchmark.exe —> redis 性能测试的程序
3、开启redis服务,客户端测试是否连通
点击redis-server.exe,开启 redis服务,默认端口号是 6379

点击redis-cli.exe ,打开redis 客户端,测试是否连接
如果未打开 redis 服务,无法连接 redis

成功连接之后,通过ping命令测试是否连通

4、redis 简单操作
通过 set 和 get 的方式,在redis中进行简单存储,输入语句之后不是以分号作为结束,不能输入分号

Linux 安装
(1)环境安装 gcc
基本的环境安装gcc, 系统自带gcc版本是4.8.5,只需要更新下gcc到5.4以上即可
查看gcc版本号
gcc -v

安装gcc
yum install gcc
升级gcc
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。如果要长期使用gcc 9.3的话:
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
(2)安装 redis 源码文件
安装redis源码文件压缩包tar
wget http://download.redis.io/releases/redis-6.0.8.tar.gz

解压缩
tar xzf redis-6.0.8.tar.gz

进入redis-6.0.8 文件夹,可以看到 redis-conf 配置文件

(3)安装相关文件及运行环境
安装 redis 相关的文件以及环境,在redis-6.0.8 目录下,不是src下
make
文件安装完成,生成了 src文件

检查是否安装完成,此时已经将redis程序安装到 服务器的默认路径了,之前的文件是C源码文件
make install

(4)查看根据源码安装的 redis 相关程序
进入到redis 默认安装路径 /usr/local/bin
安装好的redis程序在这个目录下

(5)修改Redis 程序的配置文件
在当前目录下 创建 一个放配置文件的目录 myconfig
mkdir myconfig

将 /root/redis-6.0.8/redis.conf 拷贝到 当前目录的文件夹 myconfig 中
cp /root/redis-6.0.8/redis.conf myconfig

(6)修改具体配置
redis 服务默认不是后台启动的,修改配置文件
vim redis.conf
i 进入编辑模式, :wq 保存退出

开启redis-server ,通过 myconfig/redis.conf 配置文件进行开启
redis-server myconfig/redis.conf
查看redis 的进程
ps -ef | grep redis

如果忘记加配置文件,那么杀死 redis 进程重新开启
kill -9 [pid]
redis 服务已开启,我们 开启指定的端口号(-p)的redis 客户端程序
redis-cli -p 6379
成功连接,简单操作可以使用

客户端输入 shutdown 关闭 redis服务,终止 redis服务进程,按 exit 退出客户端,此时 redis 服务以及客户端进程全部结束

只输入exit 退出客户端,不关闭 redis 服务
exit
边栏推荐
- 《GB5084-2021》PDF下载
- GoLang 使用 goroutine 停止的几种办法
- 字节技术面都过了,薪资都谈好了20K*13结果还是被刷了,问HR原因是。。。
- MATLB|和她跌宕起伏最终到达人生之峰【浪漫旅途】
- Distributed database problem (2): data replication
- Linux安装Oracle和postgrepSQL数据库
- C语言学习之旅 【操作符(残缺版)】
- 【集训DAY5】堆箱子【数学】
- CST Studio Suite 2021 software installation package and installation tutorial
- WPF DataGrid using data templates
猜你喜欢
随机推荐
JVM Memory and Garbage Collection - 10. Direct Memory
NotWritableError: The current user does not have write permissions when conda creates a new environment
ES6 从入门到精通 # 12:数组的扩展方法一
错误提示:Syntax error on token “function”, delete this token
《GB5084-2021》PDF下载
【渗透工具】浏览器数据导出工具
dlopen failed: library “libtaml.so“ not found
KingbaseGIS Jin Cang database using manual (6.3. Geometric object creation function)
Dry goods!Towards robust test-time adaptation
New window Display Agreement
程序员从佩洛西窜访事件中可以学到什么?
conda新建环境时报错NotWritableError: The current user does not have write permissions
第十二,十三章 mysql数据类型,视图的课后练习
【集训DAY5】快速排序【模拟】【数学】
Leecode-205. 同构字符串
如何抑制告警风暴?
【集训DAY3】阶乘【数学】
安全知识培训——消防安全
生成树和交换的总结
【问题解决】训练和验证准确率很高,但测试准确率很低








![MATLB|And her ups and downs and finally reached the peak of life [Romantic Journey]](/img/10/55cc34a929768d89d9ffde8a5b3419.png)
