Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Corda 3.1-发现哪些节点已关闭且未运行_Corda - Fatal编程技术网

Corda 3.1-发现哪些节点已关闭且未运行

Corda 3.1-发现哪些节点已关闭且未运行,corda,Corda,我有一个关于Corda 3.1和使用网络地图查看节点是否已启动的问题-通常使用它是一个好主意吗 从这些注释中可以看出,由于存在对网络地图参和者数据的轮询(在缓存数据过期的情况下),所以在技术上应该可以做到这一点。 您能看到以这种方式实现此功能的任何缺点吗 如果节点配置了compatibilityZoneURL配置,那么它首先将自己的已签名节点信息上传到服务器(每次启动时都会更改),然后继续下载整个网络映射。网络映射由NodeInfo哈希列表组成。节点定期轮询网络映射(基于HTTP缓存到期头),并

我有一个关于Corda 3.1和使用网络地图查看节点是否已启动的问题-通常使用它是一个好主意吗

从这些注释中可以看出,由于存在对网络地图参和者数据的轮询(在缓存数据过期的情况下),所以在技术上应该可以做到这一点。 您能看到以这种方式实现此功能的任何缺点吗

如果节点配置了compatibilityZoneURL配置,那么它首先将自己的已签名节点信息上传到服务器(每次启动时都会更改),然后继续下载整个网络映射。网络映射由NodeInfo哈希列表组成。节点定期轮询网络映射(基于HTTP缓存到期头),并下载和缓存任何新条目。不再存在的条目将从节点的缓存中删除


将网络地图用作活动服务不是一个好主意

网络确实有一个事件视界参数。如果节点脱机时间超过event horizon参数指定的时间长度,则会从网络映射中弹出该节点。然而,事件视界通常为天(例如30天)

相反,您可以使用Telnet之类的工具ping节点的P2P端口。如果运行
telnet
并且节点已启动,您将看到如下内容:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
如果节点已关闭,您将看到类似以下内容:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
或者,如果要从流中自动检查活动性,可以定义如下所示的子流。此流将返回一个布尔值,指示网络上的给定方是否脱机

@InitiatingFlow
class IsLiveFlow(val otherPartyName: CordaX500Name) : FlowLogic<Boolean>() {

    @Suspendable
    override fun call(): Boolean {
        val otherPartyInfo = serviceHub.networkMapCache.getNodeByLegalName(otherPartyName)!!
        val otherPartyP2PAddress = otherPartyInfo.addresses.single()
        return try {
            Socket().use { socket ->
                socket.connect(InetSocketAddress(otherPartyP2PAddress.host, otherPartyP2PAddress.port), 1000)
                true
            }
        } catch (e: IOException) {
            false
        }
    }
}
@InitiatingFlow
类IsLiveFlow(val otherPartyName:CordaX500Name):FlowLogic(){
@暂停
覆盖有趣的调用():布尔值{
val otherPartyInfo=serviceHub.networkMapCache.getNodeByLegalName(otherPartyName)!!
val otherPartyP2PAddress=otherPartyInfo.addresses.single()
回击{
套接字()。请使用{Socket->
socket.connect(InetSocketAddress(otherPartyP2PAddress.host,otherPartyP2PAddress.port),1000)
真的
}
}捕获(e:IOException){
假的
}
}
}

将网络地图用作活动服务不是一个好主意

网络确实有一个事件视界参数。如果节点脱机时间超过event horizon参数指定的时间长度,则会从网络映射中弹出该节点。然而,事件视界通常为天(例如30天)

相反,您可以使用Telnet之类的工具ping节点的P2P端口。如果运行
telnet
并且节点已启动,您将看到如下内容:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
如果节点已关闭,您将看到类似以下内容:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
或者,如果要从流中自动检查活动性,可以定义如下所示的子流。此流将返回一个布尔值,指示网络上的给定方是否脱机

@InitiatingFlow
class IsLiveFlow(val otherPartyName: CordaX500Name) : FlowLogic<Boolean>() {

    @Suspendable
    override fun call(): Boolean {
        val otherPartyInfo = serviceHub.networkMapCache.getNodeByLegalName(otherPartyName)!!
        val otherPartyP2PAddress = otherPartyInfo.addresses.single()
        return try {
            Socket().use { socket ->
                socket.connect(InetSocketAddress(otherPartyP2PAddress.host, otherPartyP2PAddress.port), 1000)
                true
            }
        } catch (e: IOException) {
            false
        }
    }
}
@InitiatingFlow
类IsLiveFlow(val otherPartyName:CordaX500Name):FlowLogic(){
@暂停
覆盖有趣的调用():布尔值{
val otherPartyInfo=serviceHub.networkMapCache.getNodeByLegalName(otherPartyName)!!
val otherPartyP2PAddress=otherPartyInfo.addresses.single()
回击{
套接字()。请使用{Socket->
socket.connect(InetSocketAddress(otherPartyP2PAddress.host,otherPartyP2PAddress.port),1000)
真的
}
}捕获(e:IOException){
假的
}
}
}

查看您自己的节点是否已启动,或查看其他人的节点是否已启动?如果您自己的节点已启动,查看其他人的节点是否已启动,或者查看其他人的节点是否已启动?查看其他人的节点是否已启动,但这只意味着从cordaap内部无法轻松完成此操作,并且始终需要一些操作人员工作或一些额外的实现来在每个节点上公开此类信息(健康探测器等)——@Joel我说得对吗?简单场景:当我想弄清楚创建事务并将其发送给第二方是否有意义时,因为另一个节点可能已关闭,我不想启动流,这将只是挂起更新的答案来显示如何从流中检查活动性。好的,但这只意味着没有从cordaap内部执行此操作的简单方法,并且在每个节点(健康探测器等)上公开此类信息时始终需要一些操作性人工工作或一些额外的实现。--Joel,我说得对吗?简单场景:当我想弄清楚创建事务并将其发送给第二方是否真的有意义时,因为另一个节点可能已关闭,我不想启动流,而流只是挂起更新的答案来显示如何从流中检查活动性。