mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
feat: 华为opengauss支持
This commit is contained in:
@ -81,11 +81,19 @@ docker load -i x86_64/kdb_x86_64_V009R001C001B0025.tar
|
||||
```Bash
|
||||
docker compose up -d kingbase
|
||||
# 注意:启动完 dm 后,需要手动再执行如下命令,因为 dm 不支持初始化脚本
|
||||
docker compose exec kingbase bash -c "exec ksql -Uroot -d test -f /tmp/schema.sql"
|
||||
docker compose exec kingbase bash -c 'ksql -U $DB_USER -d test -f /tmp/schema.sql'
|
||||
```
|
||||
|
||||
**注意**: MyBatis, MyBatis Plus 目前不兼容人大金仓,推荐直接使用PostgreSQL JDBC 驱动,已经 url 配置方式连接数据库。
|
||||
|
||||
### 1.7 华为 OpenGauss
|
||||
|
||||
```Bash
|
||||
docker compose up -d opengauss
|
||||
# 注意:启动完 opengauss 后,需要手动再执行如下命令
|
||||
docker compose exec opengauss bash -c '/usr/local/opengauss/bin/gsql -U $GS_USERNAME -W $GS_PASSWORD -d postgres -f /tmp/schema.sql'
|
||||
```
|
||||
|
||||
## 1.X 容器的销毁重建
|
||||
|
||||
开发测试过程中,有时候需要创建全新干净的数据库。由于测试数据 Docker 容器采用数据卷 Volume 挂载数据库实例的数据目录,因此销毁数据需要停止容器后,删除数据卷,然后再重新创建容器。
|
||||
|
@ -804,13 +804,19 @@ CREATE TABLE {table_name} (
|
||||
return script
|
||||
|
||||
|
||||
class OpengaussConvertor(KingbaseConvertor):
|
||||
def __init__(self, src):
|
||||
super().__init__(src)
|
||||
self.db_type = "OpenGauss"
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="芋道系统数据库转换工具")
|
||||
parser.add_argument(
|
||||
"type",
|
||||
type=str,
|
||||
help="目标数据库类型",
|
||||
choices=["postgres", "oracle", "sqlserver", "dm8", "kingbase"],
|
||||
choices=["postgres", "oracle", "sqlserver", "dm8", "kingbase", "opengauss"],
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -826,6 +832,8 @@ def main():
|
||||
convertor = DM8Convertor(sql_file)
|
||||
elif args.type == "kingbase":
|
||||
convertor = KingbaseConvertor(sql_file)
|
||||
elif args.type == "opengauss":
|
||||
convertor = OpengaussConvertor(sql_file)
|
||||
else:
|
||||
raise NotImplementedError(f"不支持目标数据库类型: {args.type}")
|
||||
|
||||
|
@ -6,6 +6,7 @@ volumes:
|
||||
sqlserver: { }
|
||||
dm8: { }
|
||||
kingbase: { }
|
||||
opengauss: { }
|
||||
|
||||
services:
|
||||
mysql:
|
||||
@ -106,6 +107,20 @@ services:
|
||||
ports:
|
||||
- "54321:54321"
|
||||
volumes:
|
||||
- kingbase:/home/kingbase/userdata/
|
||||
- kingbase:/home/kingbase/userdata
|
||||
- ../kingbase/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
||||
# docker compose exec kingbase bash -c "exec ksql -Uroot -d test -f /tmp/schema.sql"
|
||||
# docker compose exec kingbase bash -c 'ksql -U $DB_USER -d test -f /tmp/schema.sql'
|
||||
|
||||
opengauss:
|
||||
image: opengauss/opengauss:5.0.0
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GS_USERNAME: root
|
||||
GS_PASSWORD: Yudao@2024
|
||||
LD_LIBRARY_PATH: /usr/local/opengauss/lib:/usr/lib
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- opengauss:/var/lib/opengauss
|
||||
- ../opengauss/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
||||
# docker compose exec opengauss bash -c '/usr/local/opengauss/bin/gsql -U $GS_USERNAME -W $GS_PASSWORD -d postgres -f /tmp/schema.sql'
|
Reference in New Issue
Block a user