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

Talk about how to identify HTML escape characters through code

Occasionally you'll see characters such as &#...

Proxy_pass method in multiple if in nginx location

1. First, let's review the relevant knowledge...

How to use Typescript to encapsulate local storage

Table of contents Preface Local storage usage sce...

What can I use to save you, my table (Haiyu Blog)

Tables once played a very important role in web p...

Implementation of docker-compose deployment of zk+kafka+storm cluster

Cluster Deployment Overview 172.22.12.20 172.22.1...

Vue implements simple calculator function

This article example shares the specific code of ...

Analysis of the principle and usage of MySQL continuous aggregation

This article uses examples to illustrate the prin...

How to use the WeChat Mini Program lottery component

It is provided in the form of WeChat components. ...

SQL interview question: Find the sum of time differences (ignore duplicates)

When I was interviewing for a BI position at a ce...

How to use html css to control div or table to be fixed in a specified position

CSS CodeCopy content to clipboard .bottomTable{ b...

MySQL obtains the current date and time function example detailed explanation

Get the current date + time (date + time) functio...

Example of using UserMap in IMG

usemap is an attribute of the <img> tag, use...

Use of Linux ln command

1. Command Introduction The ln command is used to...

CSS text alignment implementation code

When making forms, we often encounter the situati...