如果erlang:节点test1,test2互连接:
1.节点test1,test2 启动:分别在不同的shell上运行:
2.在节点1,节点2上运行:
node()得到自己节点的名称。
观察与之互接的节点:
nodes().
节点test1:信息
[img]http://dl2.iteye.com/upload/attachment/0094/6734/ce8fbfaa-a31a-3af9-b69a-c2999ae6f42e.png[/img]
节点test2:信息
[img]http://dl2.iteye.com/upload/attachment/0094/6736/7d5959ca-f9ff-3135-a128-502178a789bd.png[/img]
3.把test1,test2节点连接起来:
可以看到双方的nodes()都返回了对方的节点名。
[img]http://dl2.iteye.com/upload/attachment/0094/6738/a35b0e9d-5352-3814-ac08-c4eb0cf68bc3.png[/img]
4.
起test3节点:
然后test3连接test2:
[img]http://dl2.iteye.com/upload/attachment/0094/6740/cb4437ea-1596-3758-b6bf-ff64b4defc05.png[/img]
可以看到test3也和test1互接了!
在test1看nodes().
结论:如果A,B节点互连,用C节点连接B节点,则这3个节点都是互连的。
PPS:要cookie一致哦,如果不一致可用set_cookie/1来设置,不过只能连接到指定的节点上,不能连接到与指定节点相连且与之不一样的cookie上哦。
1.节点test1,test2 启动:分别在不同的shell上运行:
erl -name test1 -setcookie "erlang_code_fun"
erl -name test2 -setcookie "erlang_code_fun"
2.在节点1,节点2上运行:
node()得到自己节点的名称。
观察与之互接的节点:
nodes().
节点test1:信息
[img]http://dl2.iteye.com/upload/attachment/0094/6734/ce8fbfaa-a31a-3af9-b69a-c2999ae6f42e.png[/img]
节点test2:信息
[img]http://dl2.iteye.com/upload/attachment/0094/6736/7d5959ca-f9ff-3135-a128-502178a789bd.png[/img]
3.把test1,test2节点连接起来:
可以看到双方的nodes()都返回了对方的节点名。
[img]http://dl2.iteye.com/upload/attachment/0094/6738/a35b0e9d-5352-3814-ac08-c4eb0cf68bc3.png[/img]
4.
起test3节点:
erl -name test3 -setcookie "erlang_code_fun"
然后test3连接test2:
[img]http://dl2.iteye.com/upload/attachment/0094/6740/cb4437ea-1596-3758-b6bf-ff64b4defc05.png[/img]
可以看到test3也和test1互接了!
在test1看nodes().
结论:如果A,B节点互连,用C节点连接B节点,则这3个节点都是互连的。
PPS:要cookie一致哦,如果不一致可用set_cookie/1来设置,不过只能连接到指定的节点上,不能连接到与指定节点相连且与之不一样的cookie上哦。