Listener configurations
The listener configurations of MOSN.
The MOSN configuration file comprises the following four parts:
ClusterManager
configurations: This part supports configuring detailed upstream information of MOSN.Configuration file overview
The basic configurations of MOSN are shown as follows.
{
"servers": [],
"cluster_manager": {},
"dynamic_resources": {},
"static_resources": {},
"admin":{},
"pprof":{},
"tracing":{},
"metrics":{}
}
MOSN supports the following configuration modes:
In the dynamic configuration mode, MOSN starts with only configurations for accessing the control plane, but no configuration for running.
After starting in dynamic configuration mode, MOSN will request the control plane to provide configurations required for running. The control plane can also push configuration updates when MOSN is running.
To start MOSN in the dynamic configuration mode, the DynamicResources
and StaticResources
configurations are required.
MOSN can start in a hybrid mode with both static and dynamic configurations. In this mode, MOSN first completes initialization in the static configuration mode and then obtains configuration updates from the control plane.
The example of static configuration is as follows.
{
"servers": [
{
"default_log_path": "/home/admin/logs/mosn/default.log",
"default_log_level": "DEBUG",
"processor": 4,
"listeners": [
{
"address": "0.0.0.0:12220",
"bind_port": true,
"filter_chains": [
{
"filters": [
{
"type": "proxy",
"config": {
"downstream_protocol": "SofaRpc",
"upstream_protocol": "SofaRpc",
"router_config_name": "test_router"
}
},
{
"type": "connection_manager",
"config": {
"router_config_name": "test_router",
"virtual_hosts": []
}
}
]
}
]
}
]
}
],
"cluster_manager": {
"clusters": [
{
"name":"example",
"lb_type": "LB_ROUNDROBIN",
"hosts": [
{"address": "127.0.0.1:12200"}
]
}
]
}
}
The example of dynamic configuration is as follows.
{
"servers": [
{
"default_log_path": "stdout",
"default_log_level": "DEBUG"
}
],
"static_resources": {
"clusters": [
{
"connect_timeout": "1s",
"load_assignment": {
"cluster_name": "xds_cluster",
"endpoints": [
{
"lb_endpoints": [
{
"endpoint": {
"address": {
"socket_address": {
"address": "127.0.0.1",
"port_value": 9002
}
}
}
}
]
}
]
},
"http2_protocol_options": {},
"name": "xds_cluster"
}
]
},
"dynamic_resources": {
"ads_config": {
"api_type": "GRPC",
"transport_api_version": "V3",
"grpc_services": [
{
"envoy_grpc": {
"cluster_name": "xds_cluster"
}
}
],
"set_node_on_first_message_only": true
},
"cds_config": {
"resource_api_version": "V3",
"api_config_source": {
"api_type": "GRPC",
"transport_api_version": "V3",
"grpc_services": [
{
"envoy_grpc": {
"cluster_name": "xds_cluster"
}
}
],
"set_node_on_first_message_only": true
}
},
"lds_config": {
"resource_api_version": "V3",
"api_config_source": {
"api_type": "GRPC",
"transport_api_version": "V3",
"grpc_services": [
{
"envoy_grpc": {
"cluster_name": "xds_cluster"
}
}
],
"set_node_on_first_message_only": true
}
}
},
"node": {
"cluster": "test-cluster",
"id": "test-id"
},
"layered_runtime": {
"layers": [
{
"name": "runtime-0",
"rtds_layer": {
"rtds_config": {
"resource_api_version": "V3",
"api_config_source": {
"transport_api_version": "V3",
"api_type": "GRPC",
"grpc_services": {
"envoy_grpc": {
"cluster_name": "xds_cluster"
}
}
}
},
"name": "runtime-0"
}
}
]
},
"admin": {
"access_log_path": "/dev/null",
"address": {
"socket_address": {
"address": "127.0.0.1",
"port_value": 9003
}
}
}
}
The listener configurations of MOSN.
The server configurations of MOSN.
The trace configurations of MOSN.
The custom configurations of MOSN.