FROM jre:8
MAINTAINER me <me@me>
LABEL Description="my service"
ENV TZ=PRC
ENV JAVA_OPTS="-server -Xms8192m -Xmx8192m -Djava.security.egd=file:/dev/./urandom"
ENV JMX_OPTS="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false  -Dcom.sun.management.jmxremote.port=9999"
ADD target/*.jar /opt/app.jar
CMD java JAVA_OPTSJMX_OPTS -Djava.rmi.server.hostname=$(hostname -I)  -jar -Dspring.profiles.active=dev  /opt/app.jar  --server.tomcat.max-threads=1000 --server.tomcat.max-connections=10000 --server.tomcat.accept-count=100 --server.tomcat.connection-timeout=30000 --server.port=8080
EXPOSE 8080
EXPOSE 9999


连接池配置:

spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    druid:
      url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
      username: root
      password: 123456
      initial-size: 50
      max-active: 200
      min-idle: 10
      max-wait: 60000
      pool-prepared-statements: true
      max-pool-prepared-statement-per-connection-size: 20
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
        login-username: admin
        login-password: 123456
      filter:
        stat:
          log-slow-sql: true
          slow-sql-millis: 1000
          merge-sql: false
        wall:
          config:
            multi-statement-allow: true

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code