数据服务微服务(lczDataProvideServer)部署过程如下:

配置yml文件

lczDataProvideServer\application.yml 文件:

#当前微服务信息
server:
  #调度微服务接口
  port: 14684
  servlet:
    context-path: /lczServer

  tomcat:
    threads:
      #最小线程数
      min-spare: 10
      #最大线程数
      max: 500
      #等待最大队列长度
    accept-count: 1000
    #最大链接数
    max-connections: 2000

spring:
  application:
    name: lczDataProvide
  mvc:
    throw-exception-if-no-handler-found: true
logging:
  config: classpath:conf/log4j2.xml

feign:
  httpclient:
    enabled: true
    max-connections: 100
    connection-timeout: 1000
    time-to-live: 10
    time-to-live-unit: minutes
  lcz_server:
    platform:
      name: lczPlatform
      url: http://127.0.0.1:8081/lczServer
    batch_work:
      name: lczBatchwork
      url: http://127.0.0.1:14685/lczServer

#熔断配置
hystrix:
  command:
    execution:
      timeoutInMilliseconds: 2000    #熔断超时时间
      isolation:
        strategy: THREAD
  threadPool:
    coreSize: 50
    maxQueueSize: 300
    maximumSize: 300
    queueSizeRejectionThreshold: 200
    keepAliveTimeMinutes: 6

一般需要进行以下配置:
(1) 修改 feign->lcz_server 下各微服务的 url 访问地址。
  url的配置规则:直接配置代理的nginx访问地址即可,格式: http(https)://nginx地址:端口/平台应用名;

(2) 修改应用上下文路径(可选):默认为lczServer,如果访问地址中需要重命名,那么 server-> servlet -> context-pathfeign->lcz_server -> url 中都需要一致性修改。同时,nginx.conf文件中也做对应调整。

(3) 调整微服务端口(可选):如果默认的微服务端口已经被占用,可用过 server->port 属性进行调整。

【警告】yml文件修改时,不要随意调整对象和属性的缩进格式,否则文件配置读取会失败。

作者:柳杨  创建时间:2025-01-09 18:15
最后编辑:柳杨  更新时间:2025-04-22 15:31