当前位置:网站首页>Set up nacos2 X cluster steps and problems encountered
Set up nacos2 X cluster steps and problems encountered
2022-07-03 00:35:00 【_ one hundred and forty-six thousand one hundred and sixteen】
build nacos2.X Cluster steps and problems encountered
First, stand-alone version +mysql Persistence is no problem , Here you can refer to the official website
Because it is built on a server , So you need to copy 3 Share nacos
1、 Modify after copying conf/application.properties Port information , The default is server.port=8848
Pay attention to point one : because nacos2.x Two new grpc The port of , So when you modify it 3 Ports cannot be continuous , Do not then cause port conflicts
So the default here is 8848 Words , Will take up 8848、9848、9849 Three ports . So here are three suggestions nacos It is revised as follows
8648、8748、8848
2、 Configure cluster node information
Configuration file in conf In the catalog cluster.conf.example file , Need to rename to cluster.conf. Then add the following information
own ip:8648
own ip:8748
own ip:8848
Three nacos All modified , stay bin Under boot , Direct execution startup.sh. It's supposed to be over here , Visit the console to see the information of each node , But here comes the second question
Pay attention to point two : Because I configured it on Alibaba cloud nacos, Alibaba cloud has public and Intranet addresses . After I configure it as a public network , Every nacos Of cluster.conf In file , An intranet address will appear by default , Lead to nacos The log keeps reporting errors , Later, when I saw someone else's configuration, I realized that it was originally to be configured as an intranet address , If it is a different server, then there is no such problem
Successfully started after modification , The node information displayed in the console is also correct , All are 3 individual
3、 Next configure nginx forward
Pay attention to three : In the first point, I mentioned the two new ports , So in configuration nginx Pay special attention when , Otherwise, the console will be able to access , But the actual registration is less than nacos On
The detailed configuration is as follows
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Change one
upstream nacos{
server 101.42.239.36:8648;
server 101.42.239.36:8748;
server 101.42.239.36:8848;
}
# Change two
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://nacos;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
# Change three
stream {
upstream nacos2{
server 101.42.239.36:9648;
server 101.42.239.36:9748;
server 101.42.239.36:9848;
}
upstream nacos3{
server 101.42.239.36:9649;
server 101.42.239.36:9749;
server 101.42.239.36:9849;
}
# because nacos It is offset according to the port grpc Port of . So you need to be in 8080 Offset based on 1000、1001
server {
listen 9080 so_keepalive=on;
tcp_nodelay on;
proxy_pass nacos2;
}
server {
listen 9081 so_keepalive=on;
tcp_nodelay on;
proxy_pass nacos3;
}
}
Note 4 : Because of my nginx The default installation is when compiling and installing , Therefore, an error will be reported when using the above configuration file , The error message is below . So you need to recompile nginx, add to stream modular
# Error message
unknown directive “stream” in /usr/local/nginx
linux Compilation and installation nginx course
# recompile nginx, add stream
./configure --with-stream
make
make install
Finally start nginx, Client restart service , see nacos Console , Service registration successful , And it's done .
边栏推荐
猜你喜欢

Bigder: how to deal with the bugs found in the 32/100 test if they are not bugs

【单片机项目实训】八路抢答器
![Luogu_ P1149 [noip2008 improvement group] matchstick equation_ Enumeration and tabulation](/img/4a/ab732c41ea8a939fa0983fec475622.png)
Luogu_ P1149 [noip2008 improvement group] matchstick equation_ Enumeration and tabulation

为什么网站打开速度慢?

Understanding and application of least square method

Pageoffice - bug modification journey

Where can I find the English literature of the thesis (except HowNet)?

Solution to the problem of abnormal display of PDF exported Chinese documents of confluence

mm中的GAN模型架构

Introduction of UART, RS232, RS485, I2C and SPI
随机推荐
TypeError: Cannot read properties of undefined (reading ***)
Linux软件:如何安装Redis服务
Centos7 one click compilation to build MySQL script
What are the recommended thesis translation software?
Hundreds of continuous innovation to create free low code office tools
Rust字符串切片、结构体和枚举类
Detailed explanation of pod life cycle
Kubernetes simple introduction to writing YML
Bigder: how to deal with the bugs found in the 32/100 test if they are not bugs
【单片机项目实训】八路抢答器
Don't want teachers to see themselves with cameras in online classes? Virtual camera you deserve!
Redis21 classic interview questions, extreme pull interviewer
[MCU project training] eight way answering machine
helm 基础学习
数组常用操作方法整理(包含es6)及详细使用
Shell脚本基本使用
Go自定义排序
[shutter] Introduction to the official example of shutter Gallery (project introduction | engineering construction)
Understanding and application of least square method
Is there a specific format for English papers?