Fabric网络节点发现及成员管理
一个新节点通过已知的节点加入到网络中,此时,它所知的网络节点信息是非常有限的,需要通过节点发现获知更多的节点,建立起足够的连接。另外,当一个新节点加入到网络时,原有网络节点也需要通过节点发现感知到新节点的加入。
分布在各地的网络节点总是会有上线离线的变化,有这就需要Fabric网络必须动态维护一个节点成员列表,这就需要节点成员管理。
一、节点发现与成员管理
1. 节点发现
一个节点要加入Fabric网络,必须要知道至少一个已知Fabric节点作为启动节点。
相关配置如下:
# Gossip related configuration
gossip:
# Bootstrap set to initialize gossip with
bootstrap: 127.0.0.1:7051
Fabric节点发现与成员管理流程如下图所示:
2. 网络连接层次的节点成员管理(在线,掉线)
在线节点(Peer)通过持续不断地广播“活着”的消息,来表明他们的可用性。
这一部分相当于心跳检测,如果节点离线,就在channel成员列表中删除节点。
3. 相关消息定义
// AliveMessage is sent to inform remote peers
// of a peer's existence and activity
message AliveMessage {
Member membership = 1;
PeerTime timestamp = 2;
bytes identity = 4;
}
// MembershipRequest is used to ask membership information
// from a remote peer
message MembershipRequest {
Envelope self_information = 1;
repeated bytes known = 2;
}
// MembershipResponse is used for replying to MembershipRequests
message MembershipResponse {
repeated Envelope alive = 1;
repeated Envelope dead = 2;
}
二、节点间消息传播(Gossip)
1. 消息发送方式:
- 点对点发送(end to end)
- gossip方式——发送消息时会根据消息类型对节点进行过滤筛选(另外还会去除掉发送节点)后再随机(具体实现上是随机就近原则)选择\(k\)个节点发送消息。
这里采用的是push和pull方式。
2. push
节点有了新消息后,随机选择\(k\)个节点(例如,3),向它们发送新消息。\(k\)个节点收到后,继续随机选择\(k\)个节点发送新信息,直到所有节点都知道该新信息。
3. pull
所有节点周期性的随机选取\(k\)个(默认配置=3)个节点,向它们获取数据。Fabric中gossip协议pull操作如下:
/* PullEngine is an object that performs pull-based gossip, and maintains an internal state of items
identified by string numbers.
The protocol is as follows:
1) The Initiator sends a Hello message with a specific NONCE to a set of remote peers.
2) Each remote peer responds with a digest of its messages and returns that NONCE.
3) The initiator checks the validity of the NONCEs received, aggregates the digests,
and crafts a request containing specific item ids it wants to receive from each remote peer and then
sends each request to its corresponding peer.
4) Each peer sends back the response containing the items requested, if it still holds them and the NONCE.
Other peer Initiator
O <-------- Hello <NONCE> ------------------------- O
/|\ --------- Digest <[3,5,8, 10...], NONCE> --------> /|\
| <-------- Request <[3,8], NONCE> ----------------- |
/ \ --------- Response <[item3, item8], NONCE>-------> / \
*/
4. pull相关消息定义
// GossipHello is the message that is used for the peer to initiate
// a pull round with another peer
message GossipHello {
uint64 nonce = 1;
bytes metadata = 2;
PullMsgType msg_type = 3;
}
// DataDigest is the message sent from the receiver peer
// to the initator peer and contains the data items it has
message DataDigest {
uint64 nonce = 1;
repeated bytes digests = 2; // Maybe change this to bitmap later on
PullMsgType msg_type = 3;
}
// DataRequest is a message used for a peer to request
// certain data blocks from a remote peer
message DataRequest {
uint64 nonce = 1;
repeated bytes digests = 2;
PullMsgType msg_type = 3;
}
// DataUpdate is the final message in the pull phase
// sent from the receiver to the initiator
message DataUpdate {
uint64 nonce = 1;
repeated Envelope data = 2;
PullMsgType msg_type = 3;
}
Fabric网络节点发现及成员管理的更多相关文章
- Hyperledger Fabric网络节点架构
Fabric区块链网络的组成  区块链网络结构图 区块链网络组成 组成区块链网络相关的节点 节点是区块链的通信主体,和区块链网络相关的节点有多种类型:客户端(应用).Peer节点.排序服务(Orde ...
- hyperledger fabric各类节点及其故障分析 摘自https://www.cnblogs.com/preminem/p/8729781.html
hyperledger fabric各类节点及其故障分析 1.Client节点 client代表由最终用户操作的实体,它必须连接到某一个peer节点或者orderer节点上与区块链网络通信.客户端 ...
- hyperledger fabric各类节点及其故障分析
1.Client节点 client代表由最终用户操作的实体,它必须连接到某一个peer节点或者orderer节点上与区块链网络通信.客户端向endorser提交交易提案,当收集到足够背书后,向排序服务 ...
- hyperledger中文文档学习-4-构建第一个fabric网络
接下来的操作都将在hyperledge环境安装构建的虚拟机的环境下进行 参考https://hyperledgercn.github.io/hyperledgerDocs/build_network_ ...
- fabric网络环境启动过程详解
这篇文章对fabric的网络环境启动过程进行讲解,也就是我们上节讲到的启动测试fabric网络环境时运行network_setup.sh这个文件的执行流程 fabric网络环境启动过程详解 上一节我们 ...
- Windows下fabric sdk连接Linux上fabric网络的调试过程
上个月刚入职一家公司从事区块链研发工作,选型采用Hyperledger Fabric作为开发平台.团队的小组成员全部采用的是在VirtualBox上面安装桌面版的Ubuntu 16.04虚拟机,开发工 ...
- OpenStack IceHouse 部署 - 5 - 网络节点部署
Neutron网络服务(网络节点) 目录 [隐藏] 1 参考 2 前置工作 2.1 调整内核参数 3 安装 4 配置 4.1 keystone对接 4.2 rabbitmq对接 4.3 me ...
- 搭建基于hyperledger fabric的联盟社区(五) --启动Fabric网络
现在所有的文件都已经准备完毕,我们可以启动fabric网络了. 一.启动orderer节点 在orderer服务器上运行: cd ~/go/src/github.com/hyperledger/fab ...
- Hyperledger Fabric手动生成CA证书搭建Fabric网络
之前介绍了使用官方脚本自动化启动一个Fabric网络,并且所有的证书都是通过官方的命令行工具cryptogen直接生成网络中的所有节点的证书.在开发环境可以这么简单进行,但是生成环境下还是需要我们自定 ...
随机推荐
- mysql小白系列_08 zabbix3.2.6概念及部署
一 zabbix功能简介 1.zabbix三大监控组件 zabbix server web gui database zabbix_server zabbix proxy agent client 2 ...
- 简述 zookeeper 基于 Zab 协议实现选主及事务提交
Zab 协议:zookeeper 基于 Paxos 协议的改进协议 zookeeper atomic broadcast 原子广播协议. zookeeper 基于 Zab 协议实现选主及事务提交. 一 ...
- Poj 最短路和次短路的个数 Dij+优化?。
Description Tour operator Your Personal Holiday organises guided bus trips across the Benelux. Every ...
- Centos 安装 Anaconda
# 首先从 Anaconda 官网下载 anaconda Linux 64Bit 版本命令行安装包 $ wget https://repo.continuum.io/archive/Anaconda3 ...
- [Unity2d系列教程] 004.Unity如何调用ios的方法(SDK集成相关)
和上一篇类似,我们同样希望Unity能够直接调用IOS底层的代码,那么我们就需要研究怎么去实现它.下面让我来带大家看一个简单的例子 1.创建.h和.m文件如下 .h // // myTest.m // ...
- 使用Vue+Django+Ant Design做一个留言评论模块
使用Vue+Django+Ant Design做一个留言评论模块 1.总览 留言的展示参考网络上参见的格式,如掘金社区: 一共分为两层,子孙留言都在第二层中 最终效果如下: 接下是数据库的表结构,如下 ...
- 【Hadoop】namenode与secondarynamenode的checkpoint合并元数据
Checkpoint Node(检查点节点) NameNode persists its namespace using two files: fsimage, which is the latest ...
- Java实现 LeetCode 430 扁平化多级双向链表
430. 扁平化多级双向链表 您将获得一个双向链表,除了下一个和前一个指针之外,它还有一个子指针,可能指向单独的双向链表.这些子列表可能有一个或多个自己的子项,依此类推,生成多级数据结构,如下面的示例 ...
- Java实现 LeetCode 203 移除链表元素
203. 移除链表元素 删除链表中等于给定值 val 的所有节点. 示例: 输入: 1->2->6->3->4->5->6, val = 6 输出: 1->2 ...
- Java实现 蓝桥杯VIP 算法提高 特殊的质数肋骨
算法提高 特殊的质数肋骨 时间限制:1.0s 内存限制:256.0MB 问题描述 农民约翰母牛总是产生最好的肋骨.你能通过农民约翰和美国农业部标记在每根肋骨上的数字认出它们.农民约翰确定他卖给买方的是 ...