First. Erlang nodes failed to connect and Erlang - Nodes don't recognize are useless.
I have tried all the ways.
It is ok for the same machine. But it failed between machines.
test@centos-1:~$ ping apple@centos-1 -c 1
PING apple@centos-1 (192.168.142.135) 56(84) bytes of data.
64 bytes from apple@centos-1 (192.168.142.135): icmp_seq=1 ttl=64 time=0.036 ms
test@centos-1:~$ ping pear@centos-2 -c 1
PING pear@centos-2 (192.168.142.136) 56(84) bytes of data.
64 bytes from pear@centos-2 (192.168.142.136): icmp_seq=1 ttl=64 time=0.292 ms
apple@centos-1 starts
@centos-1:~$ erl -sname apple@centos_1 -kernel inet_dist_listen_min 6369 inet_dist_listen_max 7369 -setcookie CKYBWKWCWNLSPZWSLJXT
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Eshell V12.2 (abort with ^G)
(apple@centos_1)1>
pear@centos-2 starts
test@centos-2:~$ erl -sname pear@centos-2 -kernel inet_dist_listen_min 6369 inet_dist_listen_max 7369 -setcookie CKYBWKWCWNLSPZWSLJXT
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Eshell V12.2 (abort with ^G)
(pear@centos-2)1>
connection failed
test@centos-1:~$ erl -sname apple@centos_1 -kernel inet_dist_listen_min 6369 inet_dist_listen_max 7369 -setcookie CKYBWKWCWNLSPZWSLJXT
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Eshell V12.2 (abort with ^G)
(apple@centos_1)1> net
net net_adm net_kernel
(apple@centos_1)1> net_kernel:connect_node('pear@centos-2').
false
(apple@centos_1)2>
I have checked all the situations I have found
The hosts file
192.168.142.135 apple@centos-1
192.168.142.136 pear@centos-2
cookie
They have the same cookie.
firewall
firewall-cmd --add-port=6000-8000/tcp --permanent
tcpdump
There are not any package.
1条答案
按热度按时间zxlwwiss1#
Linux is not responsible for service names, so this ping should fail:
test@centos-1:~$ ping apple@centos-1 -c 1
This linux ping should succeed:
test@centos-1:~$ ping centos-1 -c 1
Erlang examples are often using functions called ping/pong that would use epmd and use @ synax.
This looks good if domains are setup correctly (though note '-' and '_' are not the same):
@centos-1:~$ erl -sname apple@centos-1 -kernel inet_dist_listen_min 6369 inet_dist_listen_max 7369 -setcookie CKYBWKWCWNLSPZWSLJXT Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
Hosts are just:
so the pear@centos-2 like lines you setup are not being used by erl. You can run as many erl shells as you like with different names and not need to update hosts.
Once that setup is working if you look in /etc/resolv.conf you should have a domain and it should be the same on both machines. If it is, you can try adding an alias with it to the hosts like this:
Though ideally the setup in resolv.conf is to a local dns server that set's this naming up so centos-1.example.com and centos-2.example.com can already ping each other.