# 端口说明

# Standalone版本

配置文件 配置端口 说明
application.properties server.port=28090 主数据后端端口
application-nacos.properties spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 nacos的地址:端口

# 微应用版本

配置文件 配置端口 说明
application.properties server.port=28090 主数据后端端口
application.properties spring.redis.port=6379 redis端口
application-afc.properties afc.application.name=127.0.0.1:28083 afc.application.name=AFCENTER afc后端地址:端口,或者AFC服务名称(如果使用网关配置,可以直接使用服务名,默认为AFCENTER)
application-nacos.properties spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 nacos的地址:端口

# 配置文件说明

# user-config.xml 配置文件

主数据平台的数据源使用 user-config.xml 配置文件进行配置。配置文件路径:${PACKAGE_HOME}/config/MDM/config/user-config.xml,内容如下:

...
<module name="DataSource">
    <group name="default">
            <configValue key="Database-Type">MySql</configValue># db类型
            <configValue key="Jdbc-Type"/>
            <configValue key="C3p0-DriverClass">com.mysql.cj.jdbc.Driver</configValue>#db驱动
            <configValue key="C3p0-Url">jdbc:mysql://IP:端口Port/mdm?useSSL=false</configValue>
            <configValue key="C3p0-UserName">用户名</configValue>
            <configValue key="C3p0-Password">密码</configValue>
            <configValue key="C3p0-PoolSize">5</configValue>
            <configValue key="C3p0-MaxPoolSize">30</configValue>
            <configValue key="C3p0-MinPoolSize">5</configValue>

            <!-- //seconds, 0 means connections never expire -->
            <configValue key="C3p0-MaxIdleTime">0</configValue>
            <!-- //idle connections never tested -->
            <configValue key="C3p0-IdleConnectionTestPeriod">0</configValue>
            <configValue key="C3p0-MaxStatements">0</configValue>
            <configValue key="C3p0-NumHelperThreads">3</configValue>

            <configValue key="Transaction-Isolation">ISOLATION_DEFAULT</configValue>
            <configValue key="Test-Connect-Sql">SELECT count(*) from EOS_UNIQUE_TABLE</configValue>
            <configValue key="Retry-Connect-Count">-1</configValue>
        </group>
        <group name="MDM_PUB">
            <configValue key="Database-Type">MySql</configValue># db类型
            <configValue key="Jdbc-Type"/>
            <configValue key="C3p0-DriverClass">com.mysql.cj.jdbc.Driver</configValue>#db驱动
            <configValue key="C3p0-Url">jdbc:mysql://jdbc:mysql://IP:端口Port/库db/mdm_pub?useSSL=false</configValue>
            <configValue key="C3p0-UserName">用户名</configValue>
            <configValue key="C3p0-Password">密码</configValue>
            <configValue key="C3p0-PoolSize">5</configValue>
            <configValue key="C3p0-MaxPoolSize">30</configValue>
            <configValue key="C3p0-MinPoolSize">5</configValue>

            <!-- //seconds, 0 means connections never expire -->
            <configValue key="C3p0-MaxIdleTime">0</configValue>
            <!-- //idle connections never tested -->
            <configValue key="C3p0-IdleConnectionTestPeriod">0</configValue>
            <configValue key="C3p0-MaxStatements">0</configValue>
            <configValue key="C3p0-NumHelperThreads">3</configValue>

            <configValue key="Transaction-Isolation">ISOLATION_DEFAULT</configValue>
            <configValue key="Test-Connect-Sql">SELECT count(*) from EOS_UNIQUE_TABLE</configValue>
            <configValue key="Retry-Connect-Count">-1</configValue>
        </group>
</module>
...

其中,default数据源作为主数据的主库使用(如果是集成式部署,也作为AFCenter的数据源);MDM_PUB数据源作为主数据的业务库使用。 达梦数据库配置特殊点:一定要配columnNameUpperCase,例如jdbc:dm://IP:Port?schema=模式名&columnNameUpperCase=false

####连接池c3p0异常问题

# 方案一

在user-config.xml中将的C3p0-MaxStatements的值设置为0,将C3p0-IdleConnectionTestPeriod的值小与C3p0-checkoutTimeout,示例如下:

67867074828

# 方案二

在批量操作数据的时候,一次操作不要太多,控制在一次200条以内,不能一次性1900条处理

以下是连接池生产环境建议配置:含注释的地方可以根据自己环境进行自定义配置

<group name="MDM_PUB">
    <configValuekey="Database-Type">MySql</configValue>
    <configValue key="Jdbc-Type"/>
    <configValuekey="C3p0-DriverClass">com.mysql.cj.jdbc.Driver</configValue>
    <configValuekey="C3p0-Url">jdbc:mysql://IP:PORT/mdm_afc_pub?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true</configValue>
    <configValue key="C3p0-UserName">name</configValue>
    <configValue key="C3p0-Password">password</configValue>
    <configValue key="C3p0-PoolSize">5</configValue>
    <!-- //连接池中保留的最大连接数 -->
    <configValuekey="C3p0-MaxPoolSize">30</configValue>
    <!-- //最小初始化时创建的连接数 -->
    <configValuekey="C3p0-MinPoolSize">5</configValue>

    <!-- //最大空闲时间,超过空闲时间的连接将被丢弃。为0或负数则永不丢弃 -->
    <configValuekey="C3p0-MaxIdleTime">600</configValue>
    <!-- //隔多少秒检查所有连接池中的空闲连接,默认为0表示不检查 -->
    <configValuekey="C3p0-IdleConnectionTestPeriod">900</configValue>
    <!-- 当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出SQLException,如设为0则无限期等待。单位毫秒,默认为0;  -->
    <configValuekey="C3p0-checkoutTimeout">1500</configValue>

    <!-- JDBC 的标准参数,用以控制数据源内加载的PreparedStatement数量。但由于预缓存的Statement属 于单个Connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素,如果maxStatements与 maxStatementsPerConnection均为0, 则缓存被关闭。默认为0;  -->
    <configValuekey="C3p0-MaxStatements">0</configValue>
    <!-- C3P0是异步操作的,缓慢的JDBC操作通过帮助进程完成。扩展这些操作可以有效的提升性能,通过多线程实现多个操作同时被执行。默认为3;  -->
    <configValuekey="C3p0-NumHelperThreads">3</configValue>
    <configValue key="Transaction-Isolation">ISOLATION_DEFAULT</configValue>
    <configValue key="Test-Connect-Sql">SELECT count(*) fromEOS_UNIQUE_TABLE</configValue>
    <configValuekey="Retry-Connect-Count">-1</configValue>
</group>

# application.properties配置文件

application.properties 默认配置文件路径:${PACKAGE_HOME}/config/application.properties

# 微服务唯一标识(不可更改)
spring.application.name=MDM
# session有效期
server.servlet.session.timeout=PT120M
# 后端端口号
server.port=28090
# 激活afc和mdm配置文件
spring.profiles.active=nacos,afc,mdm

# 是否开启文件上传下载(默认为是)
spring.servlet.multipart.enabled=true
# 单次请求大小限制
spring.servlet.multipart.max-request-size=100MB
# 单个文件大小限制
spring.servlet.multipart.max-file-size=20MB
# 文件上传路径
spring.servlet.multipart.location=${user.dir}/data/upload-tmp
# 文件写入磁盘阈值
spring.servlet.multipart.file-size-threshold=100KB

# 全局设置@JsonFormat的格式pattern
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
# 设置全局时区
spring.jackson.time-zone=GMT+8
# 全局设置pojo或被@JsonInclude注解的属性的序列化方式,不为空的属性才会序列化
spring.jackson.default-property-inclusion=non-null
# 是否在存在不对应的参数时也将请求参数正常解析(当为false时默认为是)
spring.jackson.deserialization.fail-on-unknown-properties=false

# 任务调度线程池大小
spring.task.scheduling.pool.size=5
# 任务执行线程池大小
spring.task.execution.pool.core-size=50
# 任务执行线程池最大值
spring.task.execution.pool.max-size=100
# 任务执行线程池排队容量大小
spring.task.execution.pool.queue-capacity=100000

# 公开端点
management.endpoints.web.exposure.include=hystrix.stream,health,info,loggers,eos

# hystrix执行最大超时时间
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=10000
# hystrix并发执行的最大线程数
hystrix.threadpool.default.coreSize=100
# hystrix最大线程数
hystrix.threadpool.default.maximumSize=100
# hystrix最大队列数
hystrix.threadpool.default.maxQueueSize=100000
# hystrix动态最大队列数
hystrix.threadpool.default.queueSizeRejectionThreshold=100000

# redis地址
spring.redis.host=地址
# redis端口号
spring.redis.port=端口号
# redis密码
spring.redis.password=密码
# redis连接池最大连接数
spring.redis.lettuce.pool.max-active=100
# redis连接池中最多保留的空闲连接数量
spring.redis.lettuce.pool.max-idle=100
# redis从连接池获取连接最大的等待时间
spring.redis.lettuce.pool.max-wait=5000

# eos微应用编码
eos.application.sys-code=EOS-DEMO-SYS
# eos微应用密钥
eos.application.sys-key=dc6baaed30e541d78bb91274803d9432
# eosadmin端口
eos.admin.port=6500
# eos缓存模式
eos.cache.mode=redis

# 配置文件目录
out.config.folder=config
is.global.unique=false
# bps微应用名称
bps.application.name=BPS-SERVER-STANDALONE
# bps租户id
bps.tenant.id=BPS_DEFAULT_TENANT
# 是否开启eos日志(默认开启)
engine.show.log=true

# application-afc.properties 配置文件

application-afc.properties 为AFCenter的配置文件。默认配置文件路径:${PACKAGE_HOME}/config/application-afc.properties

# 如果使用nacos或eureka时,配置为应用名称,如:AFCENTER;否则填写格式为:ip:port
afc.application.name=127.0.0.1:28090
# afc租户名称
afc.application.tenant=sys_tenant
# afc微应用编码
afc.application.app-code=AFC
# afc微应用密码
afc.application.app-secret=secret
# afc日志保留时间(按月)
afc.schedule.logs-to-history.stay-month-number=1

# 排除自动配置
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration

# afc日志转为历史
afc.schedule.logs-to-history.cron=0 0 4 1 1/1 ?
# afc历史保留时间(按月)
afc.schedule.logs-to-history.keep-month-number=2

# 是否使用AfcUserLoginFilter
afc.user.login.filter.enable=true

# application-mdm.properties 配置文件

application-mdm.properties为主数据的配置文件,默认配置文件路径:${PACKAGE_HOME}/config/application-mdm.properties

# 是否开启延时加载(默认为否)
spring.jpa.open-in-view=false
# 是否关闭验证逻辑(默认关闭)
spring.jpa.properties.javax.persistence.validation.mode=none
# 指定数据库初始化模式(默认为不同步数据库表结构)
spring.jpa.hibernate.ddl-auto=none
# 是否开启sql打印(默认关闭)
spring.jpa.show-sql=false

# 数据库厂商方言配置
## MySQL
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

## Dameng 
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.DmDialect

## GaussDB
#spring.jpa.database=postgresql
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect
#spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false

## Oracle
# spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

## SQLServer
# spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect

# 订阅推送设置心跳检测订阅者服务是否在线时间间隔
mdm.schedule.fixed-delay.mdm-inst-heart-beat=300000
# 报告统计间隔
mdm.report.statistic.interval=0 0 * * * ?
# 数据文件储存类型
mdm.data-file.storage-type=file
# 数据文件储存位置
mdm.data-file.storage-location=./data/data-files
# 是否开启数据模型缓存(默认为是)
mdm.data-model-cache.enabled=true
# 是否开启统一响应(默认为是)
mdm.support-unified-response=false
# 是否开启数据记录日志(默认为是)
mdm.data.record.log.enabled=true
# 数据维护日志自动清理间隔天
mdm.data.record.log.keep.days=15
# 是否开启数据推送(默认为是)
mdm.push.enabled=true
# 是否开启锁(默认为是)
mdm.push.lock-enabled=true
# 核心线程池大小
mdm.push.thread-pool.corePoolSize=50
# 最大线程池大小
mdm.push.thread-pool.maxPoolSize=100
# 队列线程池大小
mdm.push.thread-pool.queueCapacity=200
# 推送扫描间隔(单位为秒)
mdm.push.scan.interval-seconds=60
# 推送数据每页大小
mdm.push.data-page-size=10
# 推送数据步长
mdm.push.data-step-minutes=30
# 是否开启响应体验证(默认为是)
mdm.push.http.validate-response-body.enabled=true
# 响应体code属性
mdm.push.http.validate-response-body.code-attr=code
# 响应体msg属性
mdm.push.http.validate-response-body.msg-attr=message
# 响应体发送成功响应码
mdm.push.http.validate-response-body.ok-code=200

# 推送重试间隔
mdm.push.time-mistake-seconds=30
# 即时推送队列池大小
mdm.push.in-time.event-queue-size=100000

# 是否开启序号清空(默认为是)
mdm.block-sequence-code.clear=true
# 序号清空间隔时间
mdm.block-sequence-code.clear.interval=0 0 2 * * ?

# 操作日志自动清理间隔天
mdm.op-log.clean.keep-days=30

# 主题同步间隔
mdm.afc.copy.scheduled.time=5000

# 邮件服务协议地址  
spring.mail.host=smtp.126.com
# 用来发送邮件的邮箱地址  
spring.mail.username=xxxxx@126.com
# 邮箱密码 
spring.mail.password=
# 邮箱协议
spring.mail.protocol=
# 邮件编码规则
spring.mail.default-encoding=UTF-8