Przeglądaj źródła

chore(config): do not expose manual rpc peer port config

when using `manual`, all nodes in the cluster should agree
to the same port number, so there is no need to make peer
port number for clients.
Zaiming Shi 4 lat temu
rodzic
commit
7afd4940e7
2 zmienionych plików z 15 dodań i 18 usunięć
  1. 6 11
      etc/emqx.conf
  2. 9 7
      priv/emqx.schema

+ 6 - 11
etc/emqx.conf

@@ -331,25 +331,20 @@ rpc.async_batch_size = 256
 ## Defaults to `stateless`.
 ## Defaults to `stateless`.
 rpc.port_discovery = stateless
 rpc.port_discovery = stateless
 
 
-## TCP server port for RPC.
+## TCP port number for RPC server to listen on.
 ##
 ##
 ## Only takes effect when `rpc.port_discovery` = `manual`.
 ## Only takes effect when `rpc.port_discovery` = `manual`.
 ##
 ##
-## Value: Port [1024-65535]
-#rpc.tcp_server_port = 5369
-
-## TCP port for outgoing RPC connections.
-##
-## Only takes effect when `rpc.port_discovery` = `manual`.
+## NOTE: All nodes in the cluster should agree to this same config.
 ##
 ##
 ## Value: Port [1024-65535]
 ## Value: Port [1024-65535]
-#rpc.tcp_client_port = 5369
+#rpc.tcp_server_port = 5369
 
 
 ## Number of outgoing RPC connections.
 ## Number of outgoing RPC connections.
 ##
 ##
-## Value: Interger [1-256]
-## Defaults to NumberOfCPUSchedulers / 2
-#rpc.tcp_client_num = 1
+## Value: Interger [0-256]
+## Defaults to NumberOfCPUSchedulers / 2 when set to 0
+#rpc.tcp_client_num = 0
 
 
 ## RCP Client connect timeout.
 ## RCP Client connect timeout.
 ##
 ##

+ 9 - 7
priv/emqx.schema

@@ -367,13 +367,7 @@ end}.
   {datatype, integer}
   {datatype, integer}
 ]}.
 ]}.
 
 
-%% Default TCP port for outgoing connections
-{mapping, "rpc.tcp_client_port", "gen_rpc.tcp_client_port", [
-  {default, 5369},
-  {datatype, integer}
-]}.
-
-%% Default TCP port for outgoing connections
+%% Number of tcp connections when connecting to RPC server
 {mapping, "rpc.tcp_client_num", "gen_rpc.tcp_client_num", [
 {mapping, "rpc.tcp_client_num", "gen_rpc.tcp_client_num", [
   {default, 0},
   {default, 0},
   {datatype, integer},
   {datatype, integer},
@@ -451,6 +445,14 @@ end}.
   fun(X) -> X >= 0 andalso X < 256 end
   fun(X) -> X >= 0 andalso X < 256 end
 }.
 }.
 
 
+%% Force client to use server listening port, because we do no provide
+%% per-node listening port manual mapping from configs.
+%% i.e. all nodes in the cluster should agree to the same
+%% listening port number.
+{translation, "gen_rpc.tcp_client_port", fun(_, _, Conf) ->
+    cuttlefish:conf_get("rpc.tcp_server_port", Conf)
+end}.
+
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
 %% Log
 %% Log
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------