【Nacos 2.3.3支持Postgre SQL数据源配置】

1、Nacos下载

下载地址: https://download.nacos.io/nacos-server/nacos-server-2.3.2.zip
或者自行在官网下载其他版本: https://nacos.io/download/

2、 插件下载:

下载地址: https://github.com/wuchubuzai2018/nacos-datasource-extend-plugins

3、SQL脚本获取、nacos数据库创建、插件编译

1、下载后记得解压zip包,我这里是直接以zip包的格式下载的;

2、Postgre SQL脚本获取:
在这里插入图片描述
3、在postgre sql数据库执行脚本创建nacos数据库,编码格式:utf-8
在这里插入图片描述
4、编译打包插件jar
在这里插入图片描述
在这里插入图片描述
5、解压nacos 并创建plugins目录:
在这里插入图片描述
6、将上面编译好的jar放入到plugins目录:
在这里插入图片描述
7、修改nacos的配置文件:

# application.properties
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=postgresql

### Count of DB:
db.num=1

### Connect URL of DB:
db.url.0=jdbc:postgresql://127.0.0.1:5432/nacos?targetServerType=primary&tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
db.user.0=nacos
db.password.0=nacos

### Connection pool configuration: hikariCP
db.pool.config.driverClassName=org.postgresql.Driver

在这里插入图片描述
8、启动

启动集群:

bin/startup.sh

启动单机:

bin/startup.sh -m standalone

停止:

bin/shutdown.sh

4、Nacos 集群搭建方式:

1、 例如:在三台服务器上,服务器的IP分别是:192.168.10.1,192.168.10.2,192.168.10.3
2、分别修改三台服务上的nacos/conf/cluster.conf:

#
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#it is ip
#example
192.168.10.1:8848
192.168.10.2:8848
192.168.10.3:8848

3、修改nacos\conf\application.properties文件:
在这里插入图片描述

4、三台服务器均需打开8848端口:
开放8848端口命令:firewall-cmd --zone=public --add-port=8848/tcp --permanent

5、启动三台服务的nacos实例:

 nacos/bin/startup.sh
  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

walking_w

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值