本文介绍了Erlang中终止节点的检测工作如何? net_ticktime如何影响Erlang节点活动的控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我将net_ticktime值设置为600秒。 net_kernel:set_net_ticktime(600) 在Erlang文档中为net_ticktime = TickTime: 指定net_kernel刻度时间。 TickTime以秒为单位。每个TickTime / 4秒后,所有连接的节点都会被勾选(如果还有其他任何东西已写入节点),并且在节点被认为是关闭的最后四(4)个刻度中没有从另一个节点接收到任何内容。这确保了由于诸如硬件错误等原因而没有响应的节点被认为是关闭的。 其中没有响应的节点的时间T检测到: MinT MinT = TickTime - TickTime / 4 MaxT = TickTime + TickTime / 4 TickTime默认为60(秒)。因此, T 注意:通常,立即检测到终止节点。 我的问题: 我的TickTime是600(秒)。因此,450(7.5分钟) T 但是,请注意,通常会立即检测到终止节点,但我无法找到解释(不在Erlang文档或Erlang电子书或其他Erlang的来源)分布式Erlang节点终止的即时响应原理。分布式环境中的节点是以比 net_ticktime 更小的间隔周期性ping,还是终止节点在其终止之前向其他节点发送某种消息?如果它发送消息有任何情况,当终止节点无法发送此消息,并且必须ping通以调查其活跃度? 还有在Erlang文档中注意到分布式Erlang对于大于100个节点的集群来说不是很可扩展,因为每个节点都保留到集群中所有节点的链接。调查节点生命力的算法(ping,宣告终止)是否随着群集大小的不断增加而修改?解决方案当两个Erlang节点连接,它们之间建立TCP连接。您所引发的失败将导致底层操作系统关闭连接,有效地通知其他节点非常快。 网络刻度用于检测与远程节点的连接,该远程节点似乎已经起起点,但实际上没有传递流量,例如当网络事件隔离节点。 如果要模拟需要勾选的故障,请使用防火墙来阻止当节点首次ping时创建的连接上的流量。 / p> I set net_ticktime value to 600 seconds.net_kernel:set_net_ticktime(600)In Erlang documentation for net_ticktime = TickTime:Specifies the net_kernel tick time. TickTime is given in seconds. Once every TickTime/4 second, all connected nodes are ticked (if anything else has been written to a node) and if nothing has been received from another node within the last four (4) tick times that node is considered to be down. This ensures that nodes which are not responding, for reasons such as hardware errors, are considered to be down.The time T, in which a node that is not responding is detected: MinT < T < MaxT where:MinT = TickTime - TickTime / 4MaxT = TickTime + TickTime / 4TickTime is by default 60 (seconds). Thus, 45 < T < 75 seconds. Note: Normally, a terminating node is detected immediately.My Problem:My TickTime is 600 (seconds). Thus, 450 (7.5 minutes)< T < 750 seconds (12.5 minutes). Although, when I set net_ticktime to all distributed nodes in Erlang to value 600 when some node fails (eg. when I close Erlang shell) then the other nodes get message immediately and not according to definition of ticktime.However it is noted that normally a terminating node is detected immediately but I could not find explanation (neither in Erlang documentation, or Erlang ebook or other Erlang based sources) of this immediate response principle for node termination in distributed Erlang. Are nodes in distributed environment pinged periodically with smaller intervals than net_ticktime or does the terminating node send some kind of message to other nodes before it terminates? If it does send a message are there any scenarios when upon termination node cannot send this message and must be pinged to investigate its liveliness?Also it is noted in Erlang documentation that Distributed Erlang is not very scalable for clusters larger than 100 nodes as every node keeps links to all nodes in the cluster. Is the algorithm for investigating liveliness of nodes (pinging, announcing termination) modified with increasing size of the cluster? 解决方案 When two Erlang nodes connect, a TCP connection is made between them. The failure you are inducing would cause the underlying OS to close the connection, effectively notifying the other node very quickly.The network tick is used to detect a connection to a distant node that appears to be up but is not actually passing traffic, such as may occur when a network event isolates a node.If you want to simulate a failure that would require a tick to detect, use a firewall to block the traffic on the connection created when the nodes first ping. 这篇关于Erlang中终止节点的检测工作如何? net_ticktime如何影响Erlang节点活动的控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-27 00:43