# å½ä»¤è¡é项
Envoy ç± JSON é
ç½®æ件åä¸ç»å½ä»¤è¡é项ä¸èµ·é©±å¨ã以ä¸æ¯ Envoy æ¯æçå½ä»¤è¡é项ã
- `-c , --config-path `
*(å¯é)* v1 æ v2 [JSON/YAML/proto3 é
ç½®æ件](../configuration/configuration.md#config)çè·¯å¾ã è¥æªè®¾ç½®æ¤é项ï¼éè¦æå® [`--config-yaml`](#cmdoption-config-yaml) é项ãå®ä¼é¦å
ä½ä¸º [v2 å¼å¯¼é
ç½®æ件](../configuration/overview/v2_overview.md#config-overview-v2-bootstrap)è¿è¡è§£æï¼è¥è§£æ失败ï¼ä¼æ ¹æ® [`--v2-config-only`] é项å³å®æ¯å¦ä½ä¸º [v1 JSON é
ç½®æ件](../configuration/overview/v1_overview.md#config-overview-v1)è¿è¡è§£æãå¯¹äº v2 çé
ç½®æ件ï¼ææçæ©å±åå
æ¬ `.json`ã `.yaml`ã `.pb` å `.pb_text`ï¼åå«è¡¨ç¤ºJSONãYAMLã[äºè¿å¶ proto3](https://developers.google.com/protocol-buffers/docs/encoding) å [ææ¬ proto3](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.text_format) æ ¼å¼ã
- `--config-yaml `
*(å¯é)* ä¸ä¸ª YAML å符串ï¼ä½ä¸º v2 å¼å¯¼é
ç½®ãè¥åæ¶è®¾ç½®äº [`--config-path`](#cmdoption-c)ï¼æ¤ YAML å符串çå¼ä¼è¢«åå¹¶å° [`--config-path`](#cmdoption-c) æå®çå¼å¯¼é
置并è¦çç¸åºé项ãç±äº YAML æ¯ JSON çè¶
éï¼ä¹å¯ä»¥ç» [`--config-yaml`](#cmdoption-config-yaml) ä¼ å
¥ä¸ä¸ª JSON å符串ã [`--config-yaml`](#cmdoption-config-yaml) ä¸ v1 å¼å¯¼é
ç½®ä¸å
¼å®¹ã
ä¸ä¸ªéè¿å½ä»¤è¡è¦çèç¹ id çä¾åï¼
`./envoy -c bootstrap.yaml âconfig-yaml "node: {id: 'node1'}"`
- `--v2-config-only`
*(å¯é)* æ¤æ è¯å³å®é
ç½®æ件æ¯å¦åºè¯¥åªè¢«è§£æ为 [v2 å¼å¯¼é
ç½®æ件](../configuration/overview/v2_overview.md#config-overview-v2-bootstrap)ãè¥ä¼ å
¥ falseï¼é»è®¤é项ï¼ï¼v2 å¼å¯¼é
置解æ失败æ¶ï¼ä¼å次å°è¯å°å
¶è§£æ为 [v1 JSON é
ç½®æ件](../configuration/overview/v1_overview.md#config-overview-v1)ã
- `--mode `
*(å¯é)* Envoy çæ§è¡æ¨¡å¼ä¹ä¸ï¼
* `serve`: *ï¼é»è®¤é项ï¼* æ ¡éª JSON é
ç½®ï¼ç¶åæ£å¸¸æä¾æå¡ã
* `validate`ï¼æ ¡éª JSON é
ç½®ï¼ç¶åéåºãä¼æå°ä¸æ¡ âOKâ æ¶æ¯ï¼è¥éåºç 为 0ï¼æææé
ç½®æ件产ççé误ï¼è¥éåºç 为 1ï¼ãä¸ä¼äº§çç½ç»æµéï¼çéå¯æµç¨ä¹ä¸ä¼æ§è¡ï¼æ以ä¸ä¼å½±åå°æºå¨ä¸å
¶ä»ç Envoy è¿ç¨ã
- `--admin-address-path `
*(å¯é)* è¾åºç®¡çå°åå端å£çæ件路å¾ã
- `--local-address-ip-version `
*(å¯é)* å¡«å
æå¡å¨æ¬å° IP å°å使ç¨ç IP å°åçæ¬ãæ¤åæ°å½±ååç§å¤´é¨ä¿¡æ¯ï¼å
æ¬éå å° X-Forwarded-Forï¼XFFï¼å¤´é¨çå
容ãéé¡¹æ¯ `v4` æ `v6`ãé»è®¤æ¯ `v4`ã
- `--base-id `
*(å¯é)* åé
å
±äº«å
ååºåæ¶ä½¿ç¨çåºæ¬ IDãEnvoy å¨[çéå¯](../intro/arch_overview/hot_restart.md#arch-overview-hot-restart)æ¶ä½¿ç¨å
±äº«å
ååºåã大é¨åç¨æ·æ°¸è¿é½ä¸éè¦è®¾ç½®è¿ä¸ªé项ãä¸è¿ï¼è¥éè¦å¨åä¸å°æºå¨ä¸å¤æ¬¡è¿è¡ Envoyï¼æ¯ä¸ªè¿è¡ç Envoy éè¦ä¸ä¸ªå¯ä¸çåºæ¬ IDï¼ä»¥å
å
±äº«å
ååºå产çå²çªã
- `--concurrency `
*(å¯é)* å¯å¨ç [å·¥ä½çº¿ç¨æ°](../intro/arch_overview/threading_model.md#arch-overview-threading)ãè¥æªæå®åé»è®¤ä½¿ç¨æºå¨ä¸ç硬件线ç¨æ°ã
- `-l , --log-level `
*(å¯é)* æ¥å¿çº§å«ãéå¼åè
é常ä¸åºè¯¥è®¾ç½®è¿ä¸ªé项ãæå
³å¯ç¨çæ¥å¿çº§å«åé»è®¤å¼ï¼è¯·åé
帮å©ææ¬ã
- `--log-path `
*(å¯é)* è¾åºæ¥å¿çæ件路å¾ãå¤ç SIGUSR1 æ¶ï¼è¯¥æ件å°è¢«éæ°æå¼ãè¥æªè®¾ç½®ï¼è¾åºå° stderrã
- `--log-format `
*(å¯é)* ç¨äºæ ¼å¼åæ¥å¿æ¶æ¯å
æ°æ®çæ ¼å¼å符串ãè¥æªè®¾ç½®ï¼ä¼ä½¿ç¨ä¸ä¸ªé»è®¤çæ ¼å¼å符串 â[%Y-%m-%d %T.%e][%t][%l][%n] %v"ã
æ¯æçæ ¼å¼åæ è®°æï¼å
æ¬ç¤ºä¾è¾åºï¼ï¼
| åæ° | 解é |
|---- | ---- |
| %v: | è¦è®°å½çå®é
æ¶æ¯ (âsome user textâ) |
|%t: | çº¿ç¨ id (â1232â)|
|%P: | è¿ç¨ id (â3456â)|
|%n: | è®°å½å¨å称 (âfilterâ)|
|%l: | æ¶æ¯çæ¥å¿çº§å« ï¼âdebugâã âinfoâï¼ |
|%L: | æ¶æ¯çæ¥å¿çº§å«ç¼©å (âDâã âIâç) |
|%a: | ææç缩ååç° (âTueâ)|
|%A: | ææçå®æ´å称 (âTuesdayâ)|
|%b: | æ份ç缩ååç° (âMarâ)|
|%B: | æ份çå®æ´å称 (âMarchâ)|
|%c: | æ¥æåæ¶é´çåç° (âTue Mar 27 15:25:06 2018â)|
|%C: | 年份ç 2 ä½åç° (â18â)|
|%Y: | 年份ç 4 ä½åç° (â2018â)|
|%D, %x: | æ¥æ MM/DD/YY æ ¼å¼ç缩ååç° (â03/27/18â)|
|%m: | æ份 01-12 (â03â)|
|%d: | æä¸çæ¥æ 01-31 (â27â)|
|%H: | 24 å°æ¶å¶çå°æ¶ 00-23 (â15â)|
|%I: | 12 å°æ¶å¶çå°æ¶ 01-12 (â03â)|
|%M: | åé 00-59 (â25â)|
|%S: | ç§æ° 00-59 (â06â)|
|%e: | å½åç§ä¸ç毫ç§é¨å 000-999 (â008â)|
|%f: | å½åç§ä¸çå¾®ç§é¨å 000000-999999 (â008789â)|
|%F: | å½åç§ä¸ç纳ç§é¨å 000000000-999999999 (â008789123â)|
|%p: | ä¸å/ä¸å AM/PM (âAMâ)|
|%r: | 12 å°æ¶å¶çé表åç° (â03:25:06 PMâ)|
|%R: | 24 å°æ¶å¶ HH:MM æ ¼å¼çæ¶é´, çåäº %H:%M (â15:25â)|
|%T, %X: | ISO 8601 æ¶é´æ ¼å¼ (HH:MM:SS)ï¼çåäº %H:%M:%S (â13:25:06â) |
|%z: | ISO 8601 ä¸ UTC çæ¶åºå移 ([+/-]HH:MM) (â-07:00â)|
|%%: | % ç¬¦å· (â%â)|
- `--restart-epoch `
*(å¯é)* [çéå¯](../intro/arch_overview/hot_restart.md#arch-overview-hot-restart)å¨æï¼Envoy 被çéå¯èä¸æ¯å
¨æ°å¯å¨ç次æ°ï¼ã对äºç¬¬ä¸æ¬¡å¯å¨é»è®¤ä¸º 0ãæ¤é项åè¯ Envoy æ¯å°è¯å建ï¼è¿æ¯æå¼ä¸ä¸ªå·²åå¨ççéå¯æéçå
±äº«å
ååºåãæ¯æ¬¡çéå¯åå®é½åºè¯¥è¢«å¢å ãå¤æ°æ
åµä¸[çéå¯å
è£
å¨](hot_restarter.md#operations-hot-restarter)设置ç *RESTART_EPOCH* ç¯å¢åéåºè¯¥è¢«ä¼ éç»è¿ä¸ªé项ã
- `--hot-restart-version`
*(å¯é)* 为å½åçäºè¿å¶æ件è¾åºä¸ä¸ªçéå¯å
¼å®¹æ§çæ¬ãå¯ä»¥å°å
¶ä¸ [`GET /hot_restart_version`](admin.md#get--hot_restart_version) 管çæ¥å£çè¾åºè¿è¡æ¯è¾ï¼ä»¥ç¡®å®æ°çäºè¿å¶æ件åæ£å¨è¿è¡çäºè¿å¶æ件æ¯å¦çéå¯å
¼å®¹ã
- `--service-cluster `
*(å¯é)* å®ä¹ Envoy è¿è¡çæ¬å°æå¡é群å称ãæ¬å°æå¡é群å称é¦å
æ¥èª[å¼å¯¼èç¹](https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/bootstrap/v2/bootstrap.proto#envoy-api-field-config-bootstrap-v2-bootstrap-node)æ¶æ¯ç[cluster](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/core/base.proto#envoy-api-field-core-node-cluster)å段ãæ¤å½ä»¤è¡é项为æå®æ¤å¼æä¾äºå¦ä¸ç§æ¹æ³ï¼å¹¶å°è¦çå¼å¯¼é
ç½®ä¸è®¾ç½®çä»»ä½å¼ãè¥ä½¿ç¨äºä»¥ä¸ä»»ä½åè½ï¼ååºè¯¥éè¿æ¤å½ä»¤è¡é项æå¼å¯¼é
ç½®æ¥è®¾ç½®å®ï¼[statsd](../intro/arch_overview/statistics.md#arch-overview-statistics)ã[å¥åº·æ£æ¥é群éªè¯](https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/cluster_hc#config-cluster-manager-cluster-hc-service-name)ã[è¿è¡æ¶è¦çç®å½](https://www.envoyproxy.io/docs/envoy/latest/api-v1/runtime#config-runtime-override-subdirectory)ã[User Agent æ·»å ](https://www.envoyproxy.io/docs/envoy/latest/api-v1/network_filters/http_conn_man#config-http-conn-man-add-user-agent)ã [HTTP å
¨å±éçéå¶](../configuration/http_filters/rate_limit_filter.md#config-http-filters-rate-limit)ã[CDS](../configuration/cluster_manager/cds.md#config-cluster-manager-cds) å [HTTP è·è¸ª](../intro/arch_overview/tracing.md#arch-overview-tracing)ã
- `--service-node `
*(å¯é)* å®ä¹ Envoy è¿è¡çæ¬å°æå¡èç¹å称ãæ¬å°æå¡èç¹å称é¦å
æ¥èª[å¼å¯¼èç¹](https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/bootstrap/v2/bootstrap.proto#envoy-api-field-config-bootstrap-v2-bootstrap-node)æ¶æ¯ç id å段ãæ¤å½ä»¤è¡é项为æå®æ¤å¼æä¾äºå¦ä¸ç§æ¹æ³ï¼å¹¶å°è¦çå¼å¯¼é
ç½®ä¸è®¾ç½®çä»»ä½å¼ãè¥ä½¿ç¨äºä»¥ä¸ä»»ä½åè½ï¼ååºè¯¥éè¿æ¤å½ä»¤è¡é项æå¼å¯¼é
ç½®æ¥è®¾ç½®å®ï¼[statsd](../intro/arch_overview/statistics.md#arch-overview-statistics)ã[CDS](../configuration/cluster_manager/cds.md#config-cluster-manager-cds) å [HTTP è·è¸ª](../intro/arch_overview/tracing.md#arch-overview-tracing)ã
- `--service-zone `
*(å¯é)* å®ä¹ Envoy è¿è¡çæ¬å°æå¡åºåå称ãæ¬å°æå¡åºåå称é¦å
æ¥èª[å¼å¯¼èç¹](https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/bootstrap/v2/bootstrap.proto#envoy-api-field-config-bootstrap-v2-bootstrap-node)æ¶æ¯ç [locality.zone](https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/core/base.proto#envoy-api-field-core-locality-zone) å段ãæ¤å½ä»¤è¡é项为æå®æ¤å¼æä¾äºå¦ä¸ç§æ¹æ³ï¼å¹¶å°è¦çå¼å¯¼é
ç½®ä¸è®¾ç½®çä»»ä½å¼ãè¥ä½¿ç¨äºåç°æå¡è·¯ç±ä¸åç°æå¡æ´é²åº[åºåæ°æ®](https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/sds#config-cluster-manager-sds-api-host-az)ï¼ååºè¯¥éè¿æ¤å½ä»¤è¡é项æå¼å¯¼é
ç½®æ¥è®¾ç½®å®ãåºåçå«ä¹æ¯ä¾èµäºä¸ä¸æçï¼å¦ AWS ä¸ç[å¯ç¨æ§åºåï¼AZ ï¼](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html)ï¼GCP ä¸ç[åºå](https://cloud.google.com/compute/docs/regions-zones/)ï¼ççã
- `--file-flush-interval-msec `
*(å¯é)* æ件ç¼å²åºå·æ°é´éï¼æ¯«ç§ï¼ãé»è®¤ä¸º 10 ç§ãæ¤è®¾ç½®å¨æ件å建æé´ç¨äºç¡®å®ç¼å²åºå·æ°å°æ件çé´éæ¶é´ãç¼å²åºå¨æ¯æ¬¡å满æ¶ææ¯æ¬¡é´éè¿åé½ä¼å·æ°ï¼ä»¥å
å°è
为åãè°æ´æ¤è®¾ç½®å¨è·è¸ªè¾åº[访é®æ¥å¿](../intro/arch_overview/access_logging.md#arch-overview-access-logs)æ¶å¾æç¨ï¼å¯ä»¥è·å¾æ´å¤ï¼ææ´å°ï¼çå³æ¶å·æ°ã
- `--drain-time-s `
*(å¯é)* çéå¯æé´ Envoy å°èå°½è¿æ¥çæ¶é´ï¼ç§ï¼ã请åé
[çéå¯æ¦è¿°](../intro/arch_overview/hot_restart.md#arch-overview-hot-restart)äºè§£æ´å¤ä¿¡æ¯ãé»è®¤ä¸º 600 ç§ï¼10 åéï¼ãé常èå°½æ¶é´åºå°äºéè¿ [`--parent-shutdown-time-s`](#cmdoption-parent-shutdown-time-s) é项设置çç¶è¿ç¨å
³éæ¶é´ãå¦ä½é
ç½®è¿ä¸¤ä¸ªè®¾ç½®åå³äºå
·ä½çé¨ç½²ãå¨è¾¹ç¼çåºæ¯ä¸ï¼å¯è½éè¦èè´¹å¾é¿æ¶é´ãå¨æå¡å°æå¡çåºæ¯ä¸ï¼èå°½åå
³éçæ¶é´å¯è½ç¼©çå¾å¤ï¼ä¾å¦ï¼60s/90sï¼ã
- `--parent-shutdown-time-s `
*(å¯é)* Envoy å¨çéå¯æ¶å
³éç¶è¿ç¨ä¹åçå¾
çæ¶é´ï¼ç§ï¼ã请åé
[çéå¯æ¦è¿°](../intro/arch_overview/hot_restart.md#arch-overview-hot-restart)äºè§£æ´å¤ä¿¡æ¯ãé»è®¤ä¸º 900 ç§ï¼15 åéï¼ã
- `--max-obj-name-len `
*(å¯é)* cluster/route_config/listener ä¸å称å段çæ大é¿åº¦ï¼ä»¥åè为åä½ï¼ãæ¤é项é常ç¨äºèªå¨çæé群å称çåºæ¯ï¼é常è¶
è¿ä¼ 60 å符çå
é¨éå¶ãé»è®¤ä¸º 60ã
> *注æï¼æ¤è®¾ç½®ä¼å½±å [`--hot-restart-version`](#cmdoption-hot-restart-version) çè¾åºãè¥æ¨å¼å§ä½¿ç¨æ¤é项并设置为éé»è®¤å¼ï¼ååºè¯¥ä½¿ç¨ç¸åçå¼é
ç½®å°çéå¯çæ°è¿ç¨ã*
- `--max-stats `
*(å¯é)* çéå¯é´å¯ä»¥å
±äº«ç»è®¡çæ大æ°éãæ¤è®¾ç½®ä¼å½±å [`--hot-restart-version`](#cmdoption-hot-restart-version) çè¾åºï¼çéå¯å¿
须使ç¨ç¸åçå¼ãé»è®¤ä¸º 16384ã
- `--disable-hot-restart`
*(å¯é)* æ¤æ è¯ç¦ç¨å·²å¯ç¨çéå¯ç Envoy çæ¬ççéå¯ã é»è®¤æ
åµä¸ï¼çéå¯æ¯å¯ç¨çã