-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-example.yaml
157 lines (155 loc) · 8.15 KB
/
config-example.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
common:
syncer-api-key: NopU13xRheZng2hqHAwaI0TF5VHNN05G
discovery-servers:
nacos1:
type: nacos
weight: 100
prefix: /nacos/v1/
host: "http://nacos-server:8858"
eureka1:
type: eureka
weight: 100
prefix: /eureka/
host: "http://admin:admin@eureka-server:8761"
gateway-servers:
apisix1:
type: apisix
admin-url: http://apisix-server:9080
prefix: /apisix/admin/
config:
X-API-KEY: xxxxxxxx-xxxx-xxxxxxxxxxxx
version: v3
kong1:
type: kong
admin-url: http://kong-server:8001
prefix: /
config:
targets_uri: /targets/all
targets:
- discovery: nacos1
gateway: apisix1
enabled: false
# 拉取间隔
# 支持crontab格式(5位 * * * * * == 分 时 日 月 周 6位 * * * * * * == 秒 分 时 日 月 周)
# 特殊值 | 描述 | 示例
# @yearly (or @annually) | 每年1月1日 午夜零点零分零秒执行一次 | 0 0 0 1 1 *
# @monthly | 每月1日 午夜零点零分零秒执行一次 | 0 0 0 1 * *
# @weekly | 每周日的午夜零点零分零秒执行一次 | 0 0 0 * * 0
# @daily (or @midnight) | 每天的午夜零点零分零秒执行一次 | 0 0 0 * * *
# @hourly | 每小时的零分零秒执行一次 | 0 0 * * * *
# @reboot | 启动时执行一次 | -
# @every | 每多久执行一次(仅支持s(秒)/m(分)/h(时),且一次只能用一种) | */30 * * * * *
fetch-interval: "*/30 * * * * *" # every 30 seconds
maximum-interval-sec: 20 # now - last > ${maximum-interval-sec}sec is lost
upstream-prefix: test
name: test
# 排除指定服务(支持正则)
exclude-service: []
config:
groupName: DEFAULT_GROUP
namespaceId: test
template: |
{
"timeout": {
"connect": 30,
"send": 30,
"read": 30
},
"name": "$name",
"nodes": $nodes,
"type":"roundrobin",
"desc": "auto sync by https://github.com/anjia0532/discovery-syncer-python"
}
# 主动健康检查
healthcheck:
# 目前仅支持 http/https
type: http
# http[s]://ip:port+uri
uri: /
# 主动健康检查超时时间,不设置默认30秒,单位是秒,正整数
timeout-sec: 10
# 定时作业间隔
interval: "@every 10s"
# 保留节点数,不设置默认保留1个,假设一个service有3个节点,min-hosts设置的是3,即使都不健康,也不会去注册中心下线实例
# 如果一个service有3个节点,min-hosts设置的是2,假设都不健康,则会下线1个实例,保留2个
min-hosts: 3
# 健康检查http方法,默认是GET
method: GET
# 健康断言 实例状态默认是 unknown
# 特别的 相同百位数的状态码,可以缩写成 xx,比如 1xx[100-199], 2xx[200-299], 3xx[300-399], 4xx[400-499], 5xx[500-599]
# 健康检查返回的状态码同时满足 healthy.http_statuses 和 unhealthy.http_statuses 交集 status,则认为是健康节点
# 比如 http_status 是 401,healthy.http_statuses 是['4xx'], unhealthy.http_statuses 是[401],则认为是健康节点
# 比如 http_status 是 401,healthy.http_statuses 是[400], unhealthy.http_statuses 是['4xx'],则认为是不健康节点
healthy:
# 如果健康检查 访问 http[s]://ip:port+uri,在timeout超时之前,返回了 http_statuses 指定的状态码,则视为健康节点
http_statuses: [200]
# successes 默认是1 ,连续成功超过 successes 次,此节点视为是 healthy, 默认是 unknown
successes: 1
# 不健康断言
unhealthy:
# 如果健康检查 访问 http[s]://ip:port+uri,超时了则 timeouts 计数增加,未超时正常返回了,检查 http_status ,是否命中 http_statuses
http_statuses: [404,500,502,503,504]
# failures 默认是1 ,连续失败超过 failures 次,此节点视为 unhealthy (failures或timeouts任一超过,均视为 unhealthy)
failures: 1
# timeouts 默认是1 ,连续失败超过 timeouts 次,此节点视为 unhealthy (failures或timeouts任一超过,均视为 unhealthy)
timeouts: 1
# 状态发生变更时 unknown-> healthy,unknown->unhealthy,healthy->unhealthy,unhealthy->healthy
# 会向 alert.url 推送 webhook,url query参数,key是body,值是jsonobject(类似 {"id":"a848ce01-7891-44f0-9f26-5ede6c9f6211","target_id":"0-apisix-nacos","service":"demo","instance":"10.42.0.98:8085","successes":0,"failures":0,"timeouts":1,"status":"unknown","create_time":"2024-06-26 10:13:49","last_time":"2024-06-26 10:13:58","new_status":"unhealthy","items":{"unhealthy":[{"id":"a848ce01-7891-44f0-9f26-5ede6c9f6211","target_id":"0-apisix-nacos","service":"demo","instance":"10.42.0.98:8085","successes":0,"failures":0,"timeouts":1,"status":"unhealthy","create_time":"2024-06-26 10:13:49.084153"}]}})
# 如果 alert.url 不配置,则不会推送,也不会报错,method 默认是 GET
alert:
url: ""
method: ""
- discovery: eureka1
gateway: apisix1
enabled: false
fetch-interval: "*/10 * * * * *" # every 10 seconds
upstream-prefix: test-eureka
name: test-eureka
maximum-interval-sec: 10
config:
template: |
{
"name": "$name",
"algorithm": "round-robin",
"hash_on": "none",
"hash_fallback": "none",
"hash_on_cookie_path": "/",
"slots": 10000,
"healthchecks": {
"passive": {
"healthy": {
"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308],
"successes": 0
},
"type": "http",
"unhealthy": {
"http_statuses": [429, 500, 503],
"timeouts": 0,
"http_failures": 0,
"tcp_failures": 0
}
},
"active": {
"timeout": 1,
"https_sni": "example.com",
"http_path": "/",
"concurrency": 10,
"https_verify_certificate": true,
"type": "http",
"healthy": {
"http_statuses": [200, 302],
"successes": 0,
"interval": 0
},
"unhealthy": {
"http_statuses": [429, 404, 500, 501, 502, 503, 504, 505],
"timeouts": 0,
"http_failures": 0,
"interval": 0,
"tcp_failures": 0
}
},
"threshold": 0
},
"tags": ["discovery-syncer-python-auto"]
}