Erlang Cluster Testing

Source: Internet
Author: User

First, start four cmd

-erl-sname A-setcookie ABC

-erl-sname B-setcookie ABC

-erl-sname C-setcookie ABC

-erl-sname D-setcookie EFG

Second, the node interconnection

1 nodes/0% get all node  2 with current node connection

  Tests can be entered in the order of red numbers

1. Under a enter net_adm:ping (b), when a is connected to B, the return of Pong indicates success,

You can enter nodes () in a, you can see the node cluster that the current node is connected to [[email protected]],

You can enter nodes () in B to see the node cluster that the current node is connected to [[email protected]],

2. Under a enter net_adm:ping (c), when a connects to C, the return of Pong indicates success,

At this time

In a input nodes (), you can see the node cluster that the current node is connected to [[email protected],[email protected]],

In B input nodes (), you can see the node cluster that the current node is connected to [[email protected],[email protected]],

In C input nodes (), you can see the node cluster that the current node is connected to [[email protected],[email protected]],

Description: Erlang uses an all-connected approach by default, and when any node joins a cluster, all nodes within that cluster are already connected to each other

3. When a connection to the D node is returned Pang indicates a failure, because the a node and the B node use different cookies, to establish a connection, you must use the same cookie

PS: If you want to add the D node to the cluster, you need to modify the cookie value of the D node, you can use AUTH:SET_COOKIE/1 to modify the current node cookie, use AUTH:GET_COOKIE/1 to get the current node cookie

When D modifies a cookie, it can be successfully added to the cluster

Summary command:

Erl-sname Name% Build a node

Erl-sname name-setcookie value% establish a cookie value of node

NET_ADM:PING/1%ping A node Pong connection Pang table failed
Auth:get_cookie/1% Gets the current node cookie value
Auth:set_cookie/1% modifies the current node's cookie value (the connection is not broken and the other node is connected)
Auth:set_cookie/2% The first parameter is another node (node and cookie are atomic) The second parameter is that node's cookie is used to allow two node connections of different cookies

Erlang Cluster Testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.