当前位置:网站首页>[redis] redis installation
[redis] redis installation
2022-07-25 16:42:00 【StudyWinter】
1 redis Introduction
redis It's a key-value The storage system . and Memcached similar , It supports storage value There are more types , Include string( character string )、list( Linked list )、set( aggregate )、zset(sorted set -- Ordered set ) and hash( Hash type ). these data type All support push/pop、add/remove And take intersection, union and difference sets and more abundant operations , And these operations are atomic . On this basis ,redis Support various sorts of sorting . And memcached equally , To ensure efficiency , The data is cached in memory . The difference is redis Periodically, updated data is written to disk or changes are written to an appended log file , And on this basis to achieve master-slave( Master-slave ) Sync .
Redis Is a high-performance key-value database . redis Appearance , A lot of compensation memcached This kind of key/value Insufficient storage , In some cases, it can play a very good complementary role to the relational database . It provides Java,C/C++,C#,PHP,JavaScript,Perl,Object-C,Python,Ruby,Erlang Such as the client , Easy to use .
Redis Support master-slave synchronization . Data can be synchronized from the master server to any number of slaves , A slave server can be the master server associated with other slaves . This makes Redis Single-layer tree replication can be performed . The disk can write to the data intentionally or unintentionally . Because it's fully realized Release / subscribe Mechanism , Enables trees to be synchronized anywhere from the database , Subscribe to a channel and receive a complete record of message publication from the master server . Synchronization helps with scalability and data redundancy for read operations .
Reprint :Redis_ Baidu Encyclopedia
1.1 redis What is it?
Redis:REmote DIctionary Server( Remote dictionary server ) It's completely open source and free , use C language-written , comply with BSD agreement , Is a high-performance (key/value) Distributed memory database , Run based on memory , And support persistent NoSQL database , It's the hottest NoSql One of the databases , Also known as data structure server .
Redis And others key - value Cache products have the following three characteristics :
Redis Support data persistence , Data in memory can be kept on disk , When you restart, you can load it again for use ;
Redis It's not just about supporting simple key-value Data of type , It also provides list,set,zset,hash Such as data structure storage ;
Redis Support data backup , namely master-slave Mode data backup .
1.2 What can I do?
Memory storage and persistence :redis Support asynchronous write data in memory to hard disk , At the same time, it does not affect the continued service
Take the latest N Data operations , Such as : You can put the latest 10 Of comments ID Put it in Redis Of List In the assembly
The simulation is similar to HttpSession This function needs to set expiration time
Release 、 Subscribe to the messaging system
Timer 、 Counter
1.3 Where to download
Redis Official website :Redis
Redis Chinese net :CRUG Website
1.4 How do you play?
data type 、 Basic operation and configuration
Persistence and replication ,RDB/AOF
Control of transactions
Copy ( Master-slave relationship )
2 redis Installation
linus:centos7
redis edition :redis-4.0.11
After downloading the compressed package on the official website , Drag into virtual machine , decompression
tar -zxvf redis-4.0.11.tar.gz
notes : The version I first installed is 6.0.9, But the later installation was unsuccessful , So I changed the version , It uses 4.0.11. The installation process is the same , The screenshot uses 6.0.9
Enter the unzipped installation package

makegcc The order was not found !!!【 This machine is missing gcc Environment 】

gcc yes linux Compiler under , yes C Compiler for , install gcc
yum install gcc-c++
Again make

Need to put the first make Clean up your files . make distclean Again after make

make install
/usr: Many of the user's applications and files are in this directory , similar windows Under the program files file

Get into opt/redis4.0.11 Next , Copy redis.conf Go to the new directory usr/etc/ Next

To configure redis-conf. Be careful , stay root Use by user vim
vim redis-conf
Modify the daemon to yes
Check with the command redis Has the process of :
ps -ef|grep redis
start-up redis
redis-server /usr/etc/redis.conf ## Start the configured , Didn't touch the original 
redis-cli -p 6379, It means that

redis yes k-v Key value pair

The process has started in the background

Turn off the redis

Look at the process again , No, redis process

3 redis Miscellaneous basics after startup
3.1 test set and get
cd /usr/local/bin
3.3 
3.2 Single process
Single process model to handle client requests . Response to events such as reading and writing Is based on epoll Function to do this .Redis The actual processing speed of depends on the execution efficiency of the main process
epoll yes Linux The kernel has made improvements to handle large quantities of file descriptors epoll, yes Linux Lower multiplexing IO Interface select/poll Enhanced version of , It can significantly improve the system when the program is only active in a large number of concurrent connections CPU utilization .
3.3 library
Default 16 A database , Similar array the following table starts from zero , The initial default is to use library zero , It can be configured in the configuration file .
3.4 A simple command
select Command switch database

dbsize Check the... Of the current database key The number of

see key Number

flushdb: Empty the current libraryflushall; Kill all the warehousesUnified password management ,16 Every library is the same password , Or both OK Or none of them can connect
Redis Indexes start from scratch
Why is the default port 6379 Nine key middle :6-m 3-e 7-r 0-z merz
边栏推荐
- Two methods of importing sqllite table from MySQL
- 【读书会第13期】+FFmpeg视频采集功能
- 测试框架-unittest-测试套件、结果输出到文件
- Wechat applet does not use plug-ins, rendering videos in rich text, image adaptation, plus version
- 柏睿数据加入阿里云PolarDB开源数据库社区
- 聊聊如何用 Redis 实现分布式锁?
- [MySQL] takes you to the database
- 邮件的收发的展现逻辑之收件箱发件箱以及回复断链的问题
- Doget and dopost
- Budget report ppt
猜你喜欢

进程之间的通信(管道详解)

Birui data joins Alibaba cloud polardb open source database community

一文理解分布式开发中的服务治理

【图像去噪】基于双立方插值和稀疏表示实现图像去噪matlab源码

7. Dependency injection

2w字详解数据湖:概念、特征、架构与案例

3D semantic segmentation - scribed supervised lidar semantic segmentation

谁动了我的内存,揭秘 OOM 崩溃下降 90% 的秘密

聊聊如何用 Redis 实现分布式锁?

如何使用 4EVERLAND CLI 在 IPFS 上部署应用程序
随机推荐
【图像隐藏】基于混合 DWT-HD-SVD 的数字图像水印方法技术附matlab代码
【obs】发送前丢帧及帧优先级
unity 最好用热更方案卧龙 wolong
Gap locks
3D 语义分割——Scribble-Supervised LiDAR Semantic Segmentation
基于SqlSugar的开发框架循序渐进介绍(13)-- 基于ElementPlus的上传组件进行封装,便于项目使用
[OBS] Reprint: what about the serious delay of OBS live broadcast and Caton?
C # simulation lottery
Budget report ppt
2W word detailed data Lake: concept, characteristics, architecture and cases
Chain game development ready-made version chain game system development detailed principle chain game source code delivery
Who moved my memory and revealed the secret of 90% reduction in oom crash
152. 乘积最大子数组
什么是链游系统开发?链游系统开发如何制作
Differences between cookies, cookies and sessions
Breakthrough in core technology of the large humanoid Service Robot Walker x
[MySQL] takes you to the database
Rosen's QT journey 100 QML four standard dialog boxes (color, font, file, promotion)
The annualized interest rate of treasury bonds is too low. Is there a financial product with a higher annualized interest rate than the reverse repurchase of treasury bonds?
Roson的Qt之旅#99 QML表格控件-TableView