Search code examples
couchdbdatabase-cluster

Make CouchDB use the open ports


The CouchDB Clustering Setup Reference indicates that if you need to limit the range of ephemeral ports used by CouchDB clusters you need to modify the sys.config to add {inet_dist_listen_min, xxxx} and {inet_dist_listen_max, xxxx} entries such as:

[
    {lager, [
        {error_logger_hwm, 1000},
        {error_logger_redirect, true},
        {handlers, [
        {lager_console_backend, [debug, {
                lager_default_formatter,
                [
                    date, " ", time,
                    " [", severity, "] ",
                    node, " ", pid, " ",
                    message,
                    "\n"
                ]
            }]}
        ]},
        {inet_dist_listen_min, 9100},
        {inet_dist_listen_max, 9200}
    ]}
].

but lager and its dependencies were removed and these entries look to be part of what looks like an array or list of entries associated with lager.

lager, I believe is some logging tool, so I'm a little perplexed. Am I just misreading the settings and I should just these entries in the root array or now that lager is gone can I simply skip this?


Solution

  • What worked for me was to put in the whole configuration as described in the document even though the wording points to just inserting the inet_dist_listen_min and inet_dist_listen_max.

    So replace []. with:

    [
        {lager, [
            {error_logger_hwm, 1000},
            {error_logger_redirect, true},
            {handlers, [
            {lager_console_backend, [debug, {
                    lager_default_formatter,
                    [
                        date, " ", time,
                        " [", severity, "] ",
                        node, " ", pid, " ",
                        message,
                        "\n"
                    ]
                }]}
            ]},
            {inet_dist_listen_min, 9100},
            {inet_dist_listen_max, 9200}
        ]}
    ].
    

    Note that the port range indicated there is from the docs but these are not in the recommended range for ephemeral ports which IANA puts at 49152 to 65535.