Jelajahi Sumber

更新 gateway, auth, user 的 application-ha-full.yml 配置文件

reghao 3 minggu lalu
induk
melakukan
831005603e

+ 0 - 23
auth/auth-service/src/main/resources/application-cluster.yml

@@ -1,23 +0,0 @@
-dubbo:
-  registry:
-    group: dubbo
-    address: zookeeper://192.168.0.211:2181?backup=192.168.0.212:2181,192.168.0.213:2181
-spring:
-  cloud:
-    discovery:
-      enabled: true
-  data:
-    redis:
-      database: 0
-      host: 192.168.0.211
-      port: 6379
-      password: Test_123456
-  rabbitmq:
-    addresses: 192.168.0.211:5672,192.168.0.212:5672,192.168.0.213:5672
-    virtual-host: /
-    username: test
-    password: Test_123456
-  datasource:
-    url: jdbc:mysql://192.168.0.211:3306/tnb_account_tdb?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8
-    username: test
-    password: Test_123456

+ 106 - 0
auth/auth-service/src/main/resources/application-ha-full.yml

@@ -0,0 +1,106 @@
+dubbo:
+  application:
+    name: ${spring.application.name}
+    qos-enable: true
+    qos-port: 16101
+    qos-accept-foreign-ip: false
+  scan:
+    base-packages: cn.reghao.tnb.auth.app.rpc
+  protocol:
+    name: dubbo
+    port: 6101
+  registry:
+    group: dubbo
+    address: zookeeper://192.168.0.211:2181?backup=192.168.0.212:2181,192.168.0.213:2181
+server:
+  port: 6001
+  tomcat:
+    max-http-form-post-size: 4MB
+  servlet:
+    session:
+      cookie:
+        secure: true
+        http-only: true
+        # org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getSessionTimeoutInMinutes 获取超时时间
+        # 两个请求间隔的最大时间, 超过此时间则会话过期
+      timeout: 10m
+spring:
+  threads:
+    virtual:
+      enabled: true
+  application:
+    name: auth-service
+  mvc:
+    pathmatch:
+      matching-strategy: ant_path_matcher
+  servlet:
+    multipart:
+      max-request-size: 5MB
+      max-file-size: 5MB
+  session:
+    store-type: redis
+    redis:
+      namespace: tnb:auth:session
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 10
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: EvaluationHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+    url: jdbc:mysql://192.168.0.211:6033/tnb_account_tdb?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8
+    username: test
+    password: Test_123456
+  freemarker:
+    template-loader-path:
+      - classpath:/templates
+    cache: false
+    check-template-location: true
+    request-context-attribute: request
+    charset: utf-8
+    suffix: .ftl
+    settings:
+      classic_compatible: true #处理空值
+      template_exception_handler: rethrow
+      template_update_delay: 0
+      datetime_format: yyyy-MM-dd HH:mm
+      number_format: 0.##
+  cloud:
+    discovery:
+      enabled: true
+    nacos:
+      discovery:
+        server-addr: 192.168.0.209:8848
+        username: nacos
+        password: Test_123456
+  data:
+    redis:
+      database: 0
+      password: Test_123456
+      lettuce:
+        pool:
+          # 最大连接数
+          max-active: 20
+          # 连接池中获取连接时最大等待时间ms
+          max-wait: 300
+          # 最大空闲连接数
+          max-idle: 5
+          # 最小空闲连接数
+          min-idle: 1
+      sentinel:
+        master: mymaster
+        password: Test_123456
+        nodes:
+          - 192.168.0.211:26379
+          - 192.168.0.212:26379
+          - 192.168.0.213:26379
+  rabbitmq:
+    addresses: 192.168.0.211:5672,192.168.0.212:5672,192.168.0.213:5672
+    virtual-host: /
+    username: test
+    password: Test_123456

+ 260 - 0
gateway/src/main/resources/application-ha-full.yml

@@ -0,0 +1,260 @@
+server:
+  port: 6000
+spring:
+  threads:
+    virtual:
+      enabled: true
+  application:
+    name: gateway
+  cloud:
+    discovery:
+      enabled: true
+    nacos:
+      discovery:
+        server-addr: 192.168.0.209:8848
+        username: nacos
+        password: Test_123456
+    loadbalancer:
+      ribbon:
+        enabled: false
+    gateway:
+      # 默认过滤器(对所有 route 均生效)
+      default-filters:
+        # 限流配置
+        - name: MyRequestRateLimiter
+          args:
+            # 如果 keyResolver 返回空 key 则拒绝请求返回 403, 默认 true 表示拒绝, false 表示允许访问
+            deny-empty-key: false
+            # 自定义的 KeyResolver(从请求 exchange 解析 id 来区分独立的限流单元, id 可以是 userId, remoteAddr, sessionId 等)
+            key-resolver: "#{@keyResolver}"
+            #            rate-limiter: "#{@myRateLimiter}"
+            #            my-rate-limiter.requestedTokens: 1
+            rate-limiter: "#{@redisRateLimiter}"
+            # 令牌桶算法每秒补充的 token 数量(每秒的请求数量)
+            redis-rate-limiter.replenishRate: 100
+            # 令牌桶算法的 token 最大数量(每秒的最大请求数量)
+            redis-rate-limiter.burstCapacity: 150
+            # 单次请求消费的 token 数量
+            redis-rate-limiter.requestedTokens: 1
+      routes:
+        - id: account-router
+          # spring-cloud-starter-zookeeper-discovery 提供服务发现功能
+          uri: lb://auth-service
+          predicates:
+            - Path=/api/account/**
+          filters:
+            - StripPrefix=0
+        - id: static-router
+          uri: lb://auth-service
+          predicates:
+            - Path=/dist/images/**
+          filters:
+            - StripPrefix=0
+        - id: auth-router
+          uri: lb://auth-service
+          predicates:
+            - Path=/api/auth/**
+          filters:
+            - StripPrefix=0
+        - id: oauth-router
+          uri: lb://auth-service
+          predicates:
+            - Path=/oauth/**
+          filters:
+            - StripPrefix=0
+        - id: account-admin-router
+          uri: lb://auth-service
+          predicates:
+            - Path=/api/admin/account/**
+          filters:
+            - StripPrefix=0
+        - id: account-open-router
+          uri: lb://auth-service
+          predicates:
+            - Path=/api/open/account/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: user-router
+          uri: lb://user-service
+          predicates:
+            - Path=/api/user/**
+          filters:
+            - StripPrefix=0
+        - id: user-admin-router
+          uri: lb://user-service
+          predicates:
+            - Path=/api/admin/user/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: content-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/content/**
+          filters:
+            - StripPrefix=0
+        - id: content-admin-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/admin/content/**
+          filters:
+            - StripPrefix=0
+        - id: content-open-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/open/content/**
+          filters:
+            - StripPrefix=0
+        - id: timeline-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/timeline/**
+          filters:
+            - StripPrefix=0
+        - id: search-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/search/**
+          filters:
+            - StripPrefix=0
+        - id: mall-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/mall/**
+          filters:
+            - StripPrefix=0
+        - id: geo-router
+          uri: lb://content-service
+          predicates:
+            - Path=/api/geo/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: data-router
+          uri: lb://data-service
+          #uri: http://192.168.0.39:6005
+          predicates:
+            - Path=/api/data/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: file-router
+          uri: lb://file-service
+          predicates:
+            - Path=/api/file/**
+          filters:
+            - StripPrefix=0
+        - id: file1-router
+          uri: lb://file-service
+          predicates:
+            - Path=/file/**
+          filters:
+            - StripPrefix=0
+        - id: disk-router
+          uri: lb://file-service
+          predicates:
+            - Path=/api/disk/**
+          filters:
+            - StripPrefix=0
+        - id: file-admin-router
+          uri: lb://file-service
+          predicates:
+            - Path=/api/admin/file/**
+          filters:
+            - StripPrefix=0
+        - id: file-open-router
+          uri: lb://file-service
+          predicates:
+            - Path=/api/open/file/**
+          filters:
+            - StripPrefix=0
+        - id: chat-router
+          uri: lb://file-service
+          predicates:
+            - Path=/api/chat/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: message-websocket
+          uri: lb:ws://message-service
+          predicates:
+            - Path=/ws/**
+        - id: message-router
+          uri: lb://message-service
+          predicates:
+            - Path=/api/message/**
+        - id: message-admin-router
+          uri: lb://message-service
+          predicates:
+            - Path=/api/admin/message/**
+        - id: tnb-admin-router
+          uri: lb://message-service
+          predicates:
+            - Path=/api/admin/tnb/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: log-websocket
+          uri: lb:ws://search-service
+          predicates:
+            - Path=/logws/**
+        - id: search1-router
+          uri: lb://search-service
+          predicates:
+            - Path=/api/search1/**
+        - id: blog-router
+          uri: lb://search-service
+          predicates:
+            - Path=/api/blog/**
+        - id: comment-router
+          uri: lb://search-service
+          predicates:
+            - Path=/api/comment/**
+          filters:
+            - StripPrefix=0
+        - id: admin-router
+          uri: lb://admin-service
+          predicates:
+            - Path=/api/admin1/**
+          filters:
+            - StripPrefix=0
+        ###############################################################################
+        - id: oss-router
+          uri: http://127.0.0.1:8010
+          predicates:
+            - Path=/api/oss/**
+          filters:
+            - StripPrefix=0
+  rabbitmq:
+    addresses: 192.168.0.211:5672,192.168.0.212:5672,192.168.0.213:5672
+    virtual-host: /
+    username: test
+    password: Test_123456
+  data:
+    redis:
+      database: 0
+      password: Test_123456
+      lettuce:
+        pool:
+          # 最大连接数
+          max-active: 20
+          # 连接池中获取连接时最大等待时间ms
+          max-wait: 300
+          # 最大空闲连接数
+          max-idle: 5
+          # 最小空闲连接数
+          min-idle: 1
+      sentinel:
+        master: mymaster
+        password: Test_123456
+        nodes:
+          - 192.168.0.211:26379
+          - 192.168.0.212:26379
+          - 192.168.0.213:26379
+app:
+  resources:
+    _api_admin_: tnb_admin
+    _api_oss_: tnb_admin
+    _api_blog_bg_: tnb_admin
+    _api_disk_: tnb_disk

+ 0 - 19
user/user-service/src/main/resources/application-cluster.yml

@@ -1,19 +0,0 @@
-dubbo:
-  registry:
-    group: dubbo
-    protocol: zookeeper
-    address: 192.168.0.211:2181,192.168.0.212:2181,192.168.0.213:2181
-spring:
-  cloud:
-    discovery:
-      enabled: true
-  data:
-    redis:
-      database: 0
-      host: 192.168.0.211
-      port: 6379
-      password: Test_123456
-  datasource:
-    url: jdbc:mysql://192.168.0.211:3306/tnb_account_tdb?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8
-    username: test
-    password: Test_123456

+ 80 - 0
user/user-service/src/main/resources/application-ha-full.yml

@@ -0,0 +1,80 @@
+dubbo:
+  application:
+    name: user-service
+    qos-enable: true
+    qos-port: 16104
+    qos-accept-foreign-ip: false
+  scan:
+    base-packages: cn.reghao.tnb.user.app.rpc
+  protocol:
+    name: dubbo
+    port: 6104
+  registry:
+    group: dubbo
+    address: zookeeper://192.168.0.211:2181?backup=192.168.0.212:2181,192.168.0.213:2181
+server:
+  port: 6004
+  tomcat:
+    max-http-form-post-size: 4MB
+spring:
+  mvc:
+    pathmatch:
+      matching-strategy: ant_path_matcher
+  datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    type: com.zaxxer.hikari.HikariDataSource
+    hikari:
+      minimum-idle: 5
+      maximum-pool-size: 10
+      auto-commit: true
+      idle-timeout: 30000
+      pool-name: EvaluationHikariCP
+      max-lifetime: 1800000
+      connection-timeout: 30000
+      connection-test-query: SELECT 1
+    url: jdbc:mysql://192.168.0.211:6033/tnb_account_tdb?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8
+    username: test
+    password: Test_123456
+  cloud:
+    discovery:
+      enabled: true
+    nacos:
+      discovery:
+        server-addr: 192.168.0.209:8848
+        username: nacos
+        password: Test_123456
+  data:
+    redis:
+      database: 0
+      password: Test_123456
+      lettuce:
+        pool:
+          # 最大连接数
+          max-active: 20
+          # 连接池中获取连接时最大等待时间ms
+          max-wait: 300
+          # 最大空闲连接数
+          max-idle: 5
+          # 最小空闲连接数
+          min-idle: 1
+      sentinel:
+        master: mymaster
+        password: Test_123456
+        nodes:
+          - 192.168.0.211:26379
+          - 192.168.0.212:26379
+          - 192.168.0.213:26379
+mybatis:
+  configuration:
+    map-underscore-to-camel-case: true
+  mapper-locations: classpath*:mapper/**/**.xml
+  type-aliases-package: cn.reghao.tnb.user.app.model.po
+management:
+  endpoints:
+    web:
+      base-path: /api/user/actuator
+      exposure:
+        include: "*"
+  metrics:
+    tags:
+      application: ${spring.application.name}