Config File Manual
The configuration file for BifroMQ is a YAML file located in the conf
directory under standalone.yml
. This file contains all the configuration parameters for BifroMQ. When starting BifroMQ, you can specify the path to the configuration
file with the command-line parameter -c
or --config
. If the configuration file path is not specified, BifroMQ will attempt to load the standalone.yml
file from the conf
directory.
The complete configuration file is defined by a set of configuration objects, with the top-level object being StandaloneConfig
.
StandaloneConfig
Configuration Name | Value Type | Default Value | Description |
---|---|---|---|
bootstrap | Boolean | false | If the node is responsible for cluster bootstrapping, this value should be set to true. Otherwise, it should be set to false. Note: In cluster deployments, there must be exactly one bootstrap node. |
authProviderFQN | String | null | Fully qualified class name of the custom Auth Provider implementation. If not configured, authentication and authorization will not be performed. |
resourceThrottlerFQN | String | null | Fully qualified class name of the custom Resource Throttler implementation. If not configured, resource limiting will not be performed. |
settingProviderFQN | String | null | Fully qualified class name of the custom Setting Provider implementation. If not configured, default initial values defined in Settings will be used. |
clusterConfig.env | String | "Test" | Cluster environment name. Cluster nodes with different environment names are isolated from each other. Cannot be null or an empty string. |
clusterConfig.host | String | Communication address of the node as a cluster node. If not configured, the actual value is determined by the following rules: If the value of mqttServerConfig.tcpListener.host is not "0.0.0.0", use that value; otherwise, if rpcServerConfig.host is configured, use that value; otherwise, use the SiteLocal address resolved from NetworkInterface. | |
clusterConfig.port | Integer | 0 | Communication port number of the node as a cluster node. 0 means automatically selecting an unused port number. It is recommended to configure a specific port number for nodes with the bootstrap role to simplify the configuration process. |
clusterConfig.seedEndpoints | String | null | Addresses of seed nodes to join the cluster, in the form of ip:port addresses separated by , . It is recommended that nodes other than the bootstrap role configure the bootstrap node address to simplify the configuration process. |
clusterConfig.clusterDomainName | String | null | Cluster domain name. Specifying the domain name here can further simplify the configuration process for cluster nodes when the cluster nodes are registered to a fixed domain name. BifroMQ will resolve this domain name to obtain the address of the cluster contact nodes. |
mqttServerConfig.connTimeoutSec | Integer | 20 | The tolerable timeout duration from establishing a TCP connection to completing the MQTT connection operation. If this limit is exceeded, the server will proactively disconnect. |
mqttServerConfig.maxConnPerSec | Integer | 2000 | The maximum rate of MQTT connection operations accepted per second. Connections exceeding this limit will be limited by the token bucket and subsequently disconnected. |
mqttServerConfig.maxDisconnPerSec | Integer | 1000 | The maximum rate of disconnecting connections per second when the node is gracefully shutting down. |
mqttServerConfig.maxMsgByteSize | Integer | 262144 | This parameter is an initial setting for establishing a connection and effectively limits the size of the MQTT Connect Packet. If a Connect Packet, including the Will Message, exceeds this size, the connection will be rejected. |
mqttServerConfig.maxConnBandwidth | Integer | 524288 | The maximum bandwidth allowed for a single connection, calculated separately for inbound and outbound traffic. |
mqttServerConfig.defaultKeepAliveSec | Integer | 300 | The default keep-alive duration for connections. When clients do not actively set this, this value is used. |
mqttServerConfig.bossELGThreads | Integer | 1 | The number of threads for accepting TCP connection requests. |
mqttServerConfig.workerELGThreads | Integer | max(processor cores/2, 2) | The number of worker threads for processing MQTT protocol signaling. |
mqttServerConfig.tcpListener.enable | Boolean | true | Whether to enable MQTT over TCP connection method. |
mqttServerConfig.tcpListener.host | String | "0.0.0.0" | Communication address for MQTT over TCP connection method. |
mqttServerConfig.tcpListener.port | Integer | 1883 | Communication port for MQTT over TCP connection method. |
mqttServerConfig.tlsListener.enable | Boolean | false | Whether to enable MQTT over TLS connection method. |
mqttServerConfig.tlsListener.host | String | "0.0.0.0" | Communication address for MQTT over TLS connection method. |
mqttServerConfig.tlsListener.port | Integer | 1884 | Communication port for MQTT over TLS connection method. |
mqttServerConfig.tlsListener.sslConfig | ServerSSLContextConfig | null | SSL configuration for MQTT over TLS connection method. Refer to the settings of the ServerSSLContextConfig object. |
mqttServerConfig.wsListener.enable | Boolean | true | Whether to enable MQTT over WebSocket connection method. |
mqttServerConfig.wsListener.host | String | "0.0.0.0" | Communication address for MQTT over WebSocket connection method. |
mqttServerConfig.wsListener.port | Integer | 8080 | Communication port for MQTT over WebSocket connection method. |
mqttServerConfig.wsListener.wsPath | String | "/mqtt" | Access path for MQTT over WebSocket connection method. |
mqttServerConfig.wssListener.enable | Boolean | false | Whether to enable MQTT over WebSocket Secure connection method. |
mqttServerConfig.wssListener.host | String | "0.0.0.0" | Communication address for MQTT over WebSocket Secure connection method. |
mqttServerConfig.wssListener.port | Integer | 8443 | Communication port for MQTT over WebSocket Secure connection method. |
mqttServerConfig.wssListener.wsPath | String | "/mqtt" | Access path for MQTT over WebSocket Secure connection method. |
mqttServerConfig.wssListener.sslConfig | ServerSSLContextConfig | null | SSL configuration for MQTT over WebSocket Secure connection method. Refer to the settings of the ServerSSLContextConfig object. |
rpcClientConfig.workerThreads , baseKVClientConfig.workerThreads | Integer | processor cores | The number of worker threads when communicating between nodes as a client via RPC. |
rpcClientConfig.enableSSL ,baseKVClientConfig.enableSSL | SSLContextConfig | false | Enable SSL at client side. |
rpcClientConfig.sslConfig ,baseKVClientConfig.sslConfig | SSLContextConfig | null | SSL configuration when Secure RPC is enabled. Refer to the settings of the SSLContextConfig object. |
rpcServerConfig.host ,baseKVServerConfig.host | String | See the rule description for ClusterConfig.host. | |
rpcServerConfig.port ,baseKVServerConfig.port | Integer | 0 | See the rule description for ClusterConfig.port. |
rpcServerConfig.workerThreads ,baseKVServerConfig.workerThreads | Integer | 2 | The number of worker threads when communicating between nodes as a server via RPC. |
rpcServerConfig.enableSSL ,baseKVServerConfig.enableSSL | ServerSSLContextConfig | false | Enable SSL at server side |
rpcServerConfig.sslConfig ,baseKVServerConfig.sslConfig | ServerSSLContextConfig | null | SSL configuration when Secure RPC is enabled. Refer to the settings of the ServerSSLContextConfig object. |
stateStoreConfig.queryThreads | Integer | min(available cores/2, 2) | The number of threads for the built-in state storage service to execute query type requests. |
stateStoreConfig.tickerThreads | Integer | min(available cores/20, 1) | The number of threads for the built-in state storage service to perform periodic tick operations. |
stateStoreConfig.bgWorkerThreads | Integer | min(available cores/4, 1) | The number of threads for the built-in state storage service to perform background operations. |
stateStoreConfig.distWorkerConfig.queryPipelinePerStore | Integer | 1000 | The number of queryPipelines for the Dist Worker state storage service. |
stateStoreConfig.distWorkerConfig.compactWALThreshold | Integer | 2500 | The maximum number of logs before a compaction operation is performed in the Dist Worker state storage service. |
stateStoreConfig.distWorkerConfig.dataEngineConfig | StorageEngineConfig | Data storage engine configuration for the Dist Worker state storage service. Refer to the settings of the StorageEngineConfig object. | |
stateStoreConfig.distWorkerConfig.walEngineConfig | StorageEngineConfig | WAL storage engine configuration for the Dist Worker state storage service. Refer to the settings of the StorageEngineConfig object. | |
stateStoreConfig.distWorkerConfig.balanceConfig | BalancerOptions | Balancer configuration for the Dist Worker state storage service. Refer to the settings of the BalancerOptions object. | |
inboxStoreConfig.queryPipelinePerStore | Integer | 100 | The number of queryPipelines for the Inbox Store state storage service. |
inboxStoreConfig.compactWALThreshold | Integer | 2500 | The maximum number of logs before a compaction operation is performed in the Inbox Store state storage service. |
inboxStoreConfig.gcIntervalSeconds | Integer | 600 | The interval (in seconds) for recycling expired Session data in the Inbox Store. |
inboxStoreConfig.dataEngineConfig | StorageEngineConfig | Data storage engine configuration for the Inbox Store state storage service. Refer to the settings of the StorageEngineConfig object. | |
inboxStoreConfig.walEngineConfig | StorageEngineConfig | WAL storage engine configuration for the Inbox Store state storage service. Refer to the settings of the StorageEngineConfig object. | |
inboxStoreConfig.balanceConfig | BalancerOptions | Balancer configuration for the Inbox Store state storage service. Refer to the settings of the BalancerOptions object. | |
retainStoreConfig.queryPipelinePerStore | Integer | 100 | The number of queryPipelines for the Retain Store state storage service. |
retainStoreConfig.compactWALThreshold | Integer | 2500 | The maximum number of logs before a compaction operation is performed in the Retain Store state storage service. |
retainStoreConfig.gcIntervalSeconds | Integer | 600 | The interval (in seconds) for recycling expired data in the Retain Store. |
retainStoreConfig.dataEngineConfig | StorageEngineConfig | Data storage engine configuration for the Retain Store state storage service. Refer to the settings of the StorageEngineConfig object. | |
retainStoreConfig.walEngineConfig | StorageEngineConfig | WAL storage engine configuration for the Retain Store state storage service. Refer to the settings of the StorageEngineConfig object. | |
retainStoreConfig.balanceConfig | BalancerOptions | Balancer configuration for the Retain Store state storage service. Refer to the settings of the BalancerOptions object. | |
apiServerConfig.enable | Boolean | true | Whether to enable HTTP API access. |
apiServerConfig.host | String | null | Access address for the HTTP API. If not configured, the same rule as ClusterConfig.host is used to determine the address. |
apiServerConfig.httpPort | Integer | 8091 | Access port for the HTTP API. |
apiServerConfig.apiBossThreads | Integer | 1 | The number of threads for handling HTTP API TCP connection requests. |
apiServerConfig.apiWorkerThreads | Integer | 2 | The number of worker threads for processing HTTP API requests. |
apiServerConfig.httpsListenerConfig.enable | Boolean | false | Whether to enable HTTPS API access. |
apiServerConfig.httpsListenerConfig.host | String | null | Access address for the HTTPS API. If not configured, the same rule as ClusterConfig.host is used to determine the address. |
apiServerConfig.httpsListenerConfig.port | Integer | 8090 | Access port for the HTTPS API. |
apiServerConfig.httpsListenerConfig.sslConfig | ServerSSLContextConfig | null | SSL configuration for the HTTPS API. Refer to the settings of the ServerSSLContextConfig object. |
SSLContextConfig && ServerSSLContextConfig
SSLContextConfig is used to configure the SSL connection parameters for the client, while ServerSSLContextConfig is used to configure the SSL connection parameters for the server.
If you leave SSLContextConfig or ServerSSLContextConfig set to null while the corresponding enable
flags are set to true, a self-signed certificate will be generated, which is not recommended for production environments.
Configuration Name | Value Type | Default Value | Description |
---|---|---|---|
certFile | String | null | The filename of the public certificate for the client or server. |
keyFile | String | null | The filename of the private key for the client or server. |
trustCertsFile | String | null | The filename of the root certificate for the client or server. If null, peer certification will not be verified, when clientAuth is OPTIONAL or REQUIRE. |
clientAuth | String | "OPTIONAL" | Only valid for ServerSSLContextConfig. Whether the server requires client verification. Possible values include: NONE: No verification required; OPTIONAL: Server requests client verification, but if the client does not provide a certificate, it will not fail; REQUIRE: Server requires client verification, and if the client does not provide a certificate, it will fail. |
StorageEngineConfig
StorageEngineConfig is used to set the configuration parameters for the data engine and WAL engine of the built-in state service.
Configuration Name | Value Type | Description |
---|---|---|
type | String | Specifies the type of data engine used in the built-in storage service. Options include: rocksdb: Provides persistence functionality, allowing state to be recovered after a restart; memory: No persistence, data will be lost after a restart. |
dataPathRoot | String | Effective when type is set to rocksdb. Specifies the directory to store data files. If configured as an absolute path, it will be directly loaded; if configured as a relative path, it will try to load from the directory specified by the DATA_DIR and user.dir system parameters. |
compactMinTombstoneKeys | Integer | Effective when type is set to rocksdb. The number of Tombstone keys that trigger a compaction operation. |
compactTombstonePercent | Double | Effective when type is set to rocksdb. When the number of deleted keys in a specific Range exceeds compactMinTombstoneKeys, and the proportion of deleted keys to the total exceeds compactTombstonePercent, a compaction operation will be performed on this range. |
asyncWALFlush | Boolean | Applicable only to the WAL engine, whether to enable asynchronous FlushWAL data to disk. |
fsyncWAL | Boolean | Applicable only to the WAL engine. Whether to perform an fsync operation after writing to the WAL. If this flag is true, writing speed will be slower. If this flag is false, and the machine crashes, some recent writes may be lost. |
BalancerOptions
BalancerOptions is used to set the configuration parameters for the Balancer of the built-in state service.
Configuration Name | Value Type | Default Value | Description |
---|---|---|---|
scheduleIntervalInMs | Long | 5000 | The interval at which the Balancer attempts to balance the load. |
balancers | List of String | The fully qualified names of the balancer implementations that are enabled. Different balancer implementations can be set for different built-in storage services. |
Note: Adjusting the parameters related to StorageEngineConfig and BalancerOptions requires an in-depth understanding of the storage engine implementation of BifroMQ. Improper configuration may lead to abnormal behavior of the state storage service.