当前位置:网站首页>【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
如有错误,欢迎指正!
边栏推荐
- OpenJudge NOI 2.1 1749:数字方格
- Rust language - receive command line parameter instances
- datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在
- 烧录场景下的源代码防泄密方案分享
- Sélectionnez toutes les lignes avec un symbole dans Word et changez - les en titre
- Typescript interface properties
- Le chemin du navigateur Edge obtient
- C # create database connection object SQLite database
- 【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
- Jerry needs to modify the profile definition of GATT [chapter]
猜你喜欢

Oracle column to row -- a field is converted to multiple rows according to the specified separator

Summary of Digital IC design written examination questions (I)

How MySQL merges data

软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历

成为优秀的TS体操高手 之 TS 类型体操前置知识储备

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

TypeScript接口与泛型的使用

Seriously recommend several machine learning official account

Bugku CTF daily question: do you want seeds? Blackmailed

Typescript interface and the use of generics
随机推荐
Memory error during variable parameter overload
Significance and measures of encryption protection for intelligent terminal equipment
HTTP cache, forced cache, negotiated cache
leecode-C语言实现-15. 三数之和------思路待改进版
Typescript variable scope
[computer skills]
Google may return to the Chinese market after the Spring Festival.
杰理之BLE【篇】
Ble of Jerry [chapter]
How can word delete English only and keep Chinese or delete Chinese and keep English
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
TypeScript 函数定义
Google可能在春节后回归中国市场。
TypeScript 变量作用域
Related operations of Excel
Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume
Ble of Jerry [chapter]
Word delete the contents in brackets
Markdown 中设置图片图注
Simulation of Teman green interferometer based on MATLAB