Compare commits
1 Commits
feat/gw-03
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fea479a597 |
26
xs-server/src/main/java/com/xiang/HealthController.java
Normal file
26
xs-server/src/main/java/com/xiang/HealthController.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xiang;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class HealthController {
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String env;
|
||||||
|
|
||||||
|
@GetMapping("/actuator/health")
|
||||||
|
public Map<String, String> checkHealth() {
|
||||||
|
Map<String, String> map = Maps.newHashMap();
|
||||||
|
map.put("env", env);
|
||||||
|
map.put("status", "UP");
|
||||||
|
log.info("cornucopia application health check success! listening in env:{}, now:{}", env, System.currentTimeMillis());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,9 +9,11 @@ spring:
|
|||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: general.xiangtech.xyz:8848
|
|
||||||
namespace: 00131110-3ecb-4a35-8bbb-624edde1d937
|
|
||||||
group: DEFAULT_GROUP
|
group: DEFAULT_GROUP
|
||||||
|
namespace: 6f603892-e9f7-4ca4-acbc-538fa09ebec0
|
||||||
|
server-addr: http://192.168.1.10:8848
|
||||||
|
# 是否启用健康检查
|
||||||
|
register-enabled: true
|
||||||
username: nacos
|
username: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
gateway:
|
gateway:
|
||||||
|
|||||||
54
xs-server/src/main/resources/application-outside.yml
Normal file
54
xs-server/src/main/resources/application-outside.yml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
server:
|
||||||
|
port: 38010
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: xservice-gateway
|
||||||
|
main:
|
||||||
|
web-application-type: reactive # 强制使用 WebFlux
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
namespace: 00131110-3ecb-4a35-8bbb-624edde1d937
|
||||||
|
server-addr: http://general.xiangtech.xyz:8848
|
||||||
|
# 是否启用健康检查
|
||||||
|
register-enabled: false
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
gateway:
|
||||||
|
discovery:
|
||||||
|
locator:
|
||||||
|
enabled: true # 开启 nacos 自动路由
|
||||||
|
routes:
|
||||||
|
- id: xservice-auth-center
|
||||||
|
uri: lb://xservice-auth-center
|
||||||
|
predicates:
|
||||||
|
- Path=/api-auth/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: xservice-common-center
|
||||||
|
uri: lb://xservice-common-center
|
||||||
|
predicates:
|
||||||
|
- Path=/api-common/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: xservice-stock-center
|
||||||
|
uri: lb://xservice-stock-center
|
||||||
|
predicates:
|
||||||
|
- Path=/api-stock/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
|
||||||
|
redis:
|
||||||
|
host: r-bp1wt59a6nfyt4e3ltpd.redis.rds.aliyuncs.com
|
||||||
|
port: 6379
|
||||||
|
password: Xiang0000 # 如果无密码可以省略
|
||||||
|
database: 10
|
||||||
|
timeout: 5000
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 8
|
||||||
|
max-idle: 8
|
||||||
|
min-idle: 0
|
||||||
|
max-wait: 1000
|
||||||
@@ -9,9 +9,11 @@ spring:
|
|||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: general.xiangtech.xyz:8848
|
|
||||||
namespace: 6f603892-e9f7-4ca4-acbc-538fa09ebec0
|
|
||||||
group: DEFAULT_GROUP
|
group: DEFAULT_GROUP
|
||||||
|
namespace: 6f603892-e9f7-4ca4-acbc-538fa09ebec0
|
||||||
|
server-addr: http://192.168.32.3:8848
|
||||||
|
# 是否启用健康检查
|
||||||
|
register-enabled: true
|
||||||
username: nacos
|
username: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
gateway:
|
gateway:
|
||||||
|
|||||||
Reference in New Issue
Block a user