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 is the Nacos production deployment plan for Ali registry?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Today, I would like to talk to you about what the Nacos production deployment plan of Ali Registration Center is. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

I. explanation

First of all, the deployment of nacos in production environment is to use cluster mode cluster to ensure high availability. This paper mainly introduces in detail how to build the best cluster scheme and how to integrate with spring cloud programs.

II. Cluster scheme

The following figure shows the officially recommended cluster scheme, which is implemented by domain name + VIP mode. It is readable and convenient to change ip.

The VIP here can be implemented directly using Nginx.

III. Realization of the scheme

The minimum configuration of the nacos cluster is that at least 3 instances are required. Since I only have one machine built locally, I deploy these three instances by modifying the ports: 8848, 8849, and 8850, respectively.

3.1. Modify cluster configuration

There is a configuration file cluster.conf in the conf directory of nacos. Please configure each line as ip:port.

192.168.28.130:8848192.168.28.130:8849192.168.28.130:8850

192.168.28.130 is my native ip. The configuration of all three nacos instances is the same.

3.2. Configure the MySQL database

Cluster mode must use MySQL database, production is recommended to use at least active and standby mode, or use highly available database

3.2.1. Initialize the MySQL database

The script has a configuration file nacos-mysql.sql in the conf directory of nacos, which can be executed directly.

3.2.2. Add database configuration

The configuration file is located in application.properties under the conf directory of nacos, and add the following configuration

Db.num=1db.url.0=jdbc:mysql://192.168.28.131:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=truedb.user=rootdb.password=root

Db.num is the number of database instances if there are multiple database instances through db.url.0, db.url.1. Specify different database links

3.3. Modify Nacos port for other instances

Modify the server.port variable under application.properties under the conf directory of nacos. The three instances are: 8848, 8849, and 8850.

This step can be ignored if the cluster is deployed on different machines.

3.4. Start the Nacos cluster

Start all three instances and execute startup.sh under the bin directory of nacos. The startup file is in cluster mode by default.

3.5. Modify Nginx configuration

Modify conf/nginx.conf configuration

Upstream nacos {server 192.168.28.130 server 8848; server 192.168.28.130 server 8849; server 192.168.28.130 server 8850;} server {listen 80; server_name test.nacos.com; location / {proxy_pass http://nacos;}}

Configure domain name test.nacos.com to bind VIP

3.6. Program integration Nacos cluster

Address of nacos server-addr configuration domain name test.nacos.com

IV. Nacos cluster management

After reading the above, do you have any further understanding of the Nacos production deployment plan of Ali registry? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report