How to Add a Custom DM8 Database Plugin to Nacos 2.2
Starting with Nacos 2.2.0, this guide shows how to create a custom DM8 database plugin via the SPI mechanism, add Maven dependencies, import the required scripts, configure connection settings and set the platform property, enabling Nacos to persist data in a DM8 database.
From version 2.2.0, Nacos supports injecting multiple data sources through the SPI mechanism, allowing plugins to be loaded by setting the spring.datasource.platform property in application.properties.
By default Nacos implements MySQL and Derby; other databases require custom extensions.
Custom DM8 Plugin
1. Add DM8 database plugin
Dependencies are available in Maven Central; avoid using Alibaba Cloud mirrors.
<!-- Maven dependencies --><dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>nacos-datasource-plugin-dm8</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>2. Import Nacos DM8 database script
Create a tablespace named nacos in the DM8 management tool and import the provided SQL script.
3. Configure Nacos datasource connection
db:
num: 1
url:
0: jdbc:dm://172.27.0.5:5236/nacos
user: nacos
password: nacos@123
pool:
config:
driver-class-name: dm.jdbc.driver.DmDriver4. Set database platform
spring:
datasource:
platform: damengSource code repository: https://github.com/pig-mesh/nacos-datasource-plugin-dm8
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
