当前位置:网站首页>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 !
边栏推荐
- 2022杭电多校第一场Dragon slayer(dfs+状态压缩)
- MySQL optimization series (2) -- InnoDB important parameter optimization
- Template syntax [easy to understand]
- Ionic4 learning notes 4 -- add a tab page
- 7. Character coding?
- 【TkInter】常用组件(一)
- [Tkinter] common components (II)
- 8. = = and = = =?
- core dump
- Escape character in JS?
猜你喜欢

Windowing function (1) - top three employees of department salary

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

网络安全80端口—-PHP CGI参数注入执行漏洞

微信小程序逆向

Typora 它依然是我心中的YYDS 最优美也是颜值最高的文档编辑神器 相信你永远不会抛弃它

Escape character in JS?

ETL development tool kettle download installation environment construction and use tutorial

全国职业院校技能大赛网络安全竞赛——Apache安全配置详解

matplotlib

Ionic4 learning notes 5-- custom public module
随机推荐
深度学习中Dropout原理解析
Space three point circle code
Understand corners_ Align, two perspectives for viewing pixels
Type-C PD protocol chip while charging and listening
Tree chain partition board
Typora 它依然是我心中的YYDS 最优美也是颜值最高的文档编辑神器 相信你永远不会抛弃它
Ionic4 learning notes 7 -- UI component 1 (no practice, direct excerpt)
根证书的有效期与服务器SSL证书一样长吗?
Template inheritance and import
Eternal Blue ms17-010exp reappears
使用der格式公钥生成publicKey报错
Getting started with MySQL database
KiB、MiB与KB、MB的区别
16. What is the difference between target and currenttarget?
3. Variable declaration promotion?
字符串的遍历及拼接
Some buckles
Getaverse,走向Web3的远方桥梁
How to solve the problem that yaml in idea is unrecognized or red?
epoch,batch_ size