接入第三方数据库
O2OA内置H2数据库,但系统真正上线使用时,需要更高的数据库性能。此时,可以将O2OA数据库切换到第三方商用级数据库,如Mysql等。本文以MySQL数据库为例进行说明。
一、数据库准备工作 - Mysql数据库安装
下载和安装数据库的知识并不在本博客讲述的范围,请大家百度相关的技术文章完成Mysql数据库的安装。建议版本在Mysql5.7+,推荐Mysql8。
Mysql各版本下载请参见:https://blog.csdn.net/kerafan/article/details/78001849
Mysql安装步骤请参见:http://www.cnblogs.com/sshoub/p/4321640.html
Mysql修改数据库连接数:https://blog.csdn.net/zhya910702/article/details/48372433
二、O2OA配置修改
1、关闭内置数据库
配置文件路径:o2server/config/node_127.0.0.1.json
如果没有该文件,请从目录o2server/configSample/中复制node_127.0.0.1.json文件到o2server/config目录下。
{
"enable": true,
"port":null,
"sslEnable":false,
"logLevel":"info",
"isPrimaryCenter": true,
"nodeAgentEnable": true,
"application": {
"enable": true,
"port": null,
"sslEnable": false,
"proxyHost": "",
"proxyPort": null,
"forceRedeploy": true,
"scanInterval":5,
"includes":[],
"excludes":[]
},
"web": {
"enable": true,
"port": null,
"sslEnable": false,
"proxyHost": "",
"proxyPort": null,
"forceRedeploy": true
},
"storage": {
"enable": true,
"port": null,
"sslEnable": false,
"name" : ""
},
"data": { #内置数据库相关配置,可以修改端口以及是否启用
"enable": true, #修改enable的值为false
"tcpPort": null,
"webPort": null,
"includes": [],
"excludes": []
},
"dumpData":{
"cron" : "0 0 21 * * ?",
"size" : 14
},
"dumpStorage":{
"cron" : "0 0 21 * * ?",
"size" : 14
}
} 2、开启和配置外部数据库信息
配置文件路径:o2server/config/externalDataSources.json
如果没有该文件,请从目录o2server/configSample/ 中复制externalDataSources.json文件到o2server/config目录下。
将其中的url、username、password以及enable信息修改为上述Mysql的相关信息,如:
URL参数说明如下:
设置完成后,重启o2server即可。
Last updated
Was this helpful?