此次适配的服务器为麒麟v10,数据库使用人大金仓,中间件为tonweb7
此次适配针对某银行做poc,根据客户提出的应用需求来验证建议的方案是否可行,为客户确定合适的服务产品、系统;完成对指定服务器环境以及中间件、数据库的兼容
针对Kingbase替换主要适配的组件有nacos、activit7、xxl-job
Kylin_v10安装:
https://blog.csdn.net/qq_40220309/article/details/114135304
Kingbase安装:
Linux:https://blog.csdn.net/yang_z_1/article/details/123252832
Windows:https://blog.csdn.net/qq_25094817/article/details/122807581
Jdk1.8安装:
https://blog.csdn.net/weixin_56921038/article/details/123726655
Tongweb7安装:
https://blog.csdn.net/peacezhi/article/details/121415348
下文中提到的source文件夹是我用来存放已经下载好的nacos、activit7源码,根据需求前往GitHub下载指定版本
kingbase8.6.0的jar包需自行下载,maven仓库没有
<kingbase-connector-java.version>8.6.0kingbase-connector-java.version>
<dependency>
<groupId>com.kingbasegroupId>
<artifactId>kingbase8artifactId>
<version>${kingbase-connector-java.version}version>
dependency>
<dependency>
<groupId>com.kingbasegroupId>
<artifactId>kingbase8artifactId>
dependency>
#人大金仓
db.num=1
db.jdbcDriverName=com.kingbase8.Driver
db.url.0=jdbc:kingbase8://192.168.10.130:54321/yu_all?currentSchema=nacos_config_2.0.1
db.user=system
db.password=nkqlhhc
/**
* 数据库驱动
* 增加对人大金仓数据库的支持
*/
private String jdbcDriverName;
public String getJdbcDriverName() {
return jdbcDriverName;
}
public void setJdbcDriverName(String jdbcDriverName) {
this.jdbcDriverName = jdbcDriverName;
}
为HikariDataSource对象指定驱动名称,调用setDriverClassName方法。改动见下图:
mvn -Prelease-nacos -Dmaven.test.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true clean install -U
# 如果遇到异常使用一下命令
mvn -Prelease-nacos -Dmaven.test.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true -Drat.numUnapprovedLicenses=100 clean install -U
Activiti7默认不支持kingbase,不过想使用kingbase做数据源需修改activiti源码生成新的activiti-engin.jar包替换原路径下(org\activiti\activiti-engine\7.0.0.SR1)中activiti-engin.jar;7.0.0.SR1版本的相关jar包已调整好在source文件里,替换即可使用;
对XxlJob的兼容不完善,需在后续遇到问题再进行补充
<dependency>
<groupId>com.kingbasegroupId>
<artifactId>kingbase8artifactId>
<version>8.6.0version>
dependency>
注意:GateWay服务底层启动用的不是tomcat是netty需特殊处理
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-tomcatartifactId>
exclusion>
exclusions>
dependency>
<build>
<finalName>${project.artifactId}finalName>
<plugins>
<plugin>
<artifactId>maven-war-pluginartifactId>
<version>2.6version>
<configuration>
<failOnMissingWebXml>falsefailOnMissingWebXml>
configuration>
plugin>
plugins>
build>
public class SysApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(SysApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(SysApplication.class, args);
}
}
@Configuration
public class NacosConfig implements ApplicationRunner {
@Autowired(required = false)
private NacosAutoServiceRegistration registration;
@Value("${server.port}")
Integer port;
@Override
public void run(ApplicationArguments args) throws Exception {
if (registration != null && prot != null) {
Integer tomcatPort = port;
try{
tomcatPort = new Integer(getTomcatPort());
} catch(Exceprion e) {
e.printStackTrace();
}
registration.setPort(tomcatPort);
registration.start();
}
}
/** 获取外部tomcat端口 */
public String getTomcatPort() throws Exception {
MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
Set<ObjectName> objectNames = beanServer.queryNames(new ObjectName("*:type=Connector,*"), Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
return objectNames.iterator.next().getKeyProperty("port");
}
}
如果想通过在一个TongWeb下部署多个服务,有两种方案
- 采用多通道结合多虚拟主机实现多服务部署
- 增加多个域(具体操作参考部署手册)
本次适配或有许多不足,待后续补充