当前位置:网站首页>【Redis】NoSQL数据库和redis简介
【Redis】NoSQL数据库和redis简介
2022-07-06 07:35:00 【Decade0712】
一、NoSQL数据库
1、NoSQL的定义
NoSQL意为Not Only SQL(不仅仅是SQL),泛指非关系型数据库
区别于关系数据库,它并不依赖于业务逻辑来存储有关联的数据,而是以key-value键值对的形式进行数据存储,大大增加了数据库的扩展能力
2、NoSQL数据库的作用
- 作为缓存使用,提高访问速度,减少IO的读操作
- 减少CPU和IO的压力,直接通过内存读取数据
3、NoSQL数据库的特点
- 不遵循SQL的标准
- 不支持ACID
A (Atomicity) 原子性
C (Consistency) 一致性
I (Isolation) 独立性
D (Durability) 持久性 - 远超SQL的性能
4、适用场景
- 对数据有高并发的读写,例如电商的秒杀操作
- 需要读写海量的数据
- 对数据有高可扩展性要求
5、不适用场景
- 需要事务的支持
- 基于sql的结构化查询存储,处理复杂的关系,需要即席查询(即席查询(Ad Hoc)是用户根据自己的需求,灵活的选择查询条件)
6、常见NoSQL数据库
- Redis
- MongoDB
二、redis数据库简介
1、概念
redis是一种开源的key-value存储系统
它存储的value支持五种数据格式:包括string(字符串)、list(链表)、set(集合)、zset(sort set,有序集合)和hash(哈希类型)
2、redis可以把数据存储在内存中,也可以周期性地把数据写入到磁盘中(持久化),另外还实现了master-slave(主从)同步
3、安装redis
进入redis官网:下载地址
找到稳定的最新版redis,下载到本地,然后将压缩包上传到Linux虚拟机中,然后开始我们的安装
安装C语言编译环境,使用命令
yum install gcc
安装完成之后,使用命令查看gcc版本gcc --version
使用解压命令将压缩包解压到指定路径

注意 这里要有一个-C这个参数,否则可能会出现Not found in archive这个错误
使用make命令进行编译

使用
make PREFIX=xxx(指定路径) install命令进行安装
进入安装目录的bin路径下进行查看
reids-benchmark:性能测试工具
redis-check-aof:修复有问题的aof文件
redis-check-dump:修复有问题的dump.rdb
redis-sentinel:redis集群使用
redis-server:redis服务器启动命令
redis-cli:redis客户端尝试前台启动redis(不推荐,因为退出后redis服务端也会关闭)
如果遇到报错
这时候就要输入命令,建立一个/usr/bin/redis-server到/opt/decade/redis/bin/redis-server的软链接,你在运行/usr/bin/redis-server的时候就是在运行/opt/decade/redis/bin/redis-serverln -s /opt/decade/redis/bin/redis-server /usr/bin/redis-server
就可以正常启动redis了
尝试后台启动redis
首先我们将redis解压目录下的redis.conf复制一份放到某个路径下,我这里是/opt/decade/cp redis.conf /opt/decade/redis.conf
使用vi redis.conf修改复制出来的那个redis.conf,调整daemonize配置项,由NO改为YES(输入vi redis之后,可以使用/要查找的内容来快速找到要找的内容)
daemonize是用来指定redis是否要用守护线程的方式启动,这样一来redis就会在后台运行了
然后我们回到redis的安装目录,使用指定的配置文件启动redis,可以看到,redis在后台运行了
尝试启动客户端
使用redis-cli命令启动客户端
关闭redis
直接使用kill -9 redis进程号
在客户端输入shutdown
使用redis-cli shutdown
使用redis-cli -p redis端口号 shutdown
如有错误,欢迎指正!
边栏推荐
- 学go之路(一)go的基本介绍到第一个helloworld
- 2022年Instagram运营小技巧简单讲解
- Summary of Digital IC design written examination questions (I)
- TypeScript 变量作用域
- JDBC learning notes
- Le chemin du navigateur Edge obtient
- [CF Gym101196-I] Waif Until Dark 网络最大流
- Typescript function definition
- word怎么只删除英语保留汉语或删除汉语保留英文
- Wonderful use of TS type gymnastics string
猜你喜欢

Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB

合规、高效,加快药企数字化转型,全新打造药企文档资源中心

jmeter性能测试步骤实战教程

Markdown 中设置图片图注

智能终端设备加密防护的意义和措施

Bugku CTF daily question: do you want seeds? Blackmailed

Google可能在春节后回归中国市场。

word中如何删除某符号前面或后面所有的文字
![If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]](/img/d6/92ad1c6f84415de6ab0dfd16cd6073.png)
If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]

Key value judgment in the cycle of TS type gymnastics, as keyword use
随机推荐
QT color is converted to string and uint
Luogu p4127 [ahoi2009] similar distribution problem solution
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
1015 reversible primes (20 points) prime d-ary
Typescript variable scope
word怎么只删除英语保留汉语或删除汉语保留英文
剪映的相关介绍
Summary of Digital IC design written examination questions (I)
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
edge瀏覽器 路徑獲得
Chrome view page FPS
Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
TS 体操 &(交叉运算) 和 接口的继承的区别
Games101 Lesson 7 shading 1 Notes
Typescript interface and the use of generics
Sharing of source code anti disclosure scheme under burning scenario
edge浏览器 路径获得
位运算异或
js对象获取属性的方法(.和[]方式)
Go learning -- implementing generics based on reflection and empty interfaces