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 advantages of distributed application configuration

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "what are the advantages of distributed application configuration". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn what are the advantages of distributed application configuration.

1 configuration management challenges in distributed environment

It can be said that configuration is a necessary capability requirement for today's application development and deployment. We usually implement some contents that are easy to change and depend on external conditions through configuration. In this way, we can achieve functional adjustment in the case of zero coding and achieve very low-cost application expansion. For configuration management, the most common way is the configuration file, which is set by a specific file content format and is placed with the application when deployed. This way of use is relatively easy and simple in the case of a single machine, but in large-scale distributed application scenarios, especially to distinguish between different environments (development, testing, online, etc.) will lead to a rapid increase in management costs and error risks.

Taking the above scenario as an example, the issues and challenges involved are:

The operation is complex and the cost is high: if there are dozens of instances, you need to log in to the machine to modify it, which is easy to miss.

It is difficult to check and check errors: in dozens of instance modifications, if some of them make mistakes, it is difficult to find, and at the same time, it is difficult to rewind and roll back the content.

Unable to operate effectively in PAAS environment: in paas environment, it is very dangerous to log in to the instance directly to modify it because of the existence of drift, because once the drift occurs, the configuration will fail to the original mode.

Dynamic loading, configuration change push scenarios are difficult to support.

Therefore, for large-scale distributed scenarios, it is very necessary to establish a configuration center to manage configuration uniformly. To extricate business developers from complex and tedious configuration management, they only need to focus on the business code itself, which can significantly improve the efficiency of development and operation and maintenance. Decoupling configuration and application in the deployment phase can also further improve the efficiency of release and reduce deployment costs. At the same time, after the configuration of independent management, there will also be strong support for configuration security, rollback ability, traceability, emergency control handling and so on.

2 Why is BRCC a good configuration center? 2.1What a good configuration center should have

I talked about why a configuration center is needed in a distributed environment, and what advantages should a good configuration center have?

In our opinion, a good configuration center should have the following advantages:

1. Easy to use

It should be very simple for the business system to use the configuration center: the configuration center provides unified kv management capabilities, and the business system obtains the configuration from the configuration center, and then uses the configuration in the system. Therefore, we believe that the most key factor to measure whether the configuration center is excellent or not is the convenience of the business system to use the configuration, the more convenient the better the configuration center.

Ease of use includes two aspects:

Convenient access SDK and API are the most common access methods. Standardized design requirements should be used as much as possible. If SDK is used in the Java language, it should be compatible with the configuration specifications of Spring and SpringBoot, and it should be used directly without modifying the original code. API adopts the definition standard of RESTful and adopts the way of resource location to improve readability and ease of use.

The configuration center with convenient and good management will provide a user-friendly console, which is convenient for users to log in for configuration management. The management level of configuration is clearer, including rich management mechanisms such as product, engineering, environment, version, grouping and so on.

two。 Perfect function

The main function of the configuration center is to manage the configuration. In addition to the configuration crud, batch changes, fuzzy matching, and fast navigation, a good configuration center also requires the following configuration capabilities:

The push user changes the configuration in the configuration center, can re-push the configuration to the business system, and can feedback the status of the configuration received by the business system.

The history of retroactive configuration changes is saved, and diff can be performed between changes. In a distributed environment, you can track the effective status of each instance

A multi-environment and multi-version configuration center can meet the configuration requirements of business systems in different environments and versions, and provide the ability of diff between versions.

The audit / rollback configuration center can record every change made by the user for audit use.

3. Simple operation and maintenance

Simple deployment can be quickly deployed in a variety of environments, supporting richer environments, such as virtual machines, paas, containerization, etc., supporting clustering and high availability deployment.

* * Monitoring alarm * * provides complete and rich monitoring and alarm capabilities to help quickly identify problems and quickly deal with risks.

4. Safe and reliable

Configuration security is very critical, such as database users and passwords, once the risk of disclosure is very high, so the security of the configuration center needs to be fully considered.

One is to configure the security of storage and transmission, such as the content can be encrypted, and the other is the permission control of the operation, which must be carried out to the user. The granularity of permission control, whether the user's operation is traceable, and whether the configuration changes can be rolled back all determine the quality of the configuration center.

5. High performance and stability

In many large-scale business scenarios, we are also faced with the situation that many product lines are used at the same time, resulting in highly concurrent requests to configure services. Therefore, the architecture design of configuring services must take this factor into account to achieve high throughput, high efficiency and high stability of the architecture requirements. Therefore, the overall architecture must have distributed architecture design requirements, with flexible scalability and multi-level cache synchronization mechanism, in order to solve these problems well, achieve the push and change ability of seconds, and raise to the stability requirements of 4 9999.

2.2 benefits of BRCC

In February 2001, we opened up a configuration center BRCC (Better Remote Config Center), whose main product features are simple, easy to use and secure. The functional structure diagram of BRCC is as follows:

Feature 1. Simple and easy to use SDK end

BRCC provides sdk in multiple languages. For example, java sdk is fully compatible with the configuration specification of springboot. You can directly use the @ Value annotation of spring to load the configuration, as shown in the following code:

@ Componentpublic class Person {@ Value ("person.username") private String name; / / provides Setter and Getter methods}

For developers who are used to spring, you can set person.username= Zhang San in application.properties to assign "Zhang San" to the name variable of the persion class at startup. When using BRCC, as long as the person.username= Zhang San is saved in BRCC and the dependency of BRCC starter is introduced, there is no need to transform the business code, which can be regarded as zero intrusion to the business system.

two。 Fully functional server

As a lightweight distributed configuration management solution, BRCC is easy to deploy and developed based on spring boot 2.0.It can be directly run after packaging to support configuration distribution and update push. In addition to simple deployment, the server has some particularly useful features:

The secure console provides a complete console interface, supports multi-level access control, and can control reading and writing from product line, engineering, environment and other dimensions.

The configuration hot release BRCC provides the feature of configuration push. When the configuration changes, the push can be triggered actively and the configuration can be re-pushed to the business system. After receiving the configuration, the business system can make hot updates according to its own needs, so that the configuration can take effect without restarting. You can also view the validity of the configuration on the business system after push on the server of BRCC.

Configuration operations can be traced back to iterative upgrades of business systems, and there are often configuration changes. In BRCC, users have traces of all configuration changes, and historical configurations can also be queried, rolled back and compared.

All in all, BRCC is a very excellent distributed configuration center solution, which is fully compatible with native Spring configuration specifications. In addition to providing basic configuration storage, it also provides configuration comments, key-value dimension query, change push, change track recording and query, fine-grained permission control, sdk instance management, friendly UI interface, simple deployment and other features. For more information, please see https://github.com/baidu/brcc.

Let's see how to build and use it quickly.

3. BRCC Quick start 3.1 Quick build BRCC server

Choose an appropriate version, and you can find an introduction to the features supported by each version in brcc's release notes. The currently recommended stable version is 1.0.4.

Https://github.com/baidu/brcc/releases

In order to facilitate your experience, we have deployed the experience environment on Baidu Cloud:

Online experience environment address: http://180.76.36.149/#/login

Test account 1:test1 123456

Test account 2:test2 123456

The first step is environmental preparation.

BRCC relies on the Java environment to run.

Https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/

If you are building and running BRCC from code, you also need to configure the Maven environment for this.

Https://maven.apache.org/index.html

Be sure to install and use it in the following release environment:

64 bit OS, which supports Linux/Unix/Mac/Windows. Linux/Unix/Mac is recommended.

64 bit JDK 1.8 download & configuration.

Maven 3.2.xpackages; download & configuration. (only required for source code compilation)

Mysql5.6+

Redis3.2+

Download 64 bit JDK 1.8 +

Https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

64 bit JDK 1.8 + configuration

Https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/

Download Maven 3.2.x+

Https://maven.apache.org/download.cgi

Maven 3.2.x+ configuration

Https://maven.apache.org/settings.html

The second step, download the source code or install the package.

You can get brcc through both source code and distribution packages.

Download source code from Github

Git clone https://github.com/baidu/brcc.git cd brcc/ sh compile.sh

Download the compressed package after compilation

You can download the brcc-server.zip package from release notes.

Unzip brcc-server.zip or tar-zxvf brcc-server.tar.gz cd brcc-server

Step 3, start the BRCC configuration center service.

After configuring mysql and redis as required in start.sh, you can start brcc by executing this script.

3.2configuration management and SDK access

The first step is to add the configuration on the BRCC management side.

Create product line, engineering, environment, version, grouping, and configuration on the brcc management side, as shown in the following figure.

As shown in the figure above, the product line test1, engineering test-rcc, version 1.0.0 and grouping group1 are created, and the a, b, c configuration items are configured.

The second step is to introduce brcc-sdk-starter to ensure that the following dependencies are introduced into pom.xml.

Com.baidu.mappbrcc-sdk-starter$ {brcc.version}

The latest version is 1.0.0.

The third step is to add the SDK configuration description for BRCC.

Before accessing the brcc configuration center, make sure that the SpringBoot configuration is complete and add the following to the application.properties file.

Rcc.cc-server-url: http://180.76.36.149 rcc.cc-password: 123456 rcc.logProperties: true rcc.projectName: test-rcc env-name: dev cc-version-name: 1.0.0 enableUpdateCallback: true appName: example

Introduction to configuration properties

The fourth step is to develop the configuration in the project.

Brcc is fully compatible with native spring configuration specifications. Like application.yml,application.properties, you can use the configuration in brcc, such as:

@ Value ("${a}") int a = 0; @ Value ("${b}") long b = 0; @ Value ("${c}") String c

The fifth step is to configure verification.

The following log appears in the startup log indicating that the configuration was loaded successfully.

After the configuration sends the change, the following prompt appears in the log.

Thank you for your reading. the above is the content of "what are the advantages of distributed application configuration". After the study of this article, I believe you have a deeper understanding of the advantages of distributed application configuration. Specific use also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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: 0

*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

Development

Wechat

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

12
Report