当前位置:网站首页>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 .
边栏推荐
猜你喜欢
Luogu_ P2010 [noip2016 popularization group] reply date_ Half enumeration
CMake基本使用
Detailed explanation of pod life cycle
Hundreds of continuous innovation to create free low code office tools
Seckill system design
哪些软件可以整篇翻译英文论文?
Rust字符串切片、结构体和枚举类
Should you study kubernetes?
Markdown使用教程
[MCU project training] eight way answering machine
随机推荐
Luogu_ P2010 [noip2016 popularization group] reply date_ Half enumeration
helm 基础学习
Two common methods and steps of character device registration
Install docker and use docker to install MySQL
v8
Confluence的PDF导出中文文档异常显示问题解决
An excellent orm in dotnet circle -- FreeSQL
【雅思阅读】王希伟阅读P2(阅读填空)
经济学外文文献在哪查?
Markdown使用教程
Basic 10 of C language: array and pointer
【雅思阅读】王希伟阅读P1(阅读判断题)
Shell脚本基本使用
Array common operation methods sorting (including ES6) and detailed use
Is there a specific format for English papers?
CMake基本使用
【Pulsar文档】概念和架构/Concepts and Architecture
How do educators find foreign language references?
关于Unity屏幕相关Screen的练习题目,Unity内部环绕某点做运动
Preview word documents online