[Erlang危機](4.0)串連遠程節點,erlang4.0

來源:互聯網
上載者:User

[Erlang危機](4.0)串連遠程節點,erlang4.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.

幾乎所有的系統都支援第二種方法,所以本書會跳過這部分,畢竟我們對事情惡化後如何處理更感興趣。




Erlang uses something closer to an "interactor" than a REPL. Basically, a regular Erlang virtual machine does not need a REPL, and will happily run byte code and stick with that, no shell needed.
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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.