1.nacos启用为服务
<dependency>
<groupId>com.xy</groupId>
<artifactId>xy-core-framework-common-api-distributed</artifactId>
<version>${xy-core-framework.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</exclusion>
</exclusions>
</dependency>
2.添加nacos配置
server.port=8094
server-addr=192.168.1.3
nacos.namespace=afb35e27-a583-40c1-a4d2-411a2b9764cd
#server-addr=192.168.3.50
#nacos.namespace=c31a0971-b627-4aa8-8a64-109afab2ab6b
#server-addr=10.30.0.143
#nacos.namespace=e5756e6a-218e-45f3-bbbd-af36c69f2bf4
#############################################################
spring.cloud.nacos.config.server-addr=${server-addr}:8848
#spring.profiles.active=dev
#spring.cloud.nacos.config.cluster-name=
spring.cloud.nacos.config.namespace=${nacos.namespace}
spring.cloud.nacos.config.group=local
#spring.cloud.nacos.config.name=company_demo-dev
spring.cloud.nacos.config.file-extension=properties
#spring.cloud.nacos.config.prefix=company-demo
spring.cloud.nacos.config.refresh-enabled=true
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.config.encode=UTF-8
spring.cloud.nacos.config.extension-configs[0].data-id=redis-common.properties
spring.cloud.nacos.config.extension-configs[0].group=common
spring.cloud.nacos.config.extension-configs[0].refresh=true
spring.cloud.nacos.config.extension-configs[1].data-id=rocket-common.properties
spring.cloud.nacos.config.extension-configs[1].group=common
spring.cloud.nacos.config.extension-configs[1].refresh=true
spring.cloud.nacos.config.extension-configs[2].data-id=dubbo-common.properties
spring.cloud.nacos.config.extension-configs[2].group=common
spring.cloud.nacos.config.extension-configs[2].refresh=true
spring.cloud.nacos.config.extension-configs[3].data-id=info-common.properties
spring.cloud.nacos.config.extension-configs[3].group=common
spring.cloud.nacos.config.extension-configs[3].refresh=true
spring.cloud.nacos.config.extension-configs[4].data-id=management-common.properties
spring.cloud.nacos.config.extension-configs[4].group=common
spring.cloud.nacos.config.extension-configs[4].refresh=true
spring.cloud.nacos.config.extension-configs[5].data-id=generator-id-common.properties
spring.cloud.nacos.config.extension-configs[5].group=common
spring.cloud.nacos.config.extension-configs[5].refresh=true
spring.cloud.nacos.config.extension-configs[6].data-id=lark-common.properties
spring.cloud.nacos.config.extension-configs[6].group=common
spring.cloud.nacos.config.extension-configs[6].refresh=true
spring.cloud.nacos.config.extension-configs[7].data-id=mybatis-plus-common.properties
spring.cloud.nacos.config.extension-configs[7].group=common
spring.cloud.nacos.config.extension-configs[7].refresh=true
spring.cloud.nacos.config.extension-configs[8].data-id=arthas-common.properties
spring.cloud.nacos.config.extension-configs[8].group=common
spring.cloud.nacos.config.extension-configs[8].refresh=true
spring.cloud.nacos.config.extension-configs[9].data-id=i18n-common.properties
spring.cloud.nacos.config.extension-configs[9].group=common
spring.cloud.nacos.config.extension-configs[9].refresh=true
spring.cloud.nacos.config.extension-configs[10].data-id=logback-common.properties
spring.cloud.nacos.config.extension-configs[10].group=common
spring.cloud.nacos.config.extension-configs[10].refresh=true
spring.cloud.nacos.config.extension-configs[11].data-id=sentinel-common.properties
spring.cloud.nacos.config.extension-configs[11].group=common
spring.cloud.nacos.config.extension-configs[11].refresh=true
spring.cloud.nacos.config.extension-configs[12].data-id=zk-common.properties
spring.cloud.nacos.config.extension-configs[12].group=common
spring.cloud.nacos.config.extension-configs[12].refresh=true
spring.cloud.nacos.config.extension-configs[13].data-id=job-common.properties
spring.cloud.nacos.config.extension-configs[13].group=common
spring.cloud.nacos.config.extension-configs[13].refresh=true
#spring.cloud.nacos.config.endpoint=${spring.application.name}
#spring.cloud.nacos.config.access-key=
#spring.cloud.nacos.config.secret-key=
#spring.cloud.nacos.config.config-long-poll-timeout=3000
#spring.cloud.nacos.config.timeout=9000
#spring.cloud.nacos.config.config-retry-time=3
#spring.cloud.nacos.config.max-retry=5
#spring.cloud.nacos.config.enable-remote-sync-config=false
#spring.cloud.nacos.config.shared-configs=
#spring.cloud.nacos.config.context-path=
#spring.cloud.nacos.config.environment=
#spring.cloud.nacos.config.extension-configs=
#############################################################
spring.cloud.nacos.discovery.server-addr=${server-addr}:8848
spring.cloud.nacos.discovery.service=${spring.application.name}
#spring.cloud.nacos.discovery.cluster-name=
spring.cloud.nacos.discovery.namespace=${nacos.namespace}
spring.cloud.nacos.discovery.group=local
spring.cloud.nacos.discovery.enabled=true
#spring.cloud.nacos.discovery.access-key=
#spring.cloud.nacos.discovery.secret-key=
spring.cloud.nacos.discovery.instance-enabled=true
#spring.cloud.nacos.discovery.ip=
#spring.cloud.nacos.discovery.endpoint=
#spring.cloud.nacos.discovery.heart-beat-interval=3000
#spring.cloud.nacos.discovery.heart-beat-timeout=6000
#spring.cloud.nacos.discovery.ip-delete-timeout=9000
#spring.cloud.nacos.discovery.log-name=
#spring.cloud.nacos.discovery.naming-load-cache-at-start=true
#spring.cloud.nacos.discovery.network-interface=
#spring.cloud.nacos.discovery.metadata.version=1
#spring.cloud.nacos.discovery.port=-1
spring.cloud.nacos.discovery.register-enabled=true
#spring.cloud.nacos.discovery.secure=false
#spring.cloud.nacos.discovery.watch.enabled=true
#spring.cloud.nacos.discovery.watch-delay=30000
#spring.cloud.nacos.discovery.weight=1
3.在nacos中配置资源信息
common配置详情
redis-common.properties
#通用设置
spring.redis.host=${server-addr}
spring.redis.port=6379
spring.redis.database=0
spring.redis.jedis.pool.max-active=800
spring.redis.jedis.pool.max-idle=800
spring.redis.jedis.pool.max-wait=1000
spring.redis.jedis.pool.min-idle=0
#设置在自己的项目中
spring.redis.distributed.lock.enable=true
spring.redis.distributed.lock.client=redis_template
�rocket-common.properties
############################# rocket mq config###########################################
#通用配置
rocketmq.name-server=${server-addr}:9876
rocketmq.access-channel=LOCAL
rocketmq.producer.group=${spring.application.name}
#rocketmq.producer.access-key=
#rocketmq.producer.secret-key=
#rocketmq.producer.enable-msg-trace=true
#rocketmq.producer.customized-trace-topic=
#rocketmq.producer.max-message-size=4194394
rocketmq.producer.compress-message-body-threshold=4096
rocketmq.producer.retry-next-server=false
rocketmq.producer.retry-times-when-send-failed=2
rocketmq.producer.retry-times-when-send-async-failed=2
rocketmq.producer.send-message-timeout=3000
#配置在自己的项目中
#是否开启mq消息监听,如果开启,则正常消费消息,如果关系,服务当前节点则不在消费任何消息
rocketmq.consumer.enable=true
#rocketmq.consumer.group=${spring.application.name}-consumer
�dubbo-common.properties
######################### dubbo config ###############################################
dubbo.application.name=${spring.application.name}
dubbo.application.qos-enable=true
###--------registry config------------
#zookeeper://localhost:2181
#nacos://localhost:8848
dubbo.registry.address=zookeeper://${server-addr}:2181
dubbo.registry.check=true
#否是关闭注册
dubbo.registry.register=true
###--------protocol config------------
dubbo.protocol.name=dubbo
dubbo.protocol.port=20880
dubbo.protocol.dispatcher=all
dubbo.protocol.threadpool=fixed
dubbo.protocol.threads=100
###--------provider config------------
dubbo.provider.delay=2000
dubbo.provider.executes=10
dubbo.provider.actives=10
dubbo.provider.timeout=3000
dubbo.provider.retries=2
dubbo.provider.loadbalance=random
dubbo.application.shutwait=15000
#dubbo.service.com.company.demo.DemoServiceApi.timeout=5000
###--------config-center config------------
#dubbo.config-center.address=zookeeper://${local.ip}:2181
#dubbo.config-center.protocol=nacos
###--------consumer config------------
dubbo.consumer.timeout=3000
dubbo.consumer.check=true
dubbo.consumer.actives=10
dubbo.consumer.reconnect=true
dubbo.consumer.sent=true
dubbo.consumer.corethreads=10
dubbo.consumer.threadpool=fixed
dubbo.consumer.threads=10
dubbo.consumer.lazy=false
#dubbo.reference.org.apache.dubbo.samples.api.DemoService.timeout=6000
#dubbo.reference.org.apache.dubbo.samples.api.DemoService.sayHello.timeout=7000
�info-common.properties
info.app=${spring.application.name}
info.site=www.company.com
info.build.groupId=@project.groupId@
info.build.artifactId=@project.artifactId@
info.build.finalName$=@project.build.finalName@
info.build.version=2.0.96110
�management-common.properties
##############################---配置监控信息---##########################################
#spring.jmx.enabled=true
#spring.jmx.unique-names=true
#spring.jmx.default-domain=
#management.metrics.tags.application=${spring.application.name}
#management.auditevents.enabled=false
#management.endpoint.auditevents.enabled=false
#management.endpoint.auditevents.cache.time-to-live=5
#management.endpoints.web.exposure.include=*
#management.endpoint.health.enabled=false
#management.endpoint.health.show-details=always
#management.endpoint.beans.enabled=false
#management.endpoint.beans.cache.time-to-live=0ms
#management.endpoint.shutdown.enabled=false
######## 属性尝试 ##########
#management.endpoint.httptrace.enabled=false
#management.endpoint.env.post.enabled=false
#################
###springbootAdmin 开启日志打印
#management.endpoint.logfile.enabled=true
#management.endpoint.logfile.external-file=./logs/${spring.application.name}/${spring.application.name}.log
#management.endpoint.logfile.cache.time-to-live=0ms
�generator-id-common.properties
#######################分布式id##################################
com.xy.id.generator.zk.enable=true
com.xy.id.generator.zk.connect-string=${server-addr}:2181
com.xy.id.generator.cloud-service=ali
com.xy.id.generator.zk.username=
�lark-common.properties
#####lark 告警消息
xy.core.push.enable=true
xy.core.push.channel=lark
xy.core.push.alarm-url=https://open.larksuite.com/open-apis/bot/v2/hook/a2636256-20e0-43d1-8218-4c107fd9bf44
xy.core.push.logic-url=https://open.larksuite.com/open-apis/bot/v2/hook/c40bdb56-567f-498e-a41a-8776f1d98f27
�mybatis-plus-common.properties
####################### mybatis plus config #################################################
mybatis-plus.mapper-locations=classpath*:/mybatis/*.xml
#mybatis-plus.type-aliases-package=com.company.demo.entities
mybatis-plus.global-config.db-config.id-type=auto
mybatis-plus.global-config.db-config.logic-delete-field=deleted
mybatis-plus.global-config.db-config.logic-delete-value=1
mybatis-plus.global-config.db-config.logic-not-delete-value=0
#mybatis-plus.global-config.db-config.column-format=
#mybatis-plus.global-config.db-config.table-prefix=
mybatis-plus.global-config.db-config.table-underline=true
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.configuration.call-setters-on-nulls=true
##是否开启sql性能检查
mybatis-plus.illegal-s-q-l-inner-interceptor=true
�arthas-common.properties
####################### arthas config ##########################
arthas.agent-id=${spring.application.id}
## 使用tunnel-server所在服务器ip
arthas.tunnel-server=ws://192.168.1.2:7777/ws
�i18n-common.properties
spring.messages.encoding=UTF-8
spring.messages.basename=i18n/messages
spring.messages.fallback-to-system-locale=false
�logback-common.properties
############################ logback config ############################################
logging.config=classpath:logback-spring.xml
logging.file.path=./logs/${spring.application.name}
#默认日志级别
logging.level.root=info
logging.level.sql=debug
logging.level.web=debug
�sentinel-common.properties
########################### 负载均衡 ##############################################
spring.cloud.loadbalancer.retry.enabled=true
spring.cloud.sentinel.enabled=true
spring.cloud.sentinel.transport.dashboard=${server-addr}:8858
spring.cloud.sentinel.transport.port=8719
#应用与Sentinel控制台的心跳间隔时间
spring.cloud.sentinel.transport.heartbeat-interval-ms=1000
#Sentinel自动化配置是否生效
spring.cloud.sentinel.filter.enabled=true
spring.cloud.sentinel.metric.charset=UTF-8
#取消Sentinel控制台懒加载
spring.cloud.sentinel.eager=true
#Sentinel 日志文件所在的目录
spring.cloud.sentinel.log.dir=./logs/${spring.application.name}/sentinel
spring.cloud.sentinel.xy.enable=true
spring.cloud.sentinel.xy.mvc-interceptor-enable=true
spring.cloud.sentinel.xy.total-interceptor-enable=true
zk-common.properties
zookeeper.address=192.168.1.2:2181
zookeeper.timeout=30
zookeeper.lock-enable=true
job-common.properties
# 定时任务是否开启
elasticjob.enabled=true
#定时任务注册的zk地址
elasticjob.reg-center.server-lists=zookeeper-svc:2181
#定时任务注册的命名空间 默认job/${spring.application.name}
elasticjob.reg-center.namespace=job/${spring.application.name}
#是否跟踪任务执行trace
elasticjob.datasource.enable=true
#任务开启trace记录的数据库地址,目前默认在trace系统中
elasticjob.datasource.url=jdbc:mysql://t-mysql.celcxdxq82fd.us-west-2.rds.amazonaws.com:3306/trendsi_trace?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
elasticjob.datasource.type=com.zaxxer.hikari.HikariDataSource
elasticjob.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
elasticjob.datasource.username=trendsi
elasticjob.datasource.password=b3?(`*f_:h8SBXr$