一、国产化适配范围
1.1、操作系统
银河麒麟操作系统
1.2、中间件
东方通嵌入式容器 TongWeb7.0.E.2
1.3、数据库
达梦数据库 DM8
1.4、其他安装支持组件
Nginx Nacos Redis Rabbitmq Jdk Minio Geoserver
1.5、改造服务端及数据库版本
业务系统:V0.0.3
二、服务器环境安装
2.1、JDK安装
2.1.1、查看安装目录:
切换至源文件目录, cd /root/桌面/soft/jdk 查看安装路径, rpm -qpl jdk-8u301-linux-x64.rpm
【/usr/java/jdk1.8.0_271-amd64】 目录下
2.1.2 添加环境变量:
编辑配置文件:vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_301-amd64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
生效环境变量:
source /etc/bashrc
source /etc/profile
2.2、Nginx安装
2.2.1、查看安装目录:
切换至源文件目录, cd /root/桌面/soft/nginx 查看安装路径, rpm -qpl nginx-1.18.0-2.el7.ngx.x86_64.rpm
【/etc/nginx】目录下
2.2.2、更新配置文件
修改文件中地址配置: 1、product.conf
2、middle.conf
3、flowable.conf
4、nginx.conf
2.2.3、nginx启动
nginx启动目录:【/usr/sbin/nginx】 /usr/sbin 已经默认添加到环境变量,所以nginx可以直接启动, 另外配置文件直接使用默认nginx.conf
nginx
nginx -s stop
nginx -s reload
2.2.4、查看端口
netstat -apn |grep 8888
存在问题: 缺少目录查看权限,需要配置启动用户 nginx.conf中用户信息:
user root;
worker_processes 1;
2.4、Redis安装
2.4.1、按照顺序安装npm包:
jemalloc-3.6.0-1.el7.x86_64.rpm redis5-5.0.4-1.ius.centos7.x86_64.rpm
2.4.2、查看安装目录:
切换至源文件目录, cd /root/桌面/soft/redis 查看安装路径, rpm -qpl redis5-5.0.4-1.ius.centos7.x86_64.rpm
配置文件位置:【/etc/redis.conf】 启动文件位置:【/usr/bin/redis-cli】
2.4.3、添加集群配置文件:
/usr/bin/redis-server /etc/cluster/7000/redis.7000.conf
/usr/bin/redis-server /etc/cluster/7001/redis.7001.conf
/usr/bin/redis-server /etc/cluster/7002/redis.7002.conf
/usr/bin/redis-server /etc/cluster/7003/redis.7003.conf
/usr/bin/redis-server /etc/cluster/7004/redis.7004.conf
/usr/bin/redis-server /etc/cluster/7005/redis.7005.conf
2.4.4、查看redis服务:
ps -ef|grep redis
2.4.5、创建redis集群:
/usr/bin/redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
2.5、Nacos安装
2.5.1、查看安装目录:
切换至源文件目录, cd /root/桌面/soft/nacos 查看安装路径, rpm -qpl nacos-server-1.1.4-1.x86_64.rpm
安装目录:【/opt/nacos-server-1.1.4】
2.5.2、启动服务
cd /opt/nacos-server-1.1.4/bin
sh startup.sh -m standalone
2.5.3、添加命名空间
2.5.4、导出导入配置
目前配置一共18个,connect-config.yaml为公共配置,其他的为各个启动项目自身配置
2.6、rabbitmq安装
2.6.1、按照顺序安装:
1 erlang-18.3.4.4-1.el7.centos.x86_64.rpm 2 socat-1.7.3.2-6.nfs.x86_64.rpm 3 rabbitmq-server-3.6.15-1.el7.noarch.rpm
安装完成后,请重启一遍服务器
2.6.2、查看安装目录:
切换至源文件目录, cd /root/桌面/soft/rabbitmq 查看安装路径, rpm -qpl erlang-18.3.4.4-1.el7.centos.x86_64.rpm rpm -qpl rabbitmq-server-3.6.15-1.el7.noarch.rpm
【/usr/lib64/erlang】 【/usr/lib/rabbitmq】
2.6.3、启动查看:
systemctl start rabbitmq-server.service
systemctl status rabbitmq-server.service
2.7、MINIO安装
2.7.1、查看安装目录:
切换至源文件目录, cd /root/桌面/soft/minio 查看安装路径, rpm -qpl minio-20200717-1.nfs.x86_64.rpm
2.7.2、启动服务
nohup /usr/local/bin/minio server /media > /media/minio.log 2>&1 &
2.7.3、查看端口:
netstat -anp|grep 9000
2.7.4、添加桶及默认文件
1、添加两个桶,complatform、static,complatform为鉴权文件桶,static为静态资源桶。
2、静态资源桶中添加template模板文件夹并导入模板
2.8、geoserver
解压文件至usr/local/geoserver目录下
启动命令:
nohup java -jar -Xms512m -Xmx512m start.jar >/dev/null &
2.9、DM8安装
2.9.1、软件安装
2.9.2、dm.ini配置
1、DM数据库参数dm.ini配置: (1) 兼容mysql数据库: COMPATIBLE_MODE = 4 (2)支持DISTINCT、ORDER BY、分析函数和集函数支持对大字段进行处理: ENABLE_BLOB_CMP_FLAG = 1 (3) 更新后重启服务
2.10、后台服务启动脚本
netstat -anp|grep 9002 <gateway-admin>
netstat -anp|grep 9001 <gateway-web>
netstat -anp|grep 9003 <gateway-admin>
netstat -anp|grep 9004 <authentication-server>
netstat -anp|grep 9010 <fileservice>
netstat -anp|grep 9009 <messenger>
nohup java -jar -Xms256m -Xmx256m gateway-admin-0.0.6-SNAPSHOT-opt.jar --NACOS=192.168.11.134 >/dev/null &
nohup java -jar -Xms512m -Xmx512m gateway-web-0.0.6-SNAPSHOT-opt.jar --NACOS=192.168.11.134 >/dev/null &
nohup java -jar -Xms256m -Xmx256m authentication-server-0.0.6-SNAPSHOT-opt.jar --NACOS=192.168.11.134 >/dev/null &
nohup java -jar -Xms256m -Xmx256m authorization-server-0.0.6-SNAPSHOT-opt.jar --NACOS=192.168.11.134 >/dev/null &
nohup java -jar -Xms512m -Xmx512m fileservice-0.0.6-SNAPSHOT-opt.jar --NACOS=192.168.11.134 >/dev/null &
nohup java -jar -Xms512m -Xmx512m messenger-0.0.6-SNAPSHOT-opt.jar --NACOS=192.168.11.134 >/dev/null &
2.11、服务器重启后操作
2.11.1、nacos
cd /opt/nacos-server-1.1.4/bin
sh startup.sh -m standalone
2.11.2、redis
/usr/bin/redis-server /etc/cluster/7000/redis.7000.conf
/usr/bin/redis-server /etc/cluster/7001/redis.7001.conf
/usr/bin/redis-server /etc/cluster/7002/redis.7002.conf
/usr/bin/redis-server /etc/cluster/7003/redis.7003.conf
/usr/bin/redis-server /etc/cluster/7004/redis.7004.conf
/usr/bin/redis-server /etc/cluster/7005/redis.7005.conf
nohup /usr/bin/redis-server >/dev/null &
查看端口
ps -ef|grep redis
2.11.3、minio
nohup /usr/local/bin/minio server /media --address :9905 > /media/minio.log 2>&1 &
2.11.4、geoserver
nohup java -jar -Xms512m -Xmx512m start.jar >/dev/null &
其他服务加入到开机启动中
三、服务端代码改造
3.1、拉取代码分支
目前中台服务端拉取分支代码版本V0.0.6,安环版本V0.0.3。中台国产化分支Localization01_20220606,安环国产化分支Localization03_20220610。
3.2、安装Maven本地依赖
3.2.1、东方通Maven:
3.2.2、DM8 Maven:
3.3、修改pom.xml
3.3.1、添加DM依赖
<dependency>
<groupId>dm.jdbc</groupId>
<artifactId>DmJdbcDriver</artifactId>
<version>18</version>
</dependency>
3.3.2、tongweb依赖
排除tomcat依赖,添加tongweb
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tongweb.springboot</groupId>
<artifactId>tongweb-spring-boot-starter</artifactId>
<version>2.x.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.tongweb</groupId>
<artifactId>tongweb-embed</artifactId>
<version>7.0.E.2</version>
</dependency>
特殊地:gateway-web添加jsp支持
<dependency>
<groupId>com.tongweb</groupId>
<artifactId>tongweb-jsp</artifactId>
<version>7.0.E.2</version>
</dependency>
3.4、bootstrap.yml修改
3.4.1、添加东方通license
server:
tongweb:
license:
type: file
path: ${tongweb.licensePath}
3.4.2、数据源配置
(以quartz为例子,其他服务类似)
spring:
datasource:
driver-class-name: ${db.quartz.driver}
url: jdbc:${db.quartz.type}://${db.quartz.addr}:${db.quartz.port}/zbzk_quartz?characterEncoding=UTF-8&useUnicode=true&useSSL=false&serverTimezone=Asia/Shanghai
username: ${db.quartz.username}
password: ${db.quartz.password}
3.4.3、主键生成器数据源
cmp:
sequence:
url: jdbc:${db.complatform.type}://${db.complatform.addr}:${db.complatform.port}/zbzk_complatform?characterEncoding=UTF-8&useUnicode=true&useSSL=false&serverTimezone=GMT%2B8
username: ${db.complatform.username}
password: ${db.complatform.password}
driverClassName: ${db.complatform.driver}
3.4.4、多数据源兼容达梦
spring:
datasource:
dynamic:
druid:
filters: stat,slf4j
3.5、nacos配置
3.5.1、connect-config.yaml
数据源配置,以complatform为例修改,其他服务类似
db:
complatform:
driver: dm.jdbc.driver.DmDriver
type: dm
addr: 192.168.11.146
port: 5237
username: zbzk_complatform
password: zbzk_complatform123
添加东方通license
tongweb:
licensePath: /opt/complatform/license.dat
3.5.2、其他yaml文件中配置修改
此处以start-dev为例子
3.6、mapper.xml中sql语法调整
3.7、工作流服务改造
3.7.1、重写AbstractEngineConfiguration
3.7.2、nacos中flowable配置
flowable:
async-executor-activate: false
database-schema-update: false
check-process-definitions: false
history-level: full
auto-deploy: true
3.7.3、其他注意事项
四、数据库迁移
4.1、新建用户及赋权
注意区分专用机和普通机,专用机存在三员用户,操作有所不同。
4.1.1、普通机:
所有的操作都由SYSDBA完成:
create user zbzk_auth identified by zbzk_auth123;
create user zbzk_backplatform identified by zbzk_backplatform123;
create user zbzk_complatform identified by zbzk_complatform123;
create user zbzk_gateway identified by zbzk_gateway123;
grant create table,create view,create index to zbzk_auth;
grant create table,create view,create index to zbzk_backplatform;
grant create table,create view,create index,create procedure to zbzk_complatform;
grant create table,create view,create index to zbzk_gateway;
create user safe_education identified by safe_education123;
create user safe_envpro identified by safe_envpro123;
create user safe_equipment identified by safe_equipment123;
create user safe_evaluation identified by safe_evaluation123;
create user safe_inventory identified by safe_inventory123;
create user safe_pending identified by safe_pending123;
create user safe_report identified by safe_report123;
grant create table,create view,create index to safe_education;
grant create table,create view,create index to safe_envpro;
grant create table,create view,create index to safe_equipment;
grant create table,create view,create index to safe_evaluation;
grant create table,create view,create index to safe_inventory;
4.1.2、专用机:
SYSDBA用户建立新用户:
create user zbzk_auth ;
create user zbzk_backplatform ;
create user zbzk_complatform ;
create user zbzk_gateway ;
create user zbzk_quartz ;
create user zbzk_workflow ;
create user safe_education ;
create user safe_envpro ;
create user safe_equipment ;
create user safe_evaluation ;
SYSSSO用户更改密码和授权:
alter user zbzk_auth identified by Zbzk_auth123;
alter user zbzk_backplatform identified by Zbzk_backplatform123;
alter user zbzk_complatform identified by Zbzk_complatform123;
alter user zbzk_gateway identified by Zbzk_gateway123;
alter user zbzk_quartz identified by Zbzk_quartz123;
alter user zbzk_workflow identified by Zbzk_workflow123;
alter user safe_education identified by Safe_education123;
alter user safe_envpro identified by Safe_envpro123;
alter user safe_equipment identified by Safe_equipment123;
4.2、迁移工具报错及解决
4.2.1、迁移工具
4.2.2、迁移过程中问题:
注意事项:
- 迁移需要选择模式(DM数据库中存在模式概念),建议建立多个用户,用户名与
数据库名称相同,DM数据库中默认为每个用户建立了一个与用户名相同的模式。 - mysql创建表语句需要去掉unsigned,否则转换为DM数据库建表语句会出现类型
错误。 - varchar字段长度超过限制:mysql中长度定义为字符长度,DM中默认为字节长
度,需要设置DM数据库中LENGTH_IN_CHAR 参数(这个参数只能在新建数据库实例时候设置)。
4.3、备份与还原数据
4.3.1、逻辑备份还原
– 备份中台数据库
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_AUTH20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_AUTH20220613.log SCHEMAS=ZBZK_AUTH
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_BACKPLATFORM20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_BACKPLATFORM20220613.log SCHEMAS=ZBZK_BACKPLATFORM
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_COMPLATFORM20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_COMPLATFORM20220613.log SCHEMAS=ZBZK_COMPLATFORM
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_GATEWAY20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_GATEWAY20220613.log SCHEMAS=ZBZK_GATEWAY
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_QUARTZ20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_QUARTZ20220613.log SCHEMAS=ZBZK_QUARTZ
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_WORKFLOW20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_WORKFLOW20220613.log SCHEMAS=ZBZK_WORKFLOW
– 备份安环数据库
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_EDUCATION20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_EDUCATION20220613.log SCHEMAS=SAFE_EDUCATION
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_ENVPRO20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_ENVPRO20220613.log SCHEMAS=SAFE_ENVPRO
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_EQUIPMENT20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_EQUIPMENT20220613.log SCHEMAS=SAFE_EQUIPMENT
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_EVALUATION20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_EVALUATION20220613.log SCHEMAS=SAFE_EVALUATION
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_INVENTORY20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_INVENTORY20220613.log SCHEMAS=SAFE_INVENTORY
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_PENDING20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_PENDING20220613.log SCHEMAS=SAFE_PENDING
./dexp USERID=SYSDBA/SYSDBA@192.168.11.146:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_REPORT20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_REPORT20220613.log SCHEMAS=SAFE_REPORT
– 还原中台数据库
./dimp USERID=ZBZK_AUTH/Zbzk_auth123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_AUTH20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_AUTH20220613.log SCHEMAS=ZBZK_AUTH
./dimp USERID=ZBZK_BACKPLATFORM/Zbzk_backplatform123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_BACKPLATFORM20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_BACKPLATFORM20220613.log SCHEMAS=ZBZK_BACKPLATFORM
./dimp USERID=ZBZK_COMPLATFORM/Zbzk_complatform123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_COMPLATFORM20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_COMPLATFORM20220613.log SCHEMAS=ZBZK_COMPLATFORM
./dimp USERID=ZBZK_GATEWAY/Zbzk_gateway123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/ZBZK_GATEWAY20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/ZBZK_GATEWAY20220613.log SCHEMAS=ZBZK_GATEWAY
– 还原安环数据库
./dimp USERID=SAFE_EDUCATION/Safe_education123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_EDUCATION20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_EDUCATION20220613.log SCHEMAS=SAFE_EDUCATION
./dimp USERID=SAFE_ENVPRO/Safe_envpro123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_ENVPRO20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_ENVPRO20220613.log SCHEMAS=SAFE_ENVPRO
./dimp USERID=SAFE_EQUIPMENT/Safe_equipment123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_EQUIPMENT20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_EQUIPMENT20220613.log SCHEMAS=SAFE_EQUIPMENT
./dimp USERID=SAFE_EVALUATION/Safe_evaluation123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_EVALUATION20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_EVALUATION20220613.log SCHEMAS=SAFE_EVALUATION
./dimp USERID=SAFE_INVENTORY/Safe_inventory123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_INVENTORY20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_INVENTORY20220613.log SCHEMAS=SAFE_INVENTORY
./dimp USERID=SAFE_PENDING/Safe_pending123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_PENDING20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_PENDING20220613.log SCHEMAS=SAFE_PENDING
./dimp USERID=SAFE_REPORT/Safe_report123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_REPORT20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_REPORT20220613.log SCHEMAS=SAFE_REPORT
./dimp USERID=SAFE_SECURITY/Safe_security123@127.0.0.1:5237 FILE=/opt/dmdbms/data/DAMENG/bak/SAFE_SECURITY20220613.dmp LOG=/opt/dmdbms/data/DAMENG/bak/SAFE_SECURITY20220613.log SCHEMAS=SAFE_SECURITY
4.4、DM数据库密码设置及调整
4.4.1、专用机SYSSSO用户密码设置
修改密码:
ALTER USER USER_NAME IDENTIFIED BY “用户新口令”;
修改用户失败登录次数限制:
ALTER USER "用户名" LIMIT FAILED_LOGIN_ATTEMPS UNLIMITED;
修改用户口令过期时间限制:
ALTER USER "用户名" LIMIT PASSWORD_LIFE_TIME UNLIMITED;
修 改 用 户 口 令 锁 定 期 限 制 :
ALTER USER " 用 户 名 " LIMIT PASSWORD_LOCK_TIME UNLIMITED;
4.5、DM常用工具
管理工具:安装目录下 /opt/dmdbms/tool
Console:数据库实例配置 Manager: 管理客户端 Dts:数据库迁移工具 Disql:sql连接工具
五、后期问题
5.1、版本问题
1、是否长期支持版本升级维护?后期开发策略,是tomcat+mysql 还是tongweb+dm 或者并行?
目前看最大问题在于:数据库语法结构不同,关键字、数据结构类型、函数等差别较大
3、目前数据库版本没有做保留,只有代码有分支,那么以后还原版本对应的时候会存在问题?
以后发布代码需要保留历史sql版本(全量备份)
|