当前位置:网站首页>Detailed explanation of nacos cluster configuration
Detailed explanation of nacos cluster configuration
2022-07-30 00:33:00 【m0_67393157】
Preamble:
To avoid a single point of failure, nacos needs to adopt cluster mode, and the database must be replaced with a high-availability mysql database (the built-in derby database is difficult to achieve consistent cluster configurationsex)
- nacos switch mysql database
The downloaded nacos installation package comes with nacos-mysql.sql script
Execute this script in your own mysql database, and create a nacos_config database before executing it.After executing the script as shown in the figure:
Now start to modify nacos/In the application.properties configuration file under conf, configure the mysql configuration information.As shown in the figure:
Finally restart nacos and visit localhost:8848/nacos, you can log in.
If the startup is unsuccessful, it may be that the mysql version that comes with nacos is too low, and replace it with your own.
Solution: Create a new plugins/mysql (mkdir plugins &mkdir plugins/mysql) in the nacos directory, and add the own version of the mysql.jar package (I use 8.0.28)
> Restart the service and you are done!
Test it, you can add a configuration information by yourself
Local mysql query:
So far, nacos has completed switching mysql database. - Build a nacos cluster (1 nginx+3 nacos+mysql, it is recommended to complete it under Linux)
- Modify the nacos/bin/startup.sh configuration file
Before modifying, you can make a copy of the startup.sh file, cp startup.sh startup.sh.bk. Then modify startup.sh.
Modify the following points in order:
The first point:
Second place:
startup.sh, save and exit after modification.
Here we use ports to map 3 different nacos, so we have to configure port parameters. - Modify cluster.conf(nacos/conf/cluster.conf)

- Configure nginx
- Modify nginx.conf

- Start nacos and nginx
Execute ./startup.sh -p 3333, ./startup.sh -p 4444, ./startup.sh -p 5555 in sequence
The following information appears, indicating success
You can also view the log information output by start.out
View the number of nacos clusters: ps -ef|grep nacos|grep -v grep|wc -l
Display 3 is rightStart nginx
nginx -c nginx.conf (your nginx.conf directory)
Access nacos cluster through nginx
http://192.168.1.100:1111/nacos/#/login
Successful access to nacos indicates that the cluster configuration is complete, you can self-test and add some configuration information, query the local mysql.
The SpringBoot is integrated later, and the configuration of each microservice can be changed to the cluster configuration, that is, to the address monitored by nginx.
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
猜你喜欢

vmtouch——Linux下的文件缓存管理神器

定时器学习

“灯塔工厂”的中国路径:智造从点到面铺开

Superficial understanding of CNN

基于TNEWS‘ 今日头条中文新闻(短文本)分类

From the perspective: the interviewer interview function test engineer mainly inspects what ability?

MySQL 用 BETWEEN AND 日期查询包含范围边界

Worthington用于细胞收获的胰蛋白酶&细胞释放程序

Decision tree principle and code implementation

Worthington酶促细胞收获&细胞粘附和收获
随机推荐
QTableWidget使用示例
Worthington's tried and tested cell isolation system protocols
测试员容易陷入的9大误区
Worthington用于细胞收获的胰蛋白酶&细胞释放程序
Filebeat如何保证在日志文件被切割(或滚动rolling)时依然正确读取文件
【分层强化学习】survey
【经验】经验总结-经验教训
【集训DAY16】ALFA【凸壳】【计算几何】
[Experience] Experience Summary - Lessons Learned
Vmtouch - under Linux file cache management artifact
YOLO数据格式说明与转换
图论:二分图
X64 mfc140u.dll文件缺失->应用程序无法正常启动(0xc000007b)解决方法
2022年企业直播行业发展洞察
【Flutter】混合开发之Flutter预加载解决第一次加载页面缓慢问题
图像的IO操作
【分层强化学习】HAC源码解读
How to increase account weight?3 ways to operate your own media to help you get more revenue
Toutiao We-Media Operation: How to Gain 500+ Fans in Toutiao Today?
[Cloud native Kubernetes] Build a Kubernetes cluster in binary (middle) - deploy node nodes