From b3adcc8971a0a00bc47b73a3174cb041bc24c1c3 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Wed, 18 Jul 2018 14:24:35 +0800 Subject: [PATCH] Add RPC Args --- etc/emqx.conf | 38 +++++++++++++++++++++++++++ priv/emqx.schema | 67 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/etc/emqx.conf b/etc/emqx.conf index cf264a505..5aa4bf3ea 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -137,6 +137,11 @@ cluster.autoclean = 5m ## Value: String ## cluster.k8s.app_name = emq +## Kubernates Namespace +## +## Value: String +## cluster.k8s.namespace = default + ##-------------------------------------------------------------------- ## Node Args ##-------------------------------------------------------------------- @@ -270,6 +275,39 @@ node.dist_net_ticktime = 60 node.dist_listen_min = 6369 node.dist_listen_max = 6369 +##-------------------------------------------------------------------- +## RPC Args +##-------------------------------------------------------------------- + +## TCP server port. +rpc.tcp_server_port = 5369 + +## Default TCP port for outgoing connections +rpc.tcp_client_port = 5369 + +## Client connect timeout +rpc.connect_timeout = 5000 + +## Client and Server send timeout +rpc.send_timeout = 5000 + +## Authentication timeout +rpc.authentication_timeout = 5000 + +## Default receive timeout for call() functions +rpc.call_receive_timeout = 15000 + +## Socket keepalive configuration +rpc.socket_keepalive_idle = 900 + +## Seconds between probes +rpc.socket_keepalive_interval = 75 + +## Probes lost to close the connection +rpc.socket_keepalive_count = 9 + +## TODO: sndbuf, rcvbuf and buffer + ##-------------------------------------------------------------------- ## Log ##-------------------------------------------------------------------- diff --git a/priv/emqx.schema b/priv/emqx.schema index 8aeeb0ebf..b4187397a 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -124,6 +124,10 @@ {datatype, string} ]}. +{mapping, "cluster.k8s.namespace", "ekka.cluster_discovery", [ + {datatype, string} +]}. + {translation, "ekka.cluster_discovery", fun(Conf) -> Strategy = cuttlefish:conf_get("cluster.discovery", Conf), Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end, @@ -152,7 +156,8 @@ [{apiserver, cuttlefish:conf_get("cluster.k8s.apiserver", Conf)}, {service_name, cuttlefish:conf_get("cluster.k8s.service_name", Conf)}, {address_type, cuttlefish:conf_get("cluster.k8s.address_type", Conf, ip)}, - {app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)}]; + {app_name, cuttlefish:conf_get("cluster.k8s.app_name", Conf)}, + {namespace, cuttlefish:conf_get("cluster.k8s.namespace", Conf)}]; (manual) -> [ ] end, @@ -170,7 +175,7 @@ end}. %% @doc The erlang distributed protocol {mapping, "node.proto_dist", "vm_args.-proto_dist", [ - {default, "inet_tcp"}, + %{default, "inet_tcp"}, {datatype, {enum, [inet_tcp, inet6_tcp, inet_tls]}}, hidden ]}. @@ -315,6 +320,64 @@ end}. hidden ]}. +%%-------------------------------------------------------------------- +%% RPC Args +%%-------------------------------------------------------------------- + +%% RPC server port. +{mapping, "rpc.tcp_server_port", "gen_rpc.tcp_server_port", [ + {default, 5369}, + {datatype, integer} +]}. + +%% Default TCP port for outgoing connections +{mapping, "rpc.tcp_client_port", "gen_rpc.tcp_client_port", [ + {default, 5369}, + {datatype, integer} +]}. + +%% Client connect timeout +{mapping, "rpc.connect_timeout", "gen_rpc.connect_timeout", [ + {default, 5000}, + {datatype, integer} +]}. + +%% Client and Server send timeout +{mapping, "rpc.send_timeout", "gen_rpc.send_timeout", [ + {default, 5000}, + {datatype, integer} +]}. + +%% Authentication timeout +{mapping, "rpc.authentication_timeout", "gen_rpc.authentication_timeout", [ + {default, 5000}, + {datatype, integer} +]}. + +%% Default receive timeout for call() functions +{mapping, "rpc.call_receive_timeout", "gen_rpc.call_receive_timeout", [ + {default, 15000}, + {datatype, integer} +]}. + +%% Socket keepalive configuration +{mapping, "rpc.socket_keepalive_idle", "gen_rpc.socket_keepalive_idle", [ + {default, 7200}, + {datatype, integer} +]}. + +%% Seconds between probes +{mapping, "rpc.socket_keepalive_interval", "gen_rpc.socket_keepalive_interval", [ + {default, 75}, + {datatype, integer} +]}. + +%% Probes lost to close the connection +{mapping, "rpc.socket_keepalive_count", "gen_rpc.socket_keepalive_count", [ + {default, 9}, + {datatype, integer} +]}. + %%-------------------------------------------------------------------- %% Log %%--------------------------------------------------------------------