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

边栏推荐
- Crudini 配置文件编辑工具
- k8s运行oracle
- 你不知道的互联网公司招聘黑话大全
- Solve pod install error: FFI is an incompatible architecture
- 基于ADAU1452的DSP及DAC音频失真分析
- 开发者别错过!飞桨黑客马拉松第三期链桨赛道报名开启
- Test the foundation of development, and teach you to prepare for a fully functional web platform environment
- Go language learning notes - Gorm use - native SQL, named parameters, rows, tosql | web framework gin (IX)
- Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou
- 绕过open_basedir
猜你喜欢

693. Travel sequencing

The solution of a simple algebraic problem

苹果cms V10模板/MXone Pro自适应影视电影网站模板

Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();

@pathvariable 和 @Requestparam的详细区别

Software testing knowledge reserve: how much do you know about the basic knowledge of "login security"?

Subghz, lorawan, Nb IOT, Internet of things
![[SOC FPGA] custom IP PWM breathing lamp](/img/4b/5053137cf95e851ca89057e9b9c15c.jpg)
[SOC FPGA] custom IP PWM breathing lamp

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

10W word segmentation searches per second, the product manager raised another demand!!! (Collection)
随机推荐
CloudCompare-点对选取
Party A's requirements for those who have lost 800 yuan
高并发大流量秒杀方案思路
VMware安装后打开就蓝屏
Solve pod install error: FFI is an incompatible architecture
JVM命令之- jmap:导出内存映像文件&内存使用情况
CMD permanently delete specified folders and files
Chain storage of stack
Qt多线程的多种方法之一 QThread
Markdown displays pictures side by side
基于ADAU1452的DSP及DAC音频失真分析
laravel 使用腾讯云 COS5全教程
绕过open_basedir
[SOC FPGA] custom IP PWM breathing lamp
Experience sharing of contribution of "management world"
安装mongodb数据库
10W word segmentation searches per second, the product manager raised another demand!!! (Collection)
A very good JVM interview question article (74 questions and answers)
测试开发基础,教你做一个完整功能的Web平台之环境准备
How to set up in touch designer 2022 to solve the problem that leap motion is not recognized?