Nacos-2.2.2源码修改集成高斯数据库GaussDB,postresql

一 ,下载代码

Release 2.2.2 (Apr 11, 2023) · alibaba/nacos · GitHub

二, 执行打包

mvn -Prelease-nacos -Dmaven.test.skip=true -Drat.skip=true clean install -U

mvn -Prelease-nacos '-Dmaven.test.skip=true' '-Drat.skip=true' clean install -U

注意:请不要把源码放在中文路径下,会报各种意想不到的错误。

打包的结果在distribution中

三,添加驱动jar包

1,根目录下:/pom.xml

postgresql

复制代码
<postgresql.version>42.3.3</postgresql.version>

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>${postgresql.version}</version>
</dependency>

高斯的

复制代码
<opengauss.version>3.0.0</opengauss.version>

<dependency>
    <groupId>org.opengauss</groupId>
    <artifactId>opengauss-jdbc</artifactId>
    <version>${opengauss.version}</version>
</dependency>

2,config项目下的 /pom.xml

postgresql的

复制代码
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

高斯的

复制代码
<dependency>
   <groupId>org.opengauss</groupId>
   <artifactId>opengauss-jdbc</artifactId>
</dependency>

3,naming项目下的

postgresql的

复制代码
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

高斯的

复制代码
 <dependency>
      <groupId>org.opengauss</groupId>
      <artifactId>opengauss-jdbc</artifactId>
 </dependency>

四,添加PostgreSQL驱动代码

高斯的驱动代码和PostgreSQL是一模一样的

① PropertiesConstant.java

复制代码
    public static final String POSTGRESQL = "postgresql";

② PropertyUtil.java#loadSetting

复制代码
String platform = DatasourcePlatformUtil.getDatasourcePlatform("");
            /*boolean useExternalStorage = !PropertiesConstant.EMPTY_DATASOURCE_PLATFORM.equalsIgnoreCase(platform)
                    && !PropertiesConstant.DERBY.equalsIgnoreCase(platform);
             setUseExternalDB(useExternalStorage);*/
            setUseExternalDB(PropertiesConstant.MYSQL.equalsIgnoreCase(platform) || PropertiesConstant.POSTGRESQL.equalsIgnoreCase(platform));

③ ExternalDataSourceProperties.java

复制代码
    private static final String JDBC_DRIVER_NAME_POSTGRESQL = "org.postgresql.Driver";

④ StartingApplicationListener.java

复制代码
    private static final String DATABASE_POSTGRESQL = "postgresql";

五, 配置文件

数据库链接自己配置

相关推荐
人工智能知识库3 小时前
2026年HCCDP-GaussDB工作级开发者题库(详细解析)
数据库·华为·gaussdb·题库·hccdp-gaussdb·工作级开发者认证
依旧风轻3 小时前
NSTimer的运行机制
macos·objective-c·cocoa·nstimer
DarkAthena7 小时前
【GaussDB】解析GaussDB热补丁机制
数据库·gaussdb
恋猫de小郭8 小时前
Compose Multiplatform 1.10 Interop views 新特性:Overlay 和 Autosizing
android·flutter·macos·kotlin·github·objective-c·cocoa
加油_Yeah9 小时前
Mac 科研/论文专用快捷键(Word + LaTeX + Finder) 与文件管理
macos·编辑器·word
Gauss松鼠会9 小时前
【GaussDB 】GaussDB 性能排查与锁等待分析常用 SQL 全面解析(TOP SQL / 等锁 / 长事务 / LwLock / SubPlan)
数据库·sql·gaussdb
ZhangBlossom9 小时前
Freqtrade 新人上手教程(macOS + Docker,无需 docker-compose)
macos·docker·容器
古城小栈9 小时前
Rust 交叉编译:MacOS ====> Linux (musl 静态编译)
linux·macos·rust
2501_915921439 小时前
360移动端性能监控实践QDAS-APM(iOS篇)
android·macos·ios·小程序·uni-app·cocoa·iphone
开开心心_Every1 天前
多端免费远程控制工具:4K流畅同账号直连
游戏·macos·微信·pdf·excel·语音识别·phpstorm