当前位置:网站首页>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

边栏推荐
- PowerPivot - DAX (function)
- 软件测试知识储备:关于「登录安全」的基础知识,你了解多少?
- 【GNN】图解GNN: A gentle introduction(含视频)
- Jcmd of JVM command: multifunctional command line
- Three updates to build applications for different types of devices | 2022 i/o key review
- Qt多线程的多种方法之一 QThread
- 693. 行程排序
- On the discrimination of "fake death" state of STC single chip microcomputer
- Jstat pour la commande JVM: voir les statistiques JVM
- 绕过open_basedir
猜你喜欢

Red hat install kernel header file

3428. 放苹果
![[InstallShield] Introduction](/img/df/4522d06510ff918d00659b8358368f.jpg)
[InstallShield] Introduction

苹果cms V10模板/MXone Pro自适应影视电影网站模板
![C. colonne Swapping [tri + Simulation]](/img/0e/64d17980d3ec0051cdfb5fdb34e119.png)
C. colonne Swapping [tri + Simulation]

Say sqlyog deceived me!

JVM command - jmap: export memory image file & memory usage

你不知道的互联网公司招聘黑话大全

On the discrimination of "fake death" state of STC single chip microcomputer

Rk3399 platform development series explanation (WiFi) 5.53, hostapd (WiFi AP mode) configuration file description
随机推荐
C. colonne Swapping [tri + Simulation]
[SOC FPGA] custom IP PWM breathing lamp
C note 13
C language sorting (to be updated)
693. 行程排序
JVM命令之 jstat:查看JVM统计信息
JVM命令之- jmap:导出内存映像文件&内存使用情况
Check Point:企业部署零信任网络(ZTNA)的核心要素
Jmeter自带函数不够用?不如自己动手开发一个
进程间通信之共享内存
计算模型 FPS
PowerPivot - DAX (function)
Software testing knowledge reserve: how much do you know about the basic knowledge of "login security"?
@Detailed differences between pathvariable and @requestparam
CloudCompare-点对选取
Check point: the core element for enterprises to deploy zero trust network (ztna)
jmeter 函数助手 — — 随机值、随机字符串、 固定值随机提取
Rk3399 platform development series explanation (WiFi) 5.53, hostapd (WiFi AP mode) configuration file description
JMeter function assistant - random value, random string, fixed value random extraction
基本Dos命令