From 1aa126ffd6bb4b898a54ed6ee1a38680fbafb299 Mon Sep 17 00:00:00 2001 From: zeekling Date: Thu, 25 Apr 2024 23:46:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?NM=E5=8D=8F=E8=AE=AE=E8=AF=A6=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hdfs/NamenodeProtocols详解.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 hdfs/NamenodeProtocols详解.md diff --git a/hdfs/NamenodeProtocols详解.md b/hdfs/NamenodeProtocols详解.md new file mode 100644 index 0000000..c7e1937 --- /dev/null +++ b/hdfs/NamenodeProtocols详解.md @@ -0,0 +1,25 @@ + +## NameNode客户端协议详解 + +协议的定义主要在类NamenodeProtocols中。如下: + +```java +public interface NamenodeProtocols + extends ClientProtocol, + DatanodeProtocol, + DatanodeLifelineProtocol, + NamenodeProtocol, + RefreshAuthorizationPolicyProtocol, + ReconfigurationProtocol, + RefreshUserMappingsProtocol, + RefreshCallQueueProtocol, + GenericRefreshProtocol, + GetUserMappingsProtocol, + HAServiceProtocol { +} +``` +其中NameNode相关的大多数在NamenodeProtocol当中。 + +### NamenodeProtocol 详解 + + -- 2.45.2 From 19c3c2b475110a536494705d2d84fc70950e90ce Mon Sep 17 00:00:00 2001 From: zeekling Date: Thu, 25 Apr 2024 23:52:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?NM=E5=8D=8F=E8=AE=AE=E8=AF=A6=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hdfs/NamenodeProtocols详解.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hdfs/NamenodeProtocols详解.md b/hdfs/NamenodeProtocols详解.md index c7e1937..851be69 100644 --- a/hdfs/NamenodeProtocols详解.md +++ b/hdfs/NamenodeProtocols详解.md @@ -18,8 +18,20 @@ public interface NamenodeProtocols HAServiceProtocol { } ``` -其中NameNode相关的大多数在NamenodeProtocol当中。 + +根据交互对象的不同,将协议进行了不同的归类。要想了解协议内容,需要将其单独分开分析。 ### NamenodeProtocol 详解 +当前协议主要是备NameNode和主NameNode之间的通信协议。 + + +### DatanodeProtocol + +DataNode和NameNode之间的协议。 + +### DatanodeLifelineProtocol + +DN和NN之间心跳协议。 + -- 2.45.2 From d3f70b6f55aa64f9f19515bf64b7aafde37bd577 Mon Sep 17 00:00:00 2001 From: zeekling Date: Sun, 19 May 2024 22:39:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?NM=E5=8D=8F=E8=AE=AE=E8=AF=A6=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hdfs/NamenodeProtocols详解.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hdfs/NamenodeProtocols详解.md b/hdfs/NamenodeProtocols详解.md index 851be69..00acc96 100644 --- a/hdfs/NamenodeProtocols详解.md +++ b/hdfs/NamenodeProtocols详解.md @@ -23,8 +23,27 @@ public interface NamenodeProtocols ### NamenodeProtocol 详解 +```java +BlocksWithLocations getBlocks(DatanodeInfo datanode, long size, long + minBlockSize) throws IOException; +``` 当前协议主要是备NameNode和主NameNode之间的通信协议。 +获取指定DataNode中的块信息。 +- size: 请求的块数量。 +- minBlockSize: 查询的block块需要小于当前值。 + +```java +public ExportedBlockKeys getBlockKeys() throws IOException; +``` +获取NameNode产生的所有的blockkey信息。blockKey是由BlockTokenSecretManager产生的,BlockTokenSecretManager有两种模式:master模式和worker模式。 +master主要产生token,并且将token导入给workers。master和worker都可以校验token。一般情况下,NN是master模式,DN是worker模式。主要用于加密。 + +```java +public long getTransactionID() throws IOException; +``` + +获取最新的事务ID。 ### DatanodeProtocol -- 2.45.2