Skip to content

Commit

Permalink
There is no 'default range' for distributed erlang's ports
Browse files Browse the repository at this point in the history
Additionally, remove the idea of erlang and empd using the same port
range (empd listens on a single port and advertises the ports of VMs on
the local machine) and clarify where the app.config snippet should be
added to the file.
  • Loading branch information
Vagabond committed Aug 17, 2011
1 parent a62d295 commit 1c467af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pages/Network-Security-and-Firewall-Configurations.textile
Expand Up @@ -7,9 +7,9 @@ There are two classes of access control for Riak:

For both access groups, the settings you want are in riak/etc/app.config. The config directives you care about for client access all end in "_ip" and "_port": web_ip, web_port, pb_ip, and pb_port. Make note of those and configure your firewall to incoming TCP access to those ports or IP and port combinations. The exceptions to this is the handoff_ip and handoff_port directives. Those are for communication between Riak nodes only.

Riak uses the Erlang distribution mechanism for most inter-node communication. Riak identifies other machines in the ring using Erlang identifiers(<identifier>@<hostname or IP>, i.e. "riak@10.9.8.7"). Erlang resolves these node identifiers to a TCP port on a given machine via the Erlang Port Mapper daemon(epmd) running on each machine in a ring. epmd listens on TCP port 4369 on the wildcard interface. For inter-node communication, epmd uses ports in the 5001-6024 range by default.
Riak uses the Erlang distribution mechanism for most inter-node communication. Riak identifies other machines in the ring using Erlang identifiers(<identifier>@<hostname or IP>, i.e. "riak@10.9.8.7"). Erlang resolves these node identifiers to a TCP port on a given machine via the Erlang Port Mapper daemon(epmd) running on each machine in a ring. epmd listens on TCP port 4369 on the wildcard interface. For inter-node communication, Erlang uses an unpredictable port by default; it binds to port 0, which means the first available port.

You can configure Riak to tell the Erlang interpreter (and thence epmd) to only use a limited range of ports in riak/etc/app.config. If you want to restrict the range of ports that Erlang and epmd will use for inter-Erlang node communication to 6000-7999, you can add the following lines to riak/etc/app.config:
You can configure Riak to tell the Erlang interpreter to only use a limited range of ports in riak/etc/app.config. If you want to restrict the range of ports that Erlang will use for inter-Erlang node communication to 6000-7999, you can add the following lines to riak/etc/app.config:


```bash
Expand All @@ -20,6 +20,9 @@ You can configure Riak to tell the Erlang interpreter (and thence epmd) to only
```


This goes in the top level list in app.config, at the same level as all the other applications.


Then just configure your firewall to allow incoming access to TCP ports 6000 to 7999 from whichever network(s) contain your Riak nodes.


Expand All @@ -35,4 +38,4 @@ h5. Riak clients need to be able to contact a at least one machine in a Riak rin
- web_port: TCP:8098
- pb_port: TCP:8097

One important note: if you do add the inet_dist_listen_min and inet_dist_listen_max entries to riak/etc/app.config, you need to kill off any running epmd so it it will pick up the new settings. epmd will continue to run on a given machine even after all Erlang interpreters have exited.
One important note: if you do add the inet_dist_listen_min and inet_dist_listen_max entries to riak/etc/app.config, you need to kill off any running epmd so it it will pick up the new settings. epmd will continue to run on a given machine even after all Erlang interpreters have exited.

0 comments on commit 1c467af

Please sign in to comment.