This is the 23rd day of my participation in the August More Text Challenge.More challenges in August

  • 📢 welcome to like: 👍 collect ⭐ message 📝 if there are mistakes please correct, give people rose, hand left lingering fragrance!
  • 📢 This article was originally written by Webmote and originally published by Nuggets.
  • 📢 author’s motto: life is toss about, when you don’t toss about life, life will start to toss about you, let us come on together! 💪 💪 💪

1. Introduction of Apollo

Apollo configuration is an open source configuration center of the Ctrip Framework Group. It does not rely on Java Sprint, but has good support for Java Sprint, and also supports.net Core, which is a mature work of cross-boundary configuration center.

It has a good front-end interface, can centrally manage the application of different environments, different clusters of configuration, configuration modification can be real-time push to the application program, with standard management rights, gray and other features.

2.Apollo features and advantages

Apollo Configuration Center is widely used and has a large number of user endorsements. It is a mature out-of-the-box service with the following features and advantages.

Address: Github

  1. Support configuration isolation of different applications;
  2. Support framework and component configuration, and can use the namespace feature to achieve in-application configuration inheritance and overwrite;
  3. Support different environment configurations, built-in four environment configurations;
  4. Support for different cluster or security zone configurations;
  5. Support user empowerment management, user audit function, and log activity record;
  6. Support edit configuration and publish configuration separation, avoid misoperation;
  7. Support Java and.NET SDK client, and realize the cache, offline cache, push and pull mode, long connection, etc.
  8. Support distributed deployment to achieve high availability;
  9. A front-end manages configurations for multiple environments;
  10. Support for Kubernetes deployment and support for K8s native service discovery;
  11. All kinds of big endorsement: widely used in Netease Yan Xuan, Yizan, Tuba rabbit, Ping an Bank, easy car, little red book and so on

3. Apollo’s disadvantages

If I have to say the disadvantage, I think there is only one point, the architecture is a little cumbersome, it depends on MySQL, Java, configuration service, management service, service discovery (Eureka or K8s Api service), meta service, front-end and other components.

For operations, it’s a little heavyweight.

4. Architecture composition of Apollo

The architecture diagram published on the official website is as follows:

Both configuration services and management services register services through Eureka. After registration, meta-services can find the addresses of these services through Eureka.

In this way, the client and the front end access the meta service by accessing the load of the configuration, and obtain the address of the configuration service and management service. Then they can read, write and publish the configuration.

All configurations are deposited into the configuration DB, allowing the writing and publishing of configurations to be separated.

Configuration services and management services can be deployed as stateless services within K8s by saving data to MysQL.

After the client pulls the configuration, it caches a file locally so that it can form a weak dependency on the configuration center. If the configuration center fails, the local configuration can be read and written.

However, if this is deployed in K8s, it is a bit confusing whether it is still a stateless service. Of course, we don’t want to use the configured client and make ourselves a stateful service. I haven’t studied this clearly.

Net Core Client access

The client access is shown in figure 2.

Code support is also simple:

 public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
    .AddApollo(false)
    .ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
Copy the code

Use:

var value = context.RequestServices.GetRequiredService<IConfiguration>()[key];
Copy the code

5. Summary

Routine summary, rational view!

Knot is what ah, knot is I want you to praise but can not get lonely. 😳 😳 😳

👓 have seen this, but also care about a thumbs-up?

👓 has been liked, but also care about a collection?

👓 are collected, but also care about a comment?