diff --git a/etc/emqx.conf b/etc/emqx.conf index 133dadfb0..fb82ac89b 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -317,15 +317,32 @@ rpc.mode = async ## 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@127.0.0.1`, where the `` is an integer, +## then the listening port will be `5370 + ` +## +## Defaults to `stateless`. +rpc.port_discovery = stateless + ## TCP server port for RPC. ## +## Only takes effect when `rpc.port_discovery` = `manual`. +## ## Value: Port [1024-65535] -rpc.tcp_server_port = 5369 +#rpc.tcp_server_port = 5369 ## TCP port for outgoing RPC connections. ## +## Only takes effect when `rpc.port_discovery` = `manual`. +## ## Value: Port [1024-65535] -rpc.tcp_client_port = 5369 +#rpc.tcp_client_port = 5369 ## Number of outgoing RPC connections. ## diff --git a/priv/emqx.schema b/priv/emqx.schema index f341ff16c..bbca77d9d 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -348,6 +348,11 @@ end}. {datatype, integer} ]}. +{mapping, "rpc.port_discovery", "gen_rpc.port_discovery", [ + {default, stateless}, + {datatype, {enum, [manual, stateless]}} +]}. + %% RPC server port. {mapping, "rpc.tcp_server_port", "gen_rpc.tcp_server_port", [ {default, 5369}, diff --git a/rebar.config b/rebar.config index ca2e1ff05..048a89e98 100644 --- a/rebar.config +++ b/rebar.config @@ -8,7 +8,7 @@ {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.7.1"}}}, {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.7.2"}}}, {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.7.4"}}}, - {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.4.1"}}}, + {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.0"}}}, {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}} ]}.