Detailed tutorial for springcloud alibaba nacos linux configuration

Detailed tutorial for springcloud alibaba nacos linux configuration

First download the compressed package of nacos from github: https://github.com/alibaba/nacos/releases

insert image description here

After the download is complete, transfer the file to the Linux server via WinSCP and then decompress the compressed package using the tar -zxvf command.

insert image description here

After decompression is complete, enter the conf directory

insert image description here

Open the clusmter.conf file and add

insert image description here

Save and exit through the :wq command, then enter startup.sh through the vim command

insert image description here

After the modification here is completed, find the bottom position of this file

insert image description here

Add the relevant configuration in the red box, save and exit, and then enter the conf file of nginx

insert image description here

Find the nginx.conf file and enter vim to modify the relevant ports of nginx load

insert image description here

The port number added in the upstream cluster is the three ports added in the nacos conf file before. The default port of nginx is 80, which I changed to 1111
After saving and exiting, you can
The ./nginx -c /usr/local/nginx/conf/nginx.conf command starts the nginx service.
-c means that when nginx starts, it reads the information in the configuration file /usr/local/nginx/conf/nginx.conf and then returns to nacos and enters the bin directory of nacos and starts nacos through ./startup.sh -p port number
After the startup is complete, you can use ps -ef|grep nacos|grep -v grep |wc -l to view how many nacos services are started.

insert image description here

I started three nacos services here and then changed the nacos path in the application.yml in the previous springcloud to the path and port number of nginx

insert image description here

Check whether the service is registered in nacos on Linux through the URL

insert image description here

Finally, because nacos integrates an embedded database by default, if you want to read the configuration of nacos into mysql, you can enter the conf directory of nacos, there is a nacos-mysql.sql open it, there are some tables and data needed by nacos, copy them out, put them in mysql and execute the following, then open application.properties

spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=123456

Add the above code and modify it to your own mysql url, user and password. In the future, the configuration on nacos will be saved in mysql instead of the embedded database that comes with nacos.

This is the end of this article about the detailed tutorial of springcloud alibaba nacos linux configuration. For more related springcloud alibaba content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • SpringCloud-Alibaba-Sentinel-Detailed explanation of configuration persistence strategy
  • Spring Cloud Alibaba Nacos Config configuration center implementation
  • How to configure Spring Cloud Alibaba Seata in Windows 10 and how to solve problems

<<:  How to operate json fields in MySQL

>>:  How to encapsulate the carousel component in Vue3

Recommend

HTML table tag tutorial (44): table header tag

<br />In order to clearly distinguish the ta...

The Complete Guide to Grid Layout in CSS

Grid is a two-dimensional grid layout system. Wit...

Summary of 4 ways to add users to groups in Linux

Preface Linux groups are organizational units use...

How to check if a table exists in MySQL and then delete it in batches

1. I searched for a long time on the Internet but...

Solution to 1045 error in mysql database

How to solve the problem of 1045 when the local d...

Html Select option How to make the default selection

Adding the attribute selected = "selected&quo...

How to use partitioning to optimize MySQL data processing for billions of data

When MySQL queries tens of millions of data, most...

Vue two fields joint verification to achieve the password modification function

Table of contents 1. Introduction 2. Solution Imp...

Nginx stream configuration proxy (Nginx TCP/UDP load balancing)

Prelude We all know that nginx is an excellent re...

Steps to package and release the Vue project

Table of contents 1. Transition from development ...

MySQL master-slave replication delay causes and solutions

Table of contents A brief overview of the replica...

HTML Several Special Dividing Line Effects

1. Basic lines 2. Special effects (the effects ar...

Nginx rewrite regular matching rewriting method example

Nginx's rewrite function supports regular mat...

A brief discussion on the principle of js QR code scanning login

Table of contents The essence of QR code login Un...