当前位置:网站首页>Crazy God redis notes 11
Crazy God redis notes 11
2022-07-24 18:42:00 【Matcha flavored watermelon juice】

append:
We can also configure in our configuration file :
We don't open it by default .
Let's change it to yes:

Just doing this step will open our aof.
We delete the previous rdb.
Restart our redis after :


If the file is normal , restart redis You can recover .

Finally, remember to modify the file we modified .
Rewriting rule ( Understanding can ):
aof The default is unlimited file append , The file will get bigger and bigger !
If aof File is larger than 64m, It's too big !fork A new process to rewrite our files .
In master-slave replication ,rdb It's a spare !
Expand :
redis Subscription Publishing :

So let's test that out :
Now let's create a subscriber :
Then we create a publisher at another terminal :
After we release , We can see the information just released here .
We can understand this part . In the future, the message is mq To do it .
redis Cluster environment construction :

We only have such a configuration file now , We will open three configuration files later redis service , Make a sense of pseudo cluster .
Next, let's configure the environment :
Only configure slave Libraries , No need to configure the main library .
We can view the information of the current library :
We can see that it is a host , No slave .
Now let's configure , We're going to open it 4 Terminals , Three are used for service , One for testing :
We copied it first 3 Configuration files .
Let's change our 79 Configuration file for :
Our first library is to change the log file name and rdb file name .
80 The configuration file :
We need to change its port first :
Finally, let's put it in the same way 81 Just change your configuration file .
Now let's summarize what we have modified :
We are now carrying out single machine multi service , If you have conditions, you can try multi machine and multi service :
Now let's turn on all three .
At present, we can see that our three services have been set up .
Now we have forged one The pseudo cluster mode of one master and two slaves .

Now our three are hosts .
By default , Each station redis Servers are all primary nodes . Generally, we only need to configure the slave .
Recognize the boss ! One master and two subordinates . Here we let our 79 Bit host . So we only need to configure the slave :

We can see it role It has become a slave . And you can see its corresponding host port number and host address .
Let's take a look at the information changes in the host ;

We can also see the information of the above slave .
We put 81 Just do the same configuration .
The real master-slave configuration should be configured in the configuration file , It's permanent , Here we use commands to configure , Is temporary .
details :
The host can write , The slave can't write, only read ! All the information and data in the host , Will be automatically saved by the slave machine .

I set the value in the host .
We can also get the value set by the host in the slave .
And you can see that the slave can only read but not write .
Our host is now turned off .

Our slave is still normal .
And we can still get the value .
Let's restart the host :


We can still get our value .
test : The host is disconnected , The slave can still connect to the host . But there is no write operation , This is the time , If the mainframe comes back , The slave can still get the information written by the host directly !
But there are some unreasonable places in this place , Our host is down , You should choose a new slave as the host , We'll solve this later .
What if our slave is disconnected ?

We have only one slave left now .
The host writes a message .
At this time, we turn on the just broken slave again :
![]()
The written information in the host cannot be obtained .

Now we can see our original 80 At this time, the slave of the port has become the host , If not configured in the configuration file , It is the host .
If it's a master-slave configured using the command line , At this time, if you restart , Will become a host !
So let's think about it , If we use the command line now , Configure it as a slave and connect it to our host ?
![]()
It has become a slave .
We can get the value again .
Just change back to the slave , We can get the data in our host immediately !
边栏推荐
- 【微信小程序开发】自定义tabBar案例(定制消息99+小红心)
- 13. What is the difference between onkeydown, up and onkeypress?
- Mysqlworkbench performance analysis tool -- Performance dashboard
- 深度学习中Dropout原理解析
- 04-分布式资源管理系统YARN
- Add column by column selection for JTable
- [Tkinter] common components (II)
- [Tkinter] layout management and event system
- 【TkInter】常用组件(一)
- 【TkInter】布局管理和事件系统
猜你喜欢

Ionic4 learning notes 10 rotation map of an East Project

4. Basic type and reference type?

C Programming classic tutorial

微信小程序逆向

全国职业院校技能大赛网络安全竞赛之数据分析数字取证-A

EasyUI framework dialog repeated loading problem

Create parent-child projects in clion (cmake tool) and introduce the method of third-party libraries

Go Xiaobai implements a simple go mock server

Go小白实现一个简易的go mock server

Attack and defense world novice zone PWN
随机推荐
Typora 它依然是我心中的YYDS 最优美也是颜值最高的文档编辑神器 相信你永远不会抛弃它
使用 tftp 无法向服务器上传文件问题解决
2022杭电多校第一场Dragon slayer(dfs+状态压缩)
Wechat applet reverse
EasyUI framework dialog repeated loading problem
CF. Bits And Pieces(子集状压dp + 剪枝)
Type-C PD protocol chip while charging and listening
Ionic4 Learning Notes 6 -- using native ionic4 components in custom components
暑期牛客多校1: I Chiitoitsu(期望dp,求逆元)
2020年中职组“网络空间安全”赛项浙江省竞赛任务书及答案(Flag)
卷积神经网络感受野计算指南
[Tkinter] common components (II)
[Tkinter] common components (I)
Understand dynamic calculation diagram, requires_ grad、zero_ grad
PWN learning
Mysql——》数据类型隐式转换
Oracle EBS form common objects and their relationships
球面上绘制圆matlab仿真
Show or hide password plaintext + password box verification information
1. Typeof view variable type?