当前位置:网站首页>nacos外置数据库的配置与使用
nacos外置数据库的配置与使用
2022-07-29 05:21:00 【麻辣隔壁4】
在nacos进行集群配置时,如果使用其内置数据库derby会产生数据配置的不对称和不同步。
上述是官网的nacos服务配置的关系图。我们假设现在nacos有3台机器。101,102,103.如果使用内置的服务数据库,则这三台nacos各自都有自己的数据库。如果我们在每一台都进行文件的配置和注册,那修改起来比较麻烦。并且你也保证不了数据文件的同步更新。容易产生遗漏和不对称。所以nacos官网给我们提供了外置数据库的方法。即三台nacos配置统一的nacos.
步骤:
1.在你的数据库中建立nacos数据库。将mysql的脚本文件导入。脚本文件的地址:https://github.com/alibaba/nacos/blob/master/distribution/conf/nacos-mysql.sql
2.修改nacos中的mysql连接配置:
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=123456注意:此配置放的位置必须是在其说明的位置,要不会找不到mysql配置。启动nacos会报错,起不来。

配置完成后,启动nacos,则可以换到自己的mysql数据库了,最后来张图镇楼:

边栏推荐
- Research and implementation of flash loan DAPP
- 并发编程学习笔记 之 Lock锁及其实现类ReentrantLock、ReentrantReadWriteLock和StampedLock的基本用法
- Idea using JDBC to connect mysql database personal detailed tutorial
- Huawei 2020 school recruitment written test programming questions read this article is enough (Part 2)
- How can Plato obtain premium income through elephant swap in a bear market?
- Study and research the way of programming
- 运动健康深入人心,MOVE PROTOCOL引领品质生活
- Ribbon学习笔记一
- My ideal job, the absolute freedom of coder farmers is the most important - the pursuit of entrepreneurship in the future
- 中海油集团,桌面云&网盘存储系统应用案例
猜你喜欢

Training log 4 of the project "construction of Shandong University mobile Internet development technology teaching website"

Most PHP programmers don't understand how to deploy safe code

主流实时流处理计算框架Flink初体验。
![30 knowledge points that must be mastered in quantitative development [what is level-2 data]](/img/cc/8eb2f0b11679af57e196f6e6d828f8.png)
30 knowledge points that must be mastered in quantitative development [what is level-2 data]

Dao race track is booming. What are the advantages of m-dao?

The completely decentralized programming mode does not need servers or IP, just like a aimless network extending everywhere

How can Plato obtain premium income through elephant swap in a bear market?

JDBC连接数据库详细步骤

From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run

Machine learning makes character recognition easier: kotlin+mvvm+ Huawei ml Kit
随机推荐
麦当娜“Hellbent”购买130万美元的nft无聊猿,现在被认为太贵了
加密资产熊市之下,PlatoFarm的策略玩法依旧能获得稳定收益
The bear market is slow, and bit.store provides stable stacking products to help you get through the bull and bear market
Use of file upload (2) -- upload to Alibaba cloud OSS file server
How to survive in the bear market of encryption market?
Under the bear market of encrypted assets, platofarm's strategy can still obtain stable income
Okaleido Tiger 7.27日登录Binance NFT,首轮已获不俗成绩
中海油集团,桌面云&网盘存储系统应用案例
Starfish OS:以现实为纽带,打造元宇宙新范式
突破硬件瓶颈(一):Intel体系架构的发展与瓶颈挖掘
极致通缩和永动机模型,将推动 PlatoFarm 爆发
Get the number of daffodils
C# 判断用户是手机访问还是电脑访问
与张小姐的春夏秋冬(4)
Strategic cooperation with many institutions shows the strength of the leading company of platofarm yuancosmos
How to PR an open source composer project
NIFI 改UTC时间为CST时间
Dao race track is booming. What are the advantages of m-dao?
以‘智’提‘质|金融影像平台解决方案
Laravel service container (Application of context binding)