首页 > 代码库 > [Erlang危机](4.0)连接远程节点
[Erlang危机](4.0)连接远程节点
原创文章,转载请注明出处:服务器非业余研究http://blog.csdn.net/erlib 作者Sunface联系邮箱:cto@188.com
连接到远程节点
Interacting with a running server program is traditionally done in one of two ways. One is to do it through an interactive shell kept available by using a screen or tmux session that runs in the background and letting someone connect to it.
?与运行中的程序交互通常有两种方式:一种是使用erlang shell或tmux会话(在后台运行,让用户来主动连接它)The other is to program management functions or comprehensive configuration files that can be dynamically reloaded.The interactive session approach is usually okay for software that runs in a strict ReadEval-Print-Loop (REPL). The programmed management and configuration approach requires careful planning in whatever tasks you think you’ll need to do, and hopefully getting it right.?
另一种就是通过程序管理功能或动态加载的配置文件。使用交互会话(session)的软件通常是运行在严格遵守ReadEval-Print-Loop(REPL)标准的机器上.程序管理和配置文件方法则需要仔细规划好你需要做的每个任务,然后希望系统按照你设想的运行
Pretty much all systems can try that approach, so I’ll skip it given I’m somewhat more interested in the cases where stuff is already bad and no function exists for it.?几乎所有的系统都支持第二种方法,所以本书会跳过这部分,毕竟我们对事情恶化后如何处理更感兴趣。
However, because of how it works with concurrency and multiprocessing, and good support for distribution, it is possible to have in-software REPLs that run as arbitrary Erlang processes.?
Erlang使用一个类似于交互器的东西(不是REPL). 基本上,一个正常的Erlang虚拟机根本不需要REPL,就能愉快稳定地运行字节代码,并不需要shell.但是,因为系统要处理并发和多进程,并要支持分布式,这个可能就要使用自带的REPL软件,这种自带的REPL软件也是以任意数量的erlang进程形式存在的。
This means that, unlike a single screen session with a single shell, it’s possible to have as many Erlang shells connected and interacting with one virtual machine as you want at a time 1.这也就意味着,并不仅仅只能开启一个屏幕会话,可能同时会有很多Erlang shell与虚拟机相连接,这样多个shell就能同一个虚拟机进行交互 1。
Most common usages will depend on a cookie being present on the two nodes you want to connect together2, but there are ways to do it that do not include it. 最常用的用法是通过相同的cookie让2个节点连接在一起2,但也有其它方法可以做到这一点。
Most usages will also require the use of named nodes, and all of them will require a priori measures to make sure you can contact the node.
?大多数节点都需要使用节点名,而且还需要做一些准备措施,这样才能保证你成功连接到节点。[1] More details on the mechanisms at http://ferd.ca/repl-a-bit-more-and-less-than-that.html[2] More details at http://learnyousomeerlang.com/distribunomicon#cookies or http://www.erlang.org/doc/reference_manual/distributed.html#id83619[注1] :更多细节 http://ferd.ca/repl-a-bit-more-and-less-than-that.html
[注2] :更多细节 http://learnyousomeerlang.com/distribunomicon#cookies 或 http://www.erlang.org/doc/reference_manual/distributed.html#id83619
[Erlang危机](4.0)连接远程节点
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。