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

How to understand Nacos Service configuration Center

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

Share

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

This article mainly introduces "how to understand the Nacos service configuration center". In the daily operation, I believe many people have doubts about how to understand the Nacos service configuration center. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to understand the Nacos service configuration center". Next, please follow the editor to study!

When Nacos is used as the service configuration center, the server is the web version, so create a new configuration. The client, that is, the application, introduces dependencies and adds related configurations.

Before we start again, we will share an experience that does not use the configuration center.

The company assigned me to be responsible for the project of a unified payment platform for a hospital. At the beginning of thinking about the simple bar, do not configure the center, but also maintenance, trouble. But in fact, if you want to modify the configuration, you need to modify the configuration file, then package it, upload the jar (because it is an intranet), and then the colleagues of the operation and maintenance staff are responsible for the deployment. Every time you need to change the configuration, you need to go through the above process. One day, I really couldn't stand it, so I got the Nacos configuration center. If you need to change the configuration, you only need to change the configuration center, and then restart the service.

Nacos configuration center, which is divided into server and client.

The following is divided into server side and client side, respectively, to build a detailed demonstration.

1 Server 1.1 New configuration

1.2 configuration list

1.3 configuration details

2 client 2.1 relies on com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config2.2 to automatically configure package com.fengwenyi.demouserservicecore.config;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.context.annotation.Configuration / * * @ author Erwin Feng * / @ EnableAutoConfiguration@Configurationpublic class AutoConfigConfiguration {} 2.3 configure spring.application.name=demo-user-service-corespring.profiles.active=devspring.cloud.nacos.config.server-addr=127.0.0.1:8848spring.cloud.nacos.config.file-extension=yamlspring.cloud.nacos.config.group=springcloud-alibaba-demo

The specified configuration file is named demo-user-service-core-dev.ymal.

Data

Springcloud-alibaba-demo

At this point, the study on "how to understand the Nacos Service configuration Center" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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