Просмотр исходного кода

feat(hocon): convert config format of rpc and log to hocon

zhouzb 4 лет назад
Родитель
Сommit
c7cbe819ed
1 измененных файлов с 253 добавлено и 250 удалено
  1. 253 250
      apps/emqx/etc/emqx.conf

+ 253 - 250
apps/emqx/etc/emqx.conf

@@ -316,293 +316,296 @@ node: {
     backtrace_depth: 16
 }
 
+##--------------------------------------------------------------------
+## RPC
+##--------------------------------------------------------------------
 
-## CONFIG_SECTION_BGN=rpc ======================================================
-
-## RPC Mode.
-##
-## Value: sync | async
-rpc.mode = async
-
-## Max batch size of async RPC requests.
-##
-## Value: Integer
-## Zero or negative value disables rpc batching.
-##
-## NOTE: RPC batch won't work when rpc.mode = sync
-rpc.async_batch_size = 256
-
-## RPC port discovery
-##
-## The strategy for discovering the RPC listening port of other nodes.
-##
-## Value: Enum
-## - manual: discover ports by `tcp_server_port` and `tcp_client_port`.
-## - stateless: discover ports in a stateless manner.
-##   If node name is `emqx<N>@127.0.0.1`, where the `<N>` is an integer,
-##   then the listening port will be `5370 + <N>`
-##
-## Defaults to `stateless`.
-rpc.port_discovery = stateless
+rpc: {
+  ## RPC Mode.
+  ##
+  ## Value: sync | async
+  mode: async
 
-## TCP port number for RPC server to listen on.
-##
-## Only takes effect when `rpc.port_discovery` = `manual`.
-##
-## NOTE: All nodes in the cluster should agree to this same config.
-##
-## Value: Port [1024-65535]
-#rpc.tcp_server_port = 5369
+  ## Max batch size of async RPC requests.
+  ##
+  ## Value: Integer
+  ## Zero or negative value disables rpc batching.
+  ##
+  ## NOTE: RPC batch won't work when rpc.mode = sync
+  async_batch_size: 256
 
-## Number of outgoing RPC connections.
-##
-## Value: Interger [0-256]
-## Default = 1
-#rpc.tcp_client_num = 1
+  ## RPC port discovery
+  ##
+  ## The strategy for discovering the RPC listening port of other nodes.
+  ##
+  ## Value: Enum
+  ## - manual: discover ports by `tcp_server_port` and `tcp_client_port`.
+  ## - stateless: discover ports in a stateless manner.
+  ##   If node name is `emqx<N>@127.0.0.1`, where the `<N>` is an integer,
+  ##   then the listening port will be `5370 + <N>`
+  ##
+  ## Defaults to `stateless`.
+  port_discovery: stateless
 
-## RCP Client connect timeout.
-##
-## Value: Seconds
-rpc.connect_timeout = 5s
+  ## TCP port number for RPC server to listen on.
+  ##
+  ## Only takes effect when `rpc.port_discovery` = `manual`.
+  ##
+  ## NOTE: All nodes in the cluster should agree to this same config.
+  ##
+  ## Value: Port [1024-65535]
+  ## tcp_server_port: 5369
 
-## TCP send timeout of RPC client and server.
-##
-## Value: Seconds
-rpc.send_timeout = 5s
+  ## Number of outgoing RPC connections.
+  ##
+  ## Value: Interger [0-256]
+  ## Default: 1
+  ## tcp_client_num: 1
 
-## Authentication timeout
-##
-## Value: Seconds
-rpc.authentication_timeout = 5s
+  ## RCP Client connect timeout.
+  ##
+  ## Value: Seconds
+  connect_timeout: 5s
 
-## Default receive timeout for call() functions
-##
-## Value: Seconds
-rpc.call_receive_timeout = 15s
+  ## TCP send timeout of RPC client and server.
+  ##
+  ## Value: Seconds
+  send_timeout: 5s
 
-## Socket idle keepalive.
-##
-## Value: Seconds
-rpc.socket_keepalive_idle = 900s
+  ## Authentication timeout
+  ##
+  ## Value: Seconds
+  authentication_timeout: 5s
 
-## TCP Keepalive probes interval.
-##
-## Value: Seconds
-rpc.socket_keepalive_interval = 75s
+  ## Default receive timeout for call() functions
+  ##
+  ## Value: Seconds
+  call_receive_timeout: 15s
 
-## Probes lost to close the connection
-##
-## Value: Integer
-rpc.socket_keepalive_count = 9
+  ## Socket idle keepalive.
+  ##
+  ## Value: Seconds
+  socket_keepalive_idle: 900s
 
-## Size of TCP send buffer.
-##
-## Value: Bytes
-rpc.socket_sndbuf = 1MB
+  ## TCP Keepalive probes interval.
+  ##
+  ## Value: Seconds
+  socket_keepalive_interval: 75s
 
-## Size of TCP receive buffer.
-##
-## Value: Seconds
-rpc.socket_recbuf = 1MB
+  ## Probes lost to close the connection
+  ##
+  ## Value: Integer
+  socket_keepalive_count: 9
 
-## Size of user-level software socket buffer.
-##
-## Value: Seconds
-rpc.socket_buffer = 1MB
+  ## Size of TCP send buffer.
+  ##
+  ## Value: Bytes
+  socket_sndbuf: 1MB
 
-## CONFIG_SECTION_END=rpc ======================================================
+  ## Size of TCP receive buffer.
+  ##
+  ## Value: Seconds
+  socket_recbuf: 1MB
 
-## CONFIG_SECTION_BGN=logger ===================================================
+  ## Size of user-level software socket buffer.
+  ##
+  ## Value: Seconds
+  socket_buffer: 1MB
+}
 
-## Where to emit the logs.
-## Enable the console (standard output) logs.
-##
-## Value: file | console | both
-## - file: write logs only to file
-## - console: write logs only to standard I/O
-## - both: write logs both to file and standard I/O
-log.to = file
+##--------------------------------------------------------------------
+## Log
+##--------------------------------------------------------------------
 
-## The log severity level.
-##
-## Value: debug | info | notice | warning | error | critical | alert | emergency
-##
-## Note: Only the messages with severity level higher than or equal to
-##       this level will be logged.
-##
-## Default: warning
-log.level = warning
+log: {
+  ## Where to emit the logs.
+  ## Enable the console (standard output) logs.
+  ##
+  ## Value: file | console | both
+  ## - file: write logs only to file
+  ## - console: write logs only to standard I/O
+  ## - both: write logs both to file and standard I/O
+  to: file
 
-## Timezone offset to display in logs
-## Value:
-##  - "system" use system zone
-##  - "utc" for Universal Coordinated Time (UTC)
-##  - "+hh:mm" or "-hh:mm" for a specified offset
-log.time_offset = system
+  ## The log severity level.
+  ##
+  ## Value: debug | info | notice | warning | error | critical | alert | emergency
+  ##
+  ## Note: Only the messages with severity level higher than or equal to
+  ##       this level will be logged.
+  ##
+  ## Default: warning
+  level: warning
 
-## The dir for log files.
-##
-## Value: Folder
-log.dir = "{{ platform_log_dir }}"
+  ## Timezone offset to display in logs
+  ## Value:
+  ##  - "system" use system zone
+  ##  - "utc" for Universal Coordinated Time (UTC)
+  ##  - "+hh:mm" or "-hh:mm" for a specified offset
+  time_offset: system
 
-## The log filename for logs of level specified in "log.level".
-##
-## If `log.rotation` is enabled, this is the base name of the
-## files. Each file in a rotated log is named <base_name>.N, where N is an integer.
-##
-## Value: String
-## Default: emqx.log
-log.file = emqx.log
+  ## The dir for log files.
+  ##
+  ## Value: Folder
+  dir: "{{ platform_log_dir }}"
 
-## Limits the total number of characters printed for each log event.
-##
-## Value: Integer
-## Default: No Limit
-#log.chars_limit = 8192
+  ## The log filename for logs of level specified in "log.level".
+  ##
+  ## If `log.rotation` is enabled, this is the base name of the
+  ## files. Each file in a rotated log is named <base_name>.N, where N is an integer.
+  ##
+  ## Value: String
+  ## Default: emqx.log
+  file: emqx.log
 
-## Maximum depth for Erlang term log formatting
-## and Erlang process message queue inspection.
-##
-## Value: Integer or 'unlimited' (without quotes)
-## Default: 80
-#log.max_depth = 80
+  ## Limits the total number of characters printed for each log event.
+  ##
+  ## Value: Integer
+  ## Default: No Limit
+  ## chars_limit: 8192
 
-## Log formatter
-## Value: text | json
-#log.formatter = text
+  ## Maximum depth for Erlang term log formatting
+  ## and Erlang process message queue inspection.
+  ##
+  ## Value: Integer or 'unlimited' (without quotes)
+  ## Default: 80
+  ## max_depth: 80
 
-## Log to single line
-## Value: Boolean
-#log.single_line = true
+  ## Log formatter
+  ## Value: text | json
+  ## formatter: text
 
-## Enables the log rotation.
-## With this enabled, new log files will be created when the current
-## log file is full, max to `log.rotation.size` files will be created.
-##
-## Value: on | off
-## Default: on
-log.rotation.enable = on
+  ## Log to single line
+  ## Value: Boolean
+  ## single_line: true
 
-## Maximum size of each log file.
-##
-## Value: Number
-## Default: 10M
-## Supported Unit: KB | MB | GB
-log.rotation.size = 10MB
+  ## Enables the log rotation.
+  ## With this enabled, new log files will be created when the current
+  ## log file is full, max to `rotation.size` files will be created.
+  ##
+  ## Value: on | off
+  ## Default: on
+  rotation.enable: on
 
-## Maximum rotation count of log files.
-##
-## Value: Number
-## Default: 5
-log.rotation.count = 5
+  ## Maximum size of each log file.
+  ##
+  ## Value: Number
+  ## Default: 10M
+  ## Supported Unit: KB | MB | GB
+  rotation.size: 10MB
 
-## To create additional log files for specific log levels.
-##
-## Value: File Name
-## Format: log.$level.file = $filename,
-##         where "$level" can be one of: debug, info, notice, warning,
-##                                       error, critical, alert, emergency
-## Note: Log files for a specific log level will only contain all the logs
-##       that higher than or equal to that level
-##
-#log.info.file  = info.log
-#log.error.file = error.log
+  ## Maximum rotation count of log files.
+  ##
+  ## Value: Number
+  ## Default: 5
+  rotation.count: 5
 
-## The max allowed queue length before switching to sync mode.
-##
-## Log overload protection parameter. If the message queue grows
-## larger than this value the handler switches from anync to sync mode.
-##
-## Default: 100
-##
-#log.sync_mode_qlen = 100
+  ## To create additional log files for specific log levels.
+  ##
+  ## Value: File Name
+  ## Format: log.$level.file = $filename,
+  ##         where "$level" can be one of: debug, info, notice, warning,
+  ##                                       error, critical, alert, emergency
+  ## Note: Log files for a specific log level will only contain all the logs
+  ##       that higher than or equal to that level
+  ##
+  ## info.file: info.log
+  ## error.file: error.log
 
-## The max allowed queue length before switching to drop mode.
-##
-## Log overload protection parameter. When the message queue grows
-## larger than this threshold, the handler switches to a mode in which
-## it drops all new events that senders want to log.
-##
-## Default: 3000
-##
-#log.drop_mode_qlen = 3000
+  ## The max allowed queue length before switching to sync mode.
+  ##
+  ## Log overload protection parameter. If the message queue grows
+  ## larger than this value the handler switches from anync to sync mode.
+  ##
+  ## Default: 100
+  ##
+  ## sync_mode_qlen: 100
 
-## The max allowed queue length before switching to flush mode.
-##
-## Log overload protection parameter. If the length of the message queue
-## grows larger than this threshold, a flush (delete) operation takes place.
-## To flush events, the handler discards the messages in the message queue
-## by receiving them in a loop without logging.
-##
-## Default: 8000
-##
-#log.flush_qlen = 8000
+  ## The max allowed queue length before switching to drop mode.
+  ##
+  ## Log overload protection parameter. When the message queue grows
+  ## larger than this threshold, the handler switches to a mode in which
+  ## it drops all new events that senders want to log.
+  ##
+  ## Default: 3000
+  ##
+  ## drop_mode_qlen: 3000
 
-## Kill the log handler when it gets overloaded.
-##
-## Log overload protection parameter. It is possible that a handler,
-## even if it can successfully manage peaks of high load without crashing,
-## can build up a large message queue, or use a large amount of memory.
-## We could kill the log handler in these cases and restart it after a
-## few seconds.
-##
-## Default: on
-##
-#log.overload_kill = on
+  ## The max allowed queue length before switching to flush mode.
+  ##
+  ## Log overload protection parameter. If the length of the message queue
+  ## grows larger than this threshold, a flush (delete) operation takes place.
+  ## To flush events, the handler discards the messages in the message queue
+  ## by receiving them in a loop without logging.
+  ##
+  ## Default: 8000
+  ##
+  ## flush_qlen: 8000
 
-## The max allowed queue length before killing the log hanlder.
-##
-## Log overload protection parameter. This is the maximum allowed queue
-## length. If the message queue grows larger than this, the handler
-## process is terminated.
-##
-## Default: 20000
-##
-#log.overload_kill_qlen = 20000
+  ## Kill the log handler when it gets overloaded.
+  ##
+  ## Log overload protection parameter. It is possible that a handler,
+  ## even if it can successfully manage peaks of high load without crashing,
+  ## can build up a large message queue, or use a large amount of memory.
+  ## We could kill the log handler in these cases and restart it after a
+  ## few seconds.
+  ##
+  ## Default: on
+  ##
+  ## overload_kill: on
 
-## The max allowed memory size before killing the log hanlder.
-##
-## Log overload protection parameter. This is the maximum memory size
-## that the handler process is allowed to use. If the handler grows
-## larger than this, the process is terminated.
-##
-## Default: 30MB
-##
-#log.overload_kill_mem_size = 30MB
+  ## The max allowed queue length before killing the log hanlder.
+  ##
+  ## Log overload protection parameter. This is the maximum allowed queue
+  ## length. If the message queue grows larger than this, the handler
+  ## process is terminated.
+  ##
+  ## Default: 20000
+  ##
+  ## overload_kill_qlen: 20000
 
-## Restart the log hanlder after some seconds.
-##
-## Log overload protection parameter. If the handler is terminated,
-## it restarts automatically after a delay specified in seconds.
-## The value "infinity" prevents restarts.
-##
-## Default: 5s
-##
-#log.overload_kill_restart_after = 5s
+  ## The max allowed memory size before killing the log hanlder.
+  ##
+  ## Log overload protection parameter. This is the maximum memory size
+  ## that the handler process is allowed to use. If the handler grows
+  ## larger than this, the process is terminated.
+  ##
+  ## Default: 30MB
+  ##
+  ## overload_kill_mem_size: 30MB
 
-## Max burst count and time window for burst control.
-##
-## Log overload protection parameter. Large bursts of log events - many
-## events received by the handler under a short period of time - can
-## potentially cause problems. By specifying the maximum number of events
-## to be handled within a certain time frame, the handler can avoid
-## choking the log with massive amounts of printouts.
-##
-## This config controls the maximum number of events to handle within
-## a time frame. After the limit is reached, successive events are
-## dropped until the end of the time frame.
-##
-## Note that there would be no warning if any messages were
-## dropped because of burst control.
-##
-## Comment this config out to disable the burst control feature.
-##
-## Value: MaxBurstCount,TimeWindow
-## Default: disabled
-##
-#log.burst_limit = "20000, 1s"
+  ## Restart the log hanlder after some seconds.
+  ##
+  ## Log overload protection parameter. If the handler is terminated,
+  ## it restarts automatically after a delay specified in seconds.
+  ## The value "infinity" prevents restarts.
+  ##
+  ## Default: 5s
+  ##
+  ## overload_kill_restart_after: 5s
 
-## CONFIG_SECTION_END=logger ===================================================
+  ## Max burst count and time window for burst control.
+  ##
+  ## Log overload protection parameter. Large bursts of log events - many
+  ## events received by the handler under a short period of time - can
+  ## potentially cause problems. By specifying the maximum number of events
+  ## to be handled within a certain time frame, the handler can avoid
+  ## choking the log with massive amounts of printouts.
+  ##
+  ## This config controls the maximum number of events to handle within
+  ## a time frame. After the limit is reached, successive events are
+  ## dropped until the end of the time frame.
+  ##
+  ## Note that there would be no warning if any messages were
+  ## dropped because of burst control.
+  ##
+  ## Comment this config out to disable the burst control feature.
+  ##
+  ## Value: MaxBurstCount,TimeWindow
+  ## Default: disabled
+  ##
+  ## burst_limit: "20000, 1s"
+}
 
 ##--------------------------------------------------------------------
 ## Authentication/Access Control