我认为最简单的方法是加入远程shell。刚开始erl
与-remsh Node
参数
$ erl -sname foo
Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.5 (abort with ^G)
([email protected])1>
另一端:
$ erl -sname bar -remsh '[email protected]'
Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.5 (abort with ^G)
([email protected])1>
另一种选择是使用erl
(按^G
)
$ erl -sname bar
Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.5 (abort with ^G)
([email protected])1>
User switch command
--> h
c [nn] - connect to job
i [nn] - interrupt job
k [nn] - kill job
j - list all jobs
s [shell] - start local shell
r [node [shell]] - start remote shell
q - quit erlang
? | h - this message
--> r '[email protected]'
--> j
1 {shell,start,[init]}
2* {'[email protected]',shell,start,[]}
--> c
Eshell V5.7.5 (abort with ^G)
([email protected])1>
User switch command
--> j
1 {shell,start,[init]}
2* {'[email protected]',shell,start,[]}
--> c 1
([email protected])1>
注强大的作业控制功能,你必须按Enter
如果您切换回现有shell,则显示shell提示。
从两个Erlang应用程序访问正在运行的Mnesia数据库的最佳实践是什么?向Mnesia群集添加节点并以这种方式访问它似乎有点矫枉过正? – 2010-07-28 23:52:31
@Peter:然后使用rpc模块,如果它在同一个Erlang集群中,或者当你想通过套接字进行通信时使用lib_chan。 – 2010-07-29 09:33:42
我建议在使用远程shell时使用-hidden标志,特别是在处理分布式网络时。例如。 erl -sname bar -remsh'foo @ hynek-notebook'-hidden – 2010-09-19 09:21:13