当前位置:网站首页>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
边栏推荐
- Sequential storage of stacks
- You don't know the complete collection of recruitment slang of Internet companies
- 从“跑分神器”到数据平台,鲁大师开启演进之路
- On the discrimination of "fake death" state of STC single chip microcomputer
- Experience sharing of contribution of "management world"
- [SQL practice] a SQL statistics of epidemic distribution across the country
- CloudCompare-点对选取
- @Detailed differences between pathvariable and @requestparam
- cf:C. Column Swapping【排序 + 模拟】
- Cf:c. column swapping [sort + simulate]
猜你喜欢
随机推荐
DC-7靶机
A very good JVM interview question article (74 questions and answers)
jmeter 函数助手 — — 随机值、随机字符串、 固定值随机提取
C. colonne Swapping [tri + Simulation]
对称的二叉树【树的遍历】
Financial risk control practice - decision tree rule mining template
JVM命令之 jinfo:实时查看和修改JVM配置参数
CloudCompare-点对选取
When we talk about immutable infrastructure, what are we talking about
[FPGA] EEPROM based on I2C
职场经历反馈给初入职场的程序员
Jinfo of JVM command: view and modify JVM configuration parameters in real time
计算模型 FPS
Database notes 04
3531. Huffman tree
CTFshow--常用姿势
JVM命令之 jstack:打印JVM中线程快照
rt-thread 中对 hardfault 的处理
Cloud acceleration helps you effectively solve attack problems!
tkinter窗口选择pcd文件并显示点云(open3d)