当前位置:网站首页>Thinking (86): master-slave realization idea

Thinking (86): master-slave realization idea

2022-06-23 23:38:00 fananchong2

Master slave service

Game service architecture , There are usually some single point control clothes 、 Routing service, etc

These single point of service failures , It will cause the whole system to fail to work properly

These services are usually , Implement master-slave deployment , Achieve high availability

This paper introduces a general master-slave implementation

Service type

Usually , Depending on how the service processes the data , It can be classified as 2 class :

  • Stateless service
  • Stateful service

For stateless Services , Ensure that the failed service can be restarted in time

So the text is mainly aimed at stateful services , How to implement a general master-slave scheme

The problems faced by stateful servers in realizing master-slave

If the master-slave is realized from scratch , There are many challenges involved :

  • The choice of the main problem
  • The master and slave servers are in the same state

Due to node failure 、 Network partition is normal

above 2 A question , To solve the problem perfectly , It is difficult to meet the specifications in the production environment

Faced with this classic problem , There are already many products that offer solutions

among , Raft agreement , It provides an easy to understand implementation scheme

Etcd Raft modular

Etcd Achieve high availability and high reliability , It is through Raft To ensure that the

And its modules can be used directly

https://github.com/etcd-io/etcd/tree/main/contrib/raftexample Is based on Etcd Raft Modular implemented KV Examples of services

You can encapsulate a little based on this example , To realize a general master-slave framework

原网站

版权声明
本文为[fananchong2]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206232007414828.html