当前位置:网站首页>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数据库了,最后来张图镇楼:

边栏推荐
- DeFi 2.0的LaaS协议,重振DeFi赛道发展的关键
- My ideal job, the absolute freedom of coder farmers is the most important - the pursuit of entrepreneurship in the future
- "Shandong University mobile Internet development technology teaching website construction" project training log I
- 并发编程学习笔记 之 工具类CountDownLatch、CyclicBarrier详解
- Training log 4 of the project "construction of Shandong University mobile Internet development technology teaching website"
- Synchronous development with open source projects & codereview & pull request & Fork how to pull the original warehouse
- Go|gin quickly use swagger
- Laravel service container (inheritance and events)
- How can Plato obtain premium income through elephant swap in a bear market?
- 从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
猜你喜欢
随机推荐
Shanzhai coin Shib has a US $548.6 million stake in eth whale's portfolio - traders should be on guard
Thinkphp6 output QR code image format to solve the conflict with debug
以‘智’提‘质|金融影像平台解决方案
Read and understand move2earn project - move
Power BI Report Server 自定义身份验证
Fantom (FTM) surged 45% before the FOMC meeting
IDEA使用JDBC连接MySQL数据库个人详细教程
闪贷Dapp的调研及实现
“山东大学移动互联网开发技术教学网站建设”项目实训日志四
Elastic box flex
H5 semantic label
Process management of day02 operation
Training log 6 of the project "construction of Shandong University mobile Internet development technology teaching website"
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
“山东大学移动互联网开发技术教学网站建设”项目实训日志五
30 knowledge points that must be mastered in quantitative development [what is level-2 data]
Huawei 2020 school recruitment written test programming questions read this article is enough (Part 1)
“山东大学移动互联网开发技术教学网站建设”项目实训日志七
day02 作业之文件权限
Changed crying, and finally solved cannot read properties of undefined (reading 'parsecomponent')









