erlang 如何使用OTP-23.1和R15 B 03 -1运行节点群集?

7tofc5zh  于 2022-12-08  发布在  Erlang
关注(0)|答案(2)|浏览(132)

我有一个运行R15B03-1的分布式Erlang节点集群。我开发了新代码,希望将其发布到新节点上,并将其放入当前集群。如何启动运行OTP 23.1版本的新节点,使运行R15 B 03 -1和OTP 23.1的节点之间的分发协议兼容?

3pmvbmvn

3pmvbmvn1#

This is not possible. Trying to make such a connection results in this error message:

=ERROR REPORT==== 30-Nov-2020::22:24:57.725297 ===
** new@localhost: Connection attempt from node old@localhost rejected since it cannot handle
   ["BIG_CREATION",
    "UTF8_ATOMS"].**

Nodes older than Erlang/OTP 20 19 cannot connect to a node running release 23. In general, backwards compatibility for the distribution protocol is only promised for two major releases in either direction.
There is an option, +R, that sets the "compatibility mode":
The distribution mechanism is not backward compatible by default. This flag sets the emulator in compatibility mode with an earlier Erlang/OTP release ReleaseNumber . The release number must be in the range <current release>-2..<current release> .
But in fact this flag currently doesn't turn on any compatibility features (see the source code), and it hasn't done so since compatibility for R9 was removed in R16B. Anyway, since it only allows going back 2 major releases, R15B and 21 are still too far apart.
The reason this flag doesn't actually control any features is that these days the distribution protocol relies more on feature negotiation. For example, all releases starting with 20 have supported the UTF-8 atom feature in the sense that they would be prepared to use it if another node asked them to do so, but only in release 23 did this feature become mandatory. Thus there is no need for any manual configuration to achieve compatibility within the ±2 major releases "compatibility window".
I'd thought I'd test this with an experiment, starting a node using every Erlang version I have installed locally (using ASDF) and making them try to connect to each other:

erlang_versions=$(asdf list erlang)
for x in $erlang_versions; do
  ~/.asdf/installs/erlang/$x/bin/erl -sname ${x//./-}@localhost -eval '
      timer:sleep(10000),
      {ok, Pairs} = net_adm:names(),
      [io:format("~p ~p ~p~n", [net_adm:ping(list_to_atom(Name++"@localhost")), node(), Name++"@localhost"])
        || {Name, _Port} <- Pairs],
      timer:sleep(10000),
      init:stop()' -noinput &
done

The results are in the table below. It seems like release 19 is the earliest release that can connect to release 23.
| Connecting to \ from | R15B03-1 | R16B03 | 17-5-3 | 18-3 | 19-1 | 19-3 | 20-3 | 20-3-8-11 | 21-0 | 21-0-4 | 21-2-2 | 21-3-8-1 | 21-3-8-2 | 22-0-2 | 22-0-4 | 22-0-7 | 22-1-1 | 22-1-2 | 22-2-8 | 22-3 | 22-3-3 | 23-0-2 | 23-0-rc3 |
| ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ |
| R15B03-1 | - | yes | yes | yes | yes | yes | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no |
| R16B03 | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | no | no |
| 17-5-3 | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | no | no |
| 18-3 | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | no | no |
| 19-1 | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 19-3 | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 20-3 | no | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 20-3-8-11 | no | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 21-0 | no | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 21-0-4 | no | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 21-2-2 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 21-3-8-1 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 21-3-8-2 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 22-0-2 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes | yes |
| 22-0-4 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes | yes |
| 22-0-7 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes | yes |
| 22-1-1 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes | yes |
| 22-1-2 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes | yes |
| 22-2-8 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes | yes |

| 22-3 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes | yes |
| 22-3-3 | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes | yes |
| 23-0-2 | no | no | no | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - | yes |
| 23-0-rc3 | no | no | no | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | - |

jqjz2hbq

jqjz2hbq2#

编辑:检查legoscia的答案,因为它是正确的,我会在这里留下这个作为参考

您需要检查External Term Format,以了解两个版本之间可能存在的不兼容性(在该页面中搜索OTP)。我不确定如果运行旧OTP的节点收到一些关于它不知道的某种类型的消息会发生什么。
也许在OTP23中部署您当前的代码,然后在所有机器都具有相同OTP版本时添加新代码会更安全?

相关问题