当前位置:网站首页>Redis(一)——初识Redis
Redis(一)——初识Redis
2022-07-07 01:41:00 【yutao_517】
简介
Redis是一种基于键值对(key-value)的NoSQL数据库
SQL和NoSQL区别
| SQL | NoSQL | |
|---|---|---|
| 数据结构 | 结构化 | 非结构化 |
| 数据关联 | 关联的 | 无关联的 |
| 查询方式 | SQL查询 | 非SQL |
| 事务特性 | ACID | 无事务(无法满足强的一致性) |
| 存储方式 | 磁盘 | 内存 |
| 扩展性 | 垂直 | 水平 |
| 使用场景 | 数据结构固定;相关业务对数据一致性安全性较高 | 数据结构不固定;相关业务对数据一致性安全性不高;对性能有要求 |
Redis特性
- 基于键值对的数据结构服务器,value支持多种不同数据结构,功能丰富
- 单线程。每个命令具备一致性
- 低延迟,速度快(基于内存、IO多路复用、良好的编码)
- 支持数据持久化
- 支持主从集群,分片集群
- 支持多语言客户端
安装
默认启动方式
yum install gcc tcl -y
wget https://download.redis.io/releases/redis-6.2.7.tar.gz
mv redis-6.2.7.tar.gz /usr/local/src/
tar -zxvf redis-6.2.7.tar.gz
cd redis-6.2.7
make && make install
redis-server

后台启动方式
cp redis.conf redis.conf.default
vim redis.conf
#修改以下配置
bind 0.0.0.0
daemonize yes
#守护进程,修改为yes后台启动
requirepass 123456
#设置redis的访问密码
redis-server /usr/local/src/redis-6.2.7/redis.conf
ps -ef|grep redis

编写服务启动
vim /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/src/redis-6.2.7/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
然后重载系统服务
systemctl daemon-reload
现在,我们可以用下面这组命令来操作redis了:
# 启动
systemctl start redis
# 停止
systemctl stop redis
# 重启
systemctl restart redis
# 查看状态
systemctl status redis
执行下面的命令,可以让redis开机自启:
systemctl enable redis
redis-cli -h 127.0.0.1 -p 6379 -a 123456

边栏推荐
- Array proof during st table preprocessing
- 安装mongodb数据库
- go-microservice-simple(2) go-Probuffer
- PTA TIANTI game exercise set l2-003 moon cake test point 2, test point 3 Analysis
- 3531. Huffman tree
- Jcmd of JVM command: multifunctional command line
- 骑士战胜魔王(背包&dp)
- "Parse" focalloss to solve the problem of data imbalance
- Jmeter自带函数不够用?不如自己动手开发一个
- Find duplicate email addresses
猜你喜欢

The solution of a simple algebraic problem

为不同类型设备构建应用的三大更新 | 2022 I/O 重点回顾

从“跑分神器”到数据平台,鲁大师开启演进之路

Sequential storage of stacks

Peripheral driver library development notes 43: GPIO simulation SPI driver

测试开发基础,教你做一个完整功能的Web平台之环境准备

Understand the deserialization principle of fastjson for generics

SAP Spartacus checkout 流程的扩展(extend)实现介绍

3531. Huffman tree

Chain storage of stack
随机推荐
Understand the deserialization principle of fastjson for generics
Experience sharing of contribution of "management world"
SAP Spartacus checkout 流程的扩展(extend)实现介绍
JVM命令之- jmap:导出内存映像文件&内存使用情况
生活中的开销,怎么记账合适
When we talk about immutable infrastructure, what are we talking about
Open the blue screen after VMware installation
JVM命令之 jinfo:实时查看和修改JVM配置参数
外设驱动库开发笔记43:GPIO模拟SPI驱动
Markdown 并排显示图片
The solution of a simple algebraic problem
Crudini 配置文件编辑工具
安装mongodb数据库
laravel 使用腾讯云 COS5全教程
Mac version PHP installed Xdebug environment (M1 version)
C note 13
360织语发布7.0新品 为党政军、央国企打造专属“统一数字工作空间”
云加速,帮助您有效解决攻击问题!
基于FPGA的VGA协议实现
Loss function and positive and negative sample allocation in target detection: retinanet and focal loss