chore: make remsh node name away from the atom table overflow
This commit is contained in:
parent
55aa282d34
commit
61517f8280
2
bin/emqx
2
bin/emqx
|
@ -319,7 +319,7 @@ relx_rem_sh() {
|
||||||
|
|
||||||
# Generate a random id
|
# Generate a random id
|
||||||
relx_gen_id() {
|
relx_gen_id() {
|
||||||
od -t x -N 4 /dev/urandom | head -n1 | awk '{print $2}'
|
od -t u -N 4 /dev/urandom | head -n1 | awk '{print $2 % 1000}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Control a node
|
# Control a node
|
||||||
|
|
|
@ -202,7 +202,12 @@ nodename(Name) ->
|
||||||
|
|
||||||
this_node_name(Name) ->
|
this_node_name(Name) ->
|
||||||
[Node, Host] = re:split(Name, "@", [{return, list}, unicode]),
|
[Node, Host] = re:split(Name, "@", [{return, list}, unicode]),
|
||||||
list_to_atom(lists:concat(["remsh_maint_", Node, os:getpid(), "@", Host])).
|
list_to_atom(lists:concat(["remsh_maint_", Node, node_name_suffix_id(), "@", Host])).
|
||||||
|
|
||||||
|
%% use the reversed value that from pid mod 1000 as the node name suffix
|
||||||
|
node_name_suffix_id() ->
|
||||||
|
Pid = os:getpid(),
|
||||||
|
string:slice(string:reverse(Pid), 0, 3).
|
||||||
|
|
||||||
%% For windows???
|
%% For windows???
|
||||||
create_mnesia_dir(DataDir, NodeName) ->
|
create_mnesia_dir(DataDir, NodeName) ->
|
||||||
|
|
Loading…
Reference in New Issue