当前位置:网站首页>Huawei cloud IOT configuration center practice in four years

Huawei cloud IOT configuration center practice in four years

2021-04-14 12:57:48 InfoQ

{"type":"doc","content":[{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" since 17 After joining Huawei in , I've been using the configuration center ,4 During the year, we have experienced from self research and configuration center to Apollo Then to the self research configuration center and Apollo Coexisting scenes . This paper summarizes the evolution process of configuration center in recent years , I'd like to share with you some of our practices in the configuration center , Achieve common progress .Apollo Is a very good open source software , If the Apollo There are misunderstandings , I hope you can give me some advice , thank you ."}]}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" The configuration categories used "}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" From the scene classification "}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":" Operation and maintenance configuration , That is, the configuration of program read-only "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Manual configuration . Configure manually in the configuration center interface , And the program just reads , Such as database configuration 、 Mailbox server configuration 、 Network card configuration 、 Subnet address configuration, etc . This part of configuration data does not require dynamic code writing ."}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":" Business configuration , That is, the configuration that the program can write "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" We are a SaaS service , Each user has some business configuration on it . Such as the user's certificate configuration 、 Flow control configuration of user server, etc , These business configurations are relatively "},{"type":"text","marks":[{"type":"strong"}],"text":" Operation and maintenance configuration "},{"type":"text","text":" It's more complicated for me , And there may be uniqueness restrictions , By user id only . This part of configuration data is usually triggered by user operation , Dynamic code writing , And notify each microservice instance . Usually , We hope that these configurations can be displayed in the interface , And support artificial modification . If the above logic is implemented by each micro service itself , There will be a lot of duplicate code , And there's no guarantee of quality . We want a common component to unify this capability ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Whether there will be a list of configurations can be divided into single value configuration or multi value configuration "}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":" Single value configuration "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" In the whole configuration, it's just a couple of key、value.value It's not a very complicated format , It's often an integer or a string ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/ba\/bae99c658b7422d22b354cfcb09b50ad.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":" Multi value configuration "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Multi value configuration is more complex , Tend to be "},{"type":"text","marks":[{"type":"strong"}],"text":" Single value configuration "},{"type":"text","text":" In different key Next , There are different values . For example, the following configuration , User 1 and user 2 have different thread pool sizes and queues "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/98\/98a9f191c88020240bac327f5ff2dad0.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" The first stage is the self research and configuration center "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Before doing cloud services , We have fewer levels of configuration centers . We deliver to our customers in the form of software , Software running time is divided into management and business , The configuration center manages the configuration of management and business , The most complex scenario is multiple business areas , At this time, we need to ensure that different clusters 、 The configuration of different microservices does not conflict , The configuration level is cluster 、 Microservices 、 To configure ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/af\/afc0972e1657687dfb54de2bc9a1c43f.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" At this time, the configuration center is completely self-developed , Not including blue and green 、 You can configure these functions , It is unique in the following two aspects :"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Single configuration single table "}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" On the storage model , Each configuration corresponds to a data table ."}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" More friendly to multi value configuration , Especially complex business configuration , Can support a variety of primary key constraints . For single value configuration , A little bit heavier ."}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Strong configuration Schema Limit . These restrictions include types 、 size 、 length 、 Whether sensitive or not . This kind of restriction can provide a good experience for interface modification and configuration ( Such as : Different input boxes with different formats 、 Sensitive fields , Front input plaintext , Background storage encryption and so on ), It can also do sufficient verification when writing configuration through the interface ."}]}]}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Make sure the configuration is reliable through callback "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" for instance , The process of adding a configuration is like this "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/4e\/4e057fc7e6492f407937708a2b392e6f.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Maybe here , Some readers want to ask , What reliability can this process ensure . This process checks whether the configuration is reliable by calling the microservice interface , Such as IP Is the address legal 、 Whether the peer address is reachable 、 Whether the configuration quantity exceeds the specification, etc , To ensure that the configuration is basically available ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" in general , This self-developed configuration center had a good comprehensive experience at that time . But there are still some problems to be improved , For example, when there are too many configuration items in a single configuration , Because there are some interfaces in the bottom layer, all the data will pass through a single configuration http Request to host , It can cause problems such as response timeout ."}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" The second stage Apollo"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The main reason for starting the second stage of practice is , We've had an organizational switch , Business focus turns to cloud services , At the same time, team work DevOps The transformation of . The old configuration center was maintained by another team , After the organizational switch , If you want to use , We have to protect ourselves . So we need to continue to maintain the old configuration center and introduce open source Apollo Choose between . In addition to the operation and maintenance configuration and business configuration mentioned above , At this time, our needs are still changing :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The levels of configuration are getting richer "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" To build the ability to publish microservices "}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" On the one hand, the old configuration center does not provide maintenance due to organizational switching , On the other hand, it can't support rich configuration levels , And they don't have the ability to publish in grayscale . This is the time ,Apollo Some of the features of the game appeal to us , These features are exactly what the old configuration center lacks , for example ( Part of it is quoted from Apollogithub Home page )"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Rich hierarchy , from app_id To cluster,namespace,key-value The hierarchy can satisfy us region、 colony 、 The hierarchical demands of micro Services ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Support the gray distribution of configuration , For example, click post release , Only for some application instances , Wait for observation for a period of time, and then push it to all application examples ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" All configuration releases have version concepts , Thus, it is convenient to support configuration rollback ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Application and configuration management have perfect authority management mechanism , Configuration management is also divided into editing and publishing , So as to reduce human error ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" All operations have audit logs , It's easy to track problems ."}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" So we introduced Apollo, Me and my supervisor , There is another colleague involved in the work . We are Apollo Big changes have been made on the basis of open source code , The main reasons are as follows :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Cost savings , Will register center 、 Replace the database with the component we are currently using , Because these two dependencies are not Apollo Core dependency of "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Inherit the old configuration center, strong Schema The advantages of "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Keep the process of callback confirmation configuration , Intercept the wrong configuration ahead of time , Reduce the complexity of code handling exception configuration "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" adopt spi Or environment variables are compatible with the scenario of using the old configuration center in the old office "}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Combined with the above reasons , That's how we finally put it into practice :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Switch the database to postgre database 、 The registry switches to servicecomb"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" stay namespace It has been realized. Schema, Every namespace Can register the corresponding Schema,Schema The data must be json Format , And json The corresponding value Must satisfy Schema Specification of definition ( Such as ip Address 、 decimal 、 Integers, etc )"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Schema give an example :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"plain"},"content":[{"type":"text","text":"[\n {\n \"name\":\"name\",\n \"type\":\"string\"\n },\n {\n \"name\":\"age\",\n \"type\":\"int\",\n \"max\":120\n },\n {\n \"name\":\"ip\",\n \"type\":\"ipv4\"\n }\n]\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" So the data should look like this :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"plain"},"content":[{"type":"text","text":"{\n \"name\":\"hezhangjian\",\n \"age\":23,\n \"ip\":\"127.0.0.1\"\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" When adding or modifying configurations , The callback function is realized , The callback business service confirms whether the configuration can be added or modified ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Configuration layering : Cloud services correspond to Apollo Of app_id, Map the internal environment to Apollo Cluster on , Then put the microservice name + The configuration name is spliced into the configuration name ."}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The figure below shows the business concept and Apollo The correspondence of concepts , Some configurations are single valued , Some are multi valued configurations , So the configuration item level is optional ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/b4\/b4c398b942ca44675ee8b28e19eb6920.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" In this period of practice , We also found the following problems ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Concurrency issues "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" One of the most fatal is concurrency , First Apollo All configurations exist in one table , Second, because Apollo At the beginning of the design, the main consideration is that the operation and maintenance personnel operate on the interface manually , Code has no concurrency semantics ( Or no concurrency semantics for the client ), It makes it difficult for us to solve the concurrency problem when writing the configuration through code ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Performance issues "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" open namespace List page , You need to show this app_id All under namespace, Because we just app_id It stores all the configurations of a single cloud service , It's a lot of , And the interface does not support pagination , Causes the page to load slowly ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Experience problems "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Apollo Of namespace There is no search function in the interface ( Probably Apollo I didn't want to support so much at the beginning of the design ), Want to go from namespace Navigate to what we want to view or modify in namespace, Only with the search capability of the browser ."}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" The third stage Apollo Coexist with self research configuration center "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" In addition to the above problems , There are also some reasons for us to start the third stage of practice :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The original top-down configuration layered model , There is no isolation between microservices , Not only is it difficult to manage permissions , And it's not suitable for DevOps The publishing concept of single micro service autonomy ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The second stage is for Apollo Too many changes , Changes in organizational structure , There is not enough manpower for maintenance ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" With more and more clusters , Callback function needs two-way network connection , Network maintenance is not very convenient ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" We are right. Apollo There are many changes in the interface and interface based on business , It makes it difficult for other brother departments to share Apollo"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" At that time, people were not sure whether to reserve "},{"type":"text","marks":[{"type":"strong"}],"text":"Schema"},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"strong"}],"text":" Callback check "},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"strong"}],"text":" Code write configuration "},{"type":"text","text":" These three function points are controversial . I personally want to keep "},{"type":"text","marks":[{"type":"strong"}],"text":"Schema"},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"strong"}],"text":" Callback check "},{"type":"text","text":", Because they have great advantages , And the interface is compatible , It can be shared with other departments , But added "},{"type":"text","marks":[{"type":"strong"}],"text":"Schema"},{"type":"text","text":" This concept and "},{"type":"text","marks":[{"type":"strong"}],"text":" Callback check "},{"type":"text","text":" This process , It will increase the cost of learning . And code writing configuration , To solve the concurrency problem , A lot of code changes , I don't recommend keeping ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" After a heated discussion , It was abandoned in the end "},{"type":"text","marks":[{"type":"strong"}],"text":"Schema"},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"strong"}],"text":" Callback check "},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"strong"}],"text":" Code write configuration "},{"type":"text","text":" These three function points , Just put the operation and maintenance configuration in Apollo."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" then , We configure the business , Put in a self-developed strong Schema On the configuration center of , This configuration center , Only responsible for single cluster configuration , Each cluster deploys a set of , Meeting our business needs . Self research strong Schema The key points of configuration center are , Single configuration single table 、 Check whether the configuration is legal through the registry callback 、 With the help of mqtt Protocol to achieve long link push , No single bottleneck ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" And our operation and maintenance configuration center Apollo Back to the open source version , Restructured the configuration ,"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/64\/64e5e1754b607ea975751aad6c63365c.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" In terms of operation and maintenance configuration, the advantages are :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The configuration model is suitable for single micro service publishing ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Configuration is organized by microservice , On a page namespace Not a lot ."}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" shortcoming :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Schema After missing , The configuration of the operator in the interface will not be verified , It can be configured successfully even if the configuration format or content is wrong . The configuration password on the interface does not support plaintext (Apollo Unable to sense whether it is a sensitive field ), Other tools must be used in advance to convert plaintext to ciphertext , Then configure ;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" After the callback check function is removed , Some configurations , For example, the network segment of the network card is misallocated , The operator could not get immediate response ."}]}]}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" Best practices "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Business configuration through our practice , It's really not suitable to use open source Apollo. The O & M configuration uses native Apollo, But not yet "},{"type":"text","marks":[{"type":"strong"}],"text":" Callback check "},{"type":"text","text":" and "},{"type":"text","marks":[{"type":"strong"}],"text":"Schema"},{"type":"text","text":" The function of , hope Apollo Can be supported in subsequent versions "},{"type":"text","marks":[{"type":"strong"}],"text":"Schema"},{"type":"text","text":", Or weakened "},{"type":"text","marks":[{"type":"strong"}],"text":"json"},{"type":"text","text":" Format checking function . Here are our best practices in the following scenarios ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"SRE Configuration on the operation and maintenance interface "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" adopt Apollo To achieve the function , As for how configuration is organized , According to your organizational structure 、 Technology architecture Apollo The concept of , According to the micro service -> Deployment environment or deployment environment -> Microservices are organized and configured at different levels ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Complex parameter verification "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" It is suggested that Apollo It's built on itself portal Wrap a layer , The back-end services can be processed at one level first , This layer of processing can do more complex format verification and even "},{"type":"text","marks":[{"type":"strong"}],"text":" Callback check "},{"type":"text","text":", Call again Apollo OpenApi Write the configuration to Apollo."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Technology selection of business configuration "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" The biggest challenge is that business configuration is user triggered , Concurrency of requests is not easy to handle . There are two ideas , One is in Apollo Based on native code , Solve the concurrency problem by database distributed lock . The second is to learn from our ideas , Through single configuration single table 、mqtt Protocol implementation notification and other core technology points , Self developed business configuration center ."}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":" Deployment of business configuration "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" We need to consider whether to set up a business configuration center according to the number of business configurations . In a single cluster scenario , There is no doubt that only one business configuration center is needed , Even if you use Apollo Realization , It can be considered to set it together with the operation and maintenance configuration center . In the multi cluster scenario , Deploy a business configuration center , Or multiple business configuration centers , In our own practice , A cluster often has to support tens of thousands of users , We adopt the strategy of deploying a business configuration center for each business cluster ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":" Author's brief introduction :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" He Zhangjian , Hua Wei Yun IoT Senior engineer . Focus on cloud native 、IoT、 Message middleware 、APM"}]}]}

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/04/20210414122253476w.html

随机推荐