当前位置:网站首页>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
边栏推荐
- 980. Different path III DFS
- k8s运行oracle
- Jstack of JVM command: print thread snapshots in JVM
- On the discrimination of "fake death" state of STC single chip microcomputer
- Jstat of JVM command: View JVM statistics
- Redisl garbled code and expiration time configuration
- [FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
- Party A's requirements for those who have lost 800 yuan
- VScode进行代码补全
- New Year Fireworks code plus copy, are you sure you don't want to have a look
猜你喜欢
进程间通信之共享内存
Detailed explanation of platform device driver architecture in driver development
From "running distractor" to data platform, Master Lu started the road of evolution
Mac version PHP installed Xdebug environment (M1 version)
win系统下安装redis以及windows扩展方法
[InstallShield] Introduction
go-microservice-simple(2) go-Probuffer
[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core
C. colonne Swapping [tri + Simulation]
Three updates to build applications for different types of devices | 2022 i/o key review
随机推荐
CloudCompare-点对选取
693. 行程排序
You don't know the complete collection of recruitment slang of Internet companies
云加速,帮助您有效解决攻击问题!
Introduction to the extension implementation of SAP Spartacus checkout process
vim映射大K
解决pod install报错:ffi is an incompatible architecture
PowerPivot - DAX (function)
Jcmd of JVM command: multifunctional command line
@Detailed differences between pathvariable and @requestparam
VScode进行代码补全
Laravel uses Tencent cloud cos5 full tutorial
C language sorting (to be updated)
[Shell]常用shell命令及测试判断语句总结
Redisl garbled code and expiration time configuration
"Parse" focalloss to solve the problem of data imbalance
Array proof during st table preprocessing
从“跑分神器”到数据平台,鲁大师开启演进之路
Bypass open_ basedir
安装mongodb数据库