zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Envoy 启动相关参数整理

启动 参数 相关 整理 Envoy
2023-06-13 09:15:23 时间

本篇属于Envoy代码的阅读笔记,整理了envoy启动所使用到的参数信息,代码实现在类 OptionsImpl 中,使用了TCLAP来进行参数的行解析处理。

// 文件路径如下所示:
"source/server/options_impl.h"
"source/server/options_impl.cc"

实现逻辑在下面的构造函数中:

OptionsImpl::OptionsImpl(std::vector<std::string> args,
                         const HotRestartVersionCb& hot_restart_version_cb,
                         spdlog::level::level_enum default_log_level) {
                         ......
                         // 参数会先设置一个默认值,如果envoy的启动参数里面设置了对应的参数,会替换掉这些默认数据
                         }

TCLAP的相关知识可以参考:C++ 命令行解析库TCLAP

参数列表:

序号

参数名称

参数描述

类型

默认值

1

base-id

"base ID so that multiple envoys can run on the same host if needed"

uint32_t

0

2

use-dynamic-base-id

"the server chooses a base ID dynamically. Supersedes a static base ID. May not be used when the restart epoch is non-zero."

bool

false

3

base-id-path

"path to which the base ID is written"

string

""

4

concurrency

"# of worker threads to run"

uint32_t

std::thread::hardware_concurrency()

5

config-path

"Path to configuration file"

string

""

6

config-yaml

"Inline YAML configuration, merges with the contents of --config-path"

string

""

7

bootstrap-version

"API version to parse the bootstrap config as (e.g. 3). If ""unset, all known versions will be attempted"

uint32_t

0

8

allow-unknown-fields

"allow unknown fields in static configuration (DEPRECATED)"

bool

false

9

allow-unknown-static-fields

"allow unknown fields in static configuration"

bool

false

10

reject-unknown-dynamic-fields

bool

false

11

ignore-unknown-dynamic-fields

"ignore unknown fields in dynamic configuration"

bool

false

12

admin-address-path

"Admin address path"

string

""

13

local-address-ip-version

The local IP address version (v4 or v6)."

string

"v4"

14

log-level

log_levels_string

string

spdlog::level::level_string_views[default_log_level].data()

15

component-log-level

component_log_level_string

string

""

16

log-format

log_format_string

string

Logger::Logger::DEFAULT_LOG_FORMAT

17

log-format-escaped

"Escape c-style escape sequences in the application logs"

bool

false

18

enable-fine-grain-logging

"Logger mode: enable file level log control(Fancy Logger)or not"

bool

false

19

log-path

"Path to logfile"

string

""

20

restart-epoch

"hot restart epoch #"

uint32_t

0

21

hot-restart-version

"hot restart compatibility version"

bool

false

22

service-cluster

"Cluster name"

string

""

23

service-node

"Node name"

string

""

24

service-zone

"Zone name"

string

""

25

file-flush-interval-msec

"Interval for log flushing in msec"

uint32_t

10000ms

26

drain-time-s

"Hot restart and LDS removal drain time in seconds"

uint32_t

600ms

27

drain-strategy

"Hot restart drain sequence behaviour, one of 'gradual' (default) or 'immediate'."

string

"gradual"

28

parent-shutdown-time-s

"Hot restart parent shutdown time in seconds"

uint32_t

900ms

29

mode

"One of 'serve' (default; validate configs and then serve ""traffic normally) or 'validate' (validate configs and exit)."

string

"serve"

30

disable-hot-restart

"Disable hot restart functionality"

bool

false

31

enable-mutex-tracing

"Enable mutex contention tracing functionality"

bool

false

32

cpuset-threads

"Get the default # of worker threads from cpuset size"

bool

false

33

disable-extensions

"Comma-separated list of extensions to disable"

string

""

34

socket-path

"Path to hot restart socket file"

string

"@envoy_domain_socket"

35

socket-mode

"Socket file permission"

string

"600"

36

enable-core-dump

"Enable core dumps"

bool

false

参考:istio-proxy 1.11.2版本的envoy 代码