Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the usage scenarios of Docker High availability configuration Center Etcd

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what are the Etcd usage scenarios of Docker High availability configuration Center?". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

One: brief introduction

Etcd is an open source distributed key-value repository for configuring sharing and service discovery. Usually deployed in the form of a cluster, each worker node will choose a leader node to lead the work. It is usually used to store database connection configuration, cache configuration, general configuration information, etc.

The characteristics of Etcd are:

1. Simplicity: HTTP+JSON-based API that can be easily used with the curl command

two。 Security: optional SSL customer authentication mechanism

3. Fast: each instance supports 1000 writes per second

4. Trustworthiness: fully distributed using Raft algorithm

Etcd mainly solves the problem of data consistency in distributed system, and the data in distributed system is divided into control data and application data. The data processed by Etcd defaults to control data, and for application data, it is only recommended to handle situations where the amount of data is small but accessed frequently.

Second: Etcd usage scenarios

1. Service discovery

Processes or services in the same distributed cluster perceive each other and establish connections, which is called service discovery. In essence, service discovery is to find out whether there are processes in the cluster listening on UDP or TCP ports, and to find and connect through the corresponding string information. Solving the problem of service discovery requires the following aspects:

a. A highly consistent, highly available service storage directory

b. A mechanism for registering services and monitoring the health status of services

c. A mechanism for finding and connecting services

1. Message publishing and subscription

In the distributed system, the most suitable communication mode between components is the message publishing and subscribing mechanism. Specifically, build a configuration sharing center, where data providers publish messages, while message consumers subscribe to their related topics, and notify subscribers in real time as soon as messages on related topics are published. In this way, the centralized management and real-time dynamic update of distributed system configuration can be realized.

two。 Load balancing

3. Distributed notification and coordination

The Watcher mechanism in etcd is used to realize the notification and coordination among different systems in the distributed environment through registration and asynchronous notification mechanism, so as to deal with data changes in real time.

a. Low-coupling heartbeat detection by etcd

The detection system and the detected system are associated rather than directly associated with a directory on the etcd, which can greatly reduce the coupling of the system.

b. Complete system scheduling through etcd

Managers do some operations in the console, in fact, only need to modify the status of some directory nodes on the etcd, etcd will automatically notify these changes to the Watcher-registered push system client, and the push system will make the corresponding push task.

c. Complete the work report through etcd

Most similar task distribution systems will register a temporary working directory in etcd on subtasks, and report their progress regularly (that is, write progress to this temporary directory), so that task managers can know the progress of the task in real time.

4. Distributed Lock and campaign

a. Keep exclusive lock

b. Control sequence lock

The Leader campaign can be completed by using distributed locks. For some long-time CPU calculations or using ILeader O operations, you only need to calculate or process the elected Leader once, and then copy the results to other Follower, so as to avoid repetitive work and save computing resources.

5. Distributed queue

6. Cluster monitoring

Third: Etcd architecture

The terms involved in Etcd are:

1. The algorithm adopted by Raft:etcd to ensure the strong consistency of distributed systems.

2. Node: an instance of a Raft state machine

3. Member: an etcd instance that manages a Node and can provide services for client requests

4. Cluster: an etcd cluster composed of multiple Member that can work together

5. Peer: a term for another Member in the same etcd cluster

6. Client: the client that sends HTTP requests to the etcd cluster

7. WAL: pre-written log, which is the log format used by etcd for persistent storage

8. Snapshot: etcd prevents snapshots of too many WAL files and stores the state of etcd data

9. A mode of Proxy:etcd that provides reverse proxy services for etcd clusters

10.Leader: a node in the Raft algorithm that handles all data submissions generated by election.

11.Follower: as subordinate nodes in Raft, the losing node provides strong consistency guarantee for the algorithm.

When 12.Candidate:Follower fails to receive Leader's heartbeat for more than a certain period of time, it changes to Candidate to start the Leader campaign.

13.Term: a node becomes the time period from Leader to the start of the next election, becomes a Term

14. Index: data item number. Term and Index are used to locate data in Raft.

This is the end of the content of "what are the usage scenarios of Etcd in the Docker High availability configuration Center". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 254

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report