{"id":46881,"date":"2023-09-16T00:44:16","date_gmt":"2023-02-03T04:17:37","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/"},"modified":"2024-05-03T23:55:43","modified_gmt":"2024-05-03T15:55:43","slug":"%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/","title":{"rendered":"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248"},"content":{"rendered":"<p>\u672c\u6587\u662f\u5173\u4e8e\u4f7f\u7528\u5f00\u6e90\u8f6f\u4ef6\uff08OSS\uff09\u5206\u5e03\u5f0f\u8d26\u672c\u6280\u672fHyperledger\/fabric\u521b\u5efa\u7b80\u5355\u7684\u5b58\u53d6\u6b3e\u5904\u7406\uff0c\u5e76\u5c1d\u8bd5\u5728Docker Swarm\u6a21\u5f0f\u4e0b\u8fdb\u884c\u5206\u5e03\u5f0f\u5904\u7406\u7684\u7cfb\u5217\u6587\u7ae0\u7684\u7b2c\u4e09\u7bc7\u3002<\/p>\n<p>\u672c\u6b21\u7684\u6700\u7ec8\u56de\uff0c\u6211\u4eec\u5c06\u5c1d\u8bd5\u5728Docker Swarm\u96c6\u7fa4\u4e0a\u5b9e\u73b0Hyperledger\/fabric\u7684\u5206\u5e03\u5f0f\u8fd0\u884c\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5c1d\u8bd5\u4f7f\u7528Docker Swarm\u5728OSS\u7684\u5206\u5e03\u5f0f\u8d26\u672cHyperledger\/fabric\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff081\/3\uff09-\u9a8c\u8bc1\u8fd0\u884c\u7bc7<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5c1d\u8bd5\u4f7f\u7528Docker Swarm\u5728OSS\u7684\u5206\u5e03\u5f0f\u8d26\u672cHyperledger\/fabric\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff082\/3\uff09-\u667a\u80fd\u5408\u7ea6\u89e3\u91ca\u7bc7<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u5c1d\u8bd5\u4f7f\u7528Docker Swarm\u5728OSS\u7684\u5206\u5e03\u5f0f\u8d26\u672cHyperledger\/fabric\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09-\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7bc7<\/ol>\n<h1>Docker \u96c6\u7fa4\u6a21\u5f0f\u548c docker-compose.yaml<\/h1>\n<p>\u901a\u8fc7\u4f7f\u7528\u81ea2016\u5e747\u6708\u53d1\u5e03\u76841.12\u7248\u672c\u4e2d\u52a0\u5165\u7684swarm mode\u529f\u80fd\uff0c\u6211\u4eec\u73b0\u5728\u53ef\u4ee5\u4ec5\u4f7f\u7528Docker\u6765\u6784\u5efa\u7531\u591a\u4e2a\u8282\u70b9\u7ec4\u6210\u7684Docker\u96c6\u7fa4\u3002\u53e6\u5916\uff0c\u4ece2017\u5e741\u6708\u53d1\u5e03\u76841.13\u7248\u672c\u5f00\u59cb\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4eceDocker Compose\u7684yaml\u5b9a\u4e49\u6587\u4ef6\u4e2d\u5c06\u4e00\u7ec4\u670d\u52a1\u4e00\u8d77\u6784\u5efa\u6210\u4e3a\u4e00\u4e2a\u53eb\u505a&#8221;stack&#8221;\u7684\u7fa4\u7ec4\u5728swarm\u4e0a\u8fd0\u884c\u3002<\/p>\n<p>\u6700\u8fd1\u51fa\u73b0\u4e86\u4e0d\u4ec5\u4ec5\u662fGKE\u548cAKS\uff0c\u8fd8\u6709EKS\u7684\u60c5\u51b5\uff0c\u4f5c\u4e3a\u5bb9\u5668\u7f16\u6392\u5e73\u53f0\u4f3c\u4e4e\u4e0d\u4ec5\u9650\u4e8ekubernetes\u3002\u4f46\u662f\uff0c\u6682\u4e14\u53ef\u4ee5\u590d\u7528docker-compose\u7684yaml\u5b9a\u4e49\uff0c\u65e0\u9700\u5b89\u88c5\u5176\u4ed6\u8f6f\u4ef6\u5373\u53ef\u5728\u591a\u4e2a\u8282\u70b9\u4e0a\u5206\u6563\u90e8\u7f72\u5bb9\u5668\u5e76\u8fdb\u884c\u534f\u540c\u64cd\u4f5c\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cdocker swarm mode\u662f\u5f88\u6709\u7528\u7684\u3002\u56e0\u6b64\uff0c\u672c\u6b21\u51b3\u5b9a\u4f7f\u7528docker swarm mode\u6765\u5b9e\u73b0Hyperledger\/fabric\u7684\u5206\u5e03\u5f0f\u8fd0\u884c\uff08\u7ed3\u675f\u8fa9\u89e3\uff09\u3002<\/p>\n<h2>\u5728\u4f7f\u7528Docker Swarm\u6a21\u5f0f\u6267\u884cdocker-compose\u7684yaml\u5b9a\u4e49\u65f6\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\u3002<\/h2>\n<h3>\u25cb \u5bb9\u5668\u540d\u79f0 \u0261 q\u00ec \u0261)<\/h3>\n<p>\u5982\u679c\u4f7f\u7528docker-compose\u5728\u5355\u72ec\u7684docker\u4e0a\u542f\u52a8\u670d\u52a1\uff0c\u53ef\u4ee5\u5728yaml\u5b9a\u4e49\u6587\u4ef6\u7684service\u540d\u79f0\u4e2d\u4f7f\u7528\u5927\u5199\u5b57\u6bcd\u3001\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u53e5\u70b9\u3001\u8fde\u5b57\u7b26\u548c\u4e0b\u5212\u7ebf\uff08[a-zA-Z0-9\\._\\-]\uff09\u3002<br \/>\n\u5982\u679c\u5728yaml\u5b9a\u4e49\u6587\u4ef6\u4e2d\u5b9a\u4e49\u4e86container_name\uff0c\u5bb9\u5668\u5c06\u4ee5\u8be5\u540d\u79f0\u542f\u52a8\uff1b\u5982\u679c\u6ca1\u6709\u6307\u5b9a\uff0c\u5219\u5bb9\u5668\u540d\u79f0\u5c06\u4ee5&lt;&lt;\u9879\u76ee\u540d\u79f0&gt;&gt;_&lt;&lt;\u670d\u52a1\u540d\u79f0&gt;&gt;_&lt;&lt;\u5e8f\u53f7&gt;&gt;\u7684\u5f62\u5f0f\u9644\u52a0\u3002<\/p>\n<blockquote><p>\u4e8b\u5b9e\u4e0a\uff0c\u5728Hyperledger\/fabric\u7684\u5b98\u65b9\u793a\u4f8bdocker-compose.yaml\u6587\u4ef6\u4e2d\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u79f0\u4e3aca.example.com\u7684\u8ba4\u8bc1\u673a\u6784\u670d\u52a1\u3002<\/p><\/blockquote>\n<p>\u5728docker swarm\u6a21\u5f0f\u4e2d\uff0c\u5982\u679c\u60a8\u5c1d\u8bd5\u5c06\u5728docker-compose\u4e2d\u6709\u6548\u7684yaml\u5b9a\u4e49\u90e8\u7f72\uff0c\u5219\u53ef\u80fd\u5bfc\u81f4\u5bb9\u5668\u542f\u52a8\u5931\u8d25\u3002\u4f8b\u5982\uff0c\u5f53\u5c1d\u8bd5\u4f7f\u7528\u4e0a\u8ff0\u7684\u670d\u52a1\u540dca.example.com\u542f\u52a8\u8ba4\u8bc1\u673a\u6784\u5bb9\u5668\u65f6\uff0c\u5c06\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u9519\u8bef\u3002<\/p>\n<pre class=\"post-pre\"><code>failed to create service fabric-payment_ca.example.com: Error response from daemon: rpc error: code <span class=\"o\">=<\/span> InvalidArgument desc <span class=\"o\">=<\/span> name must be valid as a DNS name component\r\n<\/code><\/pre>\n<p>\u5728Docker Swarm\u6a21\u5f0f\u4e0b\uff0c\u5373\u4f7f\u5728yaml\u5b9a\u4e49\u6587\u4ef6\u4e2d\u5b9a\u4e49\u4e86container_name\uff0c\u4e5f\u4f1a\u88ab\u5ffd\u7565\uff0c\u5e76\u4ee5&lt;&lt;\u5806\u6808\u540d\u79f0&gt;&gt;_&lt;&lt;\u670d\u52a1\u540d\u79f0&gt;&gt;.&lt;&lt;\u5e8f\u53f7&gt;&gt;.&lt;&lt;\u4efb\u52a1ID&gt;&gt;\u7684\u683c\u5f0f\u751f\u6210\u5bb9\u5668\u540d\u79f0\u3002\u770b\u8d77\u6765\uff0c\u8fd9\u4e2a\u5bb9\u5668\u540d\u79f0\u5fc5\u987b\u7b26\u5408\u6b63\u786e\u7684DNS\u540d\u79f0\u624d\u53ef\u4ee5\u3002<\/p>\n<p>\u4e3a\u4e86\u62e5\u6709\u4e00\u4e2a\u6b63\u786e\u7684 DNS \u540d\u79f0\uff0c\u6700\u597d\u907f\u514d\u4f7f\u7528\u4e0b\u5212\u7ebf\u6216\u53e5\u70b9\uff0c\u4ec5\u9650\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\uff08\u6216\u5927\u5199\u5b57\u6bcd\uff09\u548c\u6570\u5b57\u4ee5\u53ca\u8fde\u5b57\u7b26\uff0c\u5e76\u9009\u62e9\u4e00\u4e2a\u5c3d\u53ef\u80fd\u7b80\u77ed\u7684\u670d\u52a1\u540d\u79f0\u3002<\/p>\n<blockquote><p>\u88ab\u53e5\u70b9(.)\u5206\u9694\u7684\u90e8\u5206\u88ab\u79f0\u4e3a\u201c\u6807\u7b7e\u201d\u3002\u4e00\u4e2a\u6807\u7b7e\u7684\u957f\u5ea6\u5fc5\u987b\u5c0f\u4e8e63\u4e2a\u5b57\u7b26\uff0c\u6574\u4e2a\u57df\u540d\u7684\u957f\u5ea6\uff08\u5305\u62ec\u53e5\u70b9\uff09\u5fc5\u987b\u5c0f\u4e8e253\u4e2a\u5b57\u7b26\u3002\u5728\u6807\u7b7e\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u82f1\u6587\u5b57\u6bcd\uff08A~Z\uff09\u3001\u6570\u5b57\uff080~9\uff09\u548c\u8fde\u5b57\u7b26\uff08-\uff09\uff0c\u4f46\u6807\u7b7e\u7684\u9996\u5c3e\u5b57\u7b26\u4e0d\u80fd\u662f\u8fde\u5b57\u7b26\u3002\u5728\u6807\u7b7e\u4e2d\uff0c\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u8ba4\u4e3a\u76f8\u540c\u7684\u5b57\u7b26\u662f\u76f8\u7b49\u7684\u3002<\/p><\/blockquote>\n<h3>\u25cb \u4e3b\u673a\u540d\u79f0<\/h3>\n<p>\u5982\u679c\u5728\u5355\u72ec\u7684Docker\u4e0a\u4f7f\u7528docker-compose\u542f\u52a8Hyperledger\/Fabric\u7f51\u7edc\uff0c\u5c06\u4f1a\u81ea\u52a8\u751f\u6210\u6865\u63a5\u7f51\u7edc\uff08\u4e5f\u53ef\u4ee5\u624b\u52a8\u521b\u5efa\uff09\uff0c\u5e76\u901a\u8fc7\u5185\u90e8DNS\u4ee5\u670d\u52a1\u540d\u89e3\u6790\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u4e0d\u8fdb\u884c\u4efb\u4f55\u7279\u6b8a\u914d\u7f6e\uff0c\u5bb9\u5668\u4e4b\u95f4\u4e5f\u53ef\u4ee5\u901a\u8fc7\u670d\u52a1\u540d\u8fdb\u884c\u901a\u4fe1\u3002<\/p>\n<p>\u5982\u679c\u8981\u5728\u5206\u6563\u73af\u5883\u4e0b\u4f7f\u7528Swarm\u6a21\u5f0f\u542f\u52a8Hyperledger\/fabric\u7f51\u7edc\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u8986\u76d6\u7f51\u7edc\uff08overlay network\uff09\u6765\u5e03\u7f6e\u865a\u62df\u7f51\u7edc\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u6865\u63a5\u7f51\u7edc\u8de8\u8d8a\u591a\u4e2a\u8282\u70b9\u3002<\/p>\n<p>\u6839\u636edocker-compose\u7684yaml\u5b9a\u4e49\u542f\u52a8\u5bb9\u5668\u65f6\u4e0d\u4f1a\u53d1\u751f\u4efb\u4f55\u95ee\u9898\u3002\u4f46\u6b63\u5982\u7b2c\u4e00\u6b21\u8bb2\u89e3\u7684\u90a3\u6837\uff0cHyperledger\/fabric\u4f1a\u76f4\u63a5\u4ecepeer\u5bb9\u5668\u5185\u542f\u52a8chaicode\u5bb9\u5668\u5e76\u8fde\u63a5\u5230docker network\u3002\u5728\u6b64\u8fc7\u7a0b\u4e2d\uff0cpeer\u4f3c\u4e4e\u6b63\u5728\u67e5\u627edocker\u7684\u5185\u90e8dns\uff0c\u4f46\u5728docker swarm\u6a21\u5f0f\u4e0b\uff0c\u7531\u4e8e\u81ea\u52a8\u751f\u6210\u7684\u4e3b\u673a\u540d\uff0c\u67e5\u627e\u4f1a\u8d85\u65f6\uff08\u8be6\u7ec6\u4fe1\u606f\u6ca1\u6709\u8ffd\u8e2a\u3002\u3002\u3002\uff09\u3002<br \/>\n\u901a\u8fc7\u5728docker-compose\u7684yaml\u5b9a\u4e49\u4e2d\u660e\u786e\u6307\u5b9a\u4e0e\u670d\u52a1\u540d\u79f0\u76f8\u540c\u7684\u4e3b\u673a\u540d\uff0c\u53ef\u4ee5\u907f\u514d\u6b64\u95ee\u9898\u3002<\/p>\n<h3>\u25cb \u8986\u76d6\u7f51\u7edc\u540d\u79f0<\/h3>\n<p>\u5982\u679c\u5728docker-compose\u7684yaml\u5b9a\u4e49\u4e2d\u6307\u5b9a\u4e86overlay driver\u7684networks\u6761\u76ee\uff0c\u90a3\u4e48\u5728\u4f7f\u7528docker swarm\u6a21\u5f0f\u90e8\u7f72\u65f6\uff0c\u5c06\u81ea\u52a8\u521b\u5efa\u8be5\u5806\u6808\u6240\u9700\u7684overlay\u7f51\u7edc\u3002\u5728\u542f\u52a8yaml\u5b9a\u4e49\u4e2d\u5b9a\u4e49\u7684\u5bb9\u5668\u5e76\u5728overlay\u7f51\u7edc\u4e0a\u8fdb\u884c\u8fde\u63a5\u65b9\u9762\u4e0d\u4f1a\u9047\u5230\u4efb\u4f55\u95ee\u9898\uff0c\u5e76\u4e14\u5728\u5220\u9664\u5806\u6808\u65f6\uff0c\u8be5overlay\u7f51\u7edc\u4e5f\u5c06\u88ab\u81ea\u52a8\u5220\u9664\uff0c\u8fd9\u975e\u5e38\u65b9\u4fbf\u3002\u4f46\u662f\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u4e24\u70b9\u624d\u80fd\u5728Hyperledger\/fabric\u4e2d\u4f7f\u7528\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">overlay network\u306fattachable\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>peer\u30b3\u30f3\u30c6\u30ca\u304c\u8d77\u52d5\u3057\u305fchaicode\u30b3\u30f3\u30c6\u30ca\u3092overlay network\u306b\u63a5\u7d9a\u3059\u308b\u305f\u3081\u3001overlay network\u306b\u306f\u5f8c\u304b\u3089\u30b3\u30f3\u30c6\u30ca\u3092\u63a5\u7d9a\u3067\u304d\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002driver\u3092\u6307\u5b9a\u3057\u305f\u3060\u3051\u3067\u306f\u81ea\u52d5\u4f5c\u6210\u3055\u308c\u305foverlay network\u306fattachable\u306b\u306a\u308a\u307e\u305b\u3093\u306e\u3067\u3001networks\u30a8\u30f3\u30c8\u30ea\u3067\u660e\u793a\u7684\u306battachable: true\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff08attachable\u6307\u5b9a\u306f\u3001yaml\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u306eversion\u306f3.3\u304b\u3089\u5c0e\u5165\uff09<\/p>\n<p>peer\u30b3\u30f3\u30c6\u30ca\u306b\u8a2d\u5b9a\u3059\u308bCORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE\u74b0\u5883\u5909\u6570\u306e\u5024<\/p>\n<p>\u3053\u306e\u74b0\u5883\u5909\u6570\u306b\u306f\u3001chaincode\u3092\u63a5\u7d9a\u3059\u308bdocker network\u306e\u540d\u524d\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002docker swarm mode\u3078\u306edeploy\u6642\u306b\u81ea\u52d5\u8d77\u52d5\u3057\u305foverlay network\u306f\u3001&lt;&lt;\u30b9\u30bf\u30c3\u30af\u540d&gt;&gt;_&lt;&lt;yaml\u5b9a\u7fa9\u4e2d\u3067\u8a2d\u5b9a\u3057\u305fnetwork\u540d&gt;&gt;\u3068\u3044\u3046\u540d\u524d\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001network\u540d\u3092\u305d\u306e\u307e\u307e\u6307\u5b9a\u3059\u308b\u3068chaincode\u30b3\u30f3\u30c6\u30ca\u304c\u7acb\u3061\u4e0a\u304c\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u5728\u672c\u6b21\u7684\u793a\u4f8b\u4e2d\uff0c\u7531\u4e8e\u5c06zookeeper\u548ckafka\u7684\u5806\u6808\u8fdb\u884c\u4e86\u5206\u5272\uff0c\u56e0\u6b64\u6700\u7ec8\u51b3\u5b9a\u91c7\u7528\u4e86\u5f15\u7528\u9884\u5148\u521b\u5efa\u7684\u53ef\u9644\u52a0\u7684\u8986\u76d6\u7f51\u7edc\u7684\u65b9\u5f0f\uff08\u5373\u4f7f\u5220\u9664\u4e86\u5806\u6808\uff0c\u8986\u76d6\u7f51\u7edc\u4ecd\u7136\u4fdd\u7559\uff0c\u6240\u4ee5\u6700\u540e\u5fc5\u987b\u624b\u52a8\u5220\u9664\u8986\u76d6\u7f51\u7edc\uff09\u3002<\/p>\n<h3>\u6307\u5b9a\u8981\u542f\u52a8\u5bb9\u5668\u7684\u8282\u70b9\u3002<\/h3>\n<p>\u7531\u4e8eHyperledger\/Fabric\u4e2d\u7684orderer\u3001peer\u3001couchdb\u7b49\u5bc6\u5207\u5408\u4f5c\uff0c\u534f\u540c\u7684\u5bb9\u5668\u9700\u8981\u5728\u9002\u5f53\u7684\u8282\u70b9\u4e0a\u8fd0\u884c\uff08\u5982\u679corderer\u5168\u90e8\u5728\u540c\u4e00\u8282\u70b9\u4e0a\u8fd0\u884c\uff0c\u5219\u7f3a\u4e4f\u5bb9\u9519\u6027\uff1b\u5982\u679cpeer\u4f7f\u7528\u7684couchdb\u5728\u4e0d\u540c\u7684\u8282\u70b9\u4e0a\u8fd0\u884c\uff0c\u5219\u5728\u5ef6\u8fdf\u548c\u7f51\u7edc\u8d1f\u8f7d\u65b9\u9762\u90fd\u4e0d\u5408\u9002\uff09\u3002<br \/>\n\u56e0\u6b64\uff0c\u901a\u8fc7\u4f7f\u7528\u5f15\u5165\u4e8eversion3\u53ca\u4ee5\u540e\u7684yaml\u5b9a\u4e49\u4e2d\u7684deploy\u6307\u5b9a\uff0c\u53ef\u4ee5\u5c06\u534f\u540c\u7684\u5bb9\u5668\u96c6\u5408\u90e8\u7f72\u5230\u9002\u5f53\u7684\u8282\u70b9\u4e0a\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"na\">version<\/span><span class=\"pi\">:<\/span> <span class=\"s1\">'<\/span><span class=\"s\">3'<\/span>\r\n\r\n<span class=\"na\">networks<\/span><span class=\"pi\">:<\/span>\r\n  <span class=\"na\">fabric-sample-nw<\/span><span class=\"pi\">:<\/span>\r\n    <span class=\"na\">external<\/span><span class=\"pi\">:<\/span> <span class=\"no\">true<\/span>\r\n\r\n<span class=\"na\">services<\/span><span class=\"pi\">:<\/span>\r\n<span class=\"nn\">...<\/span>\r\n  <span class=\"na\">peer0<\/span><span class=\"pi\">:<\/span>\r\n    <span class=\"na\">hostname<\/span><span class=\"pi\">:<\/span> <span class=\"s\">peer0<\/span>\r\n    <span class=\"na\">image<\/span><span class=\"pi\">:<\/span> <span class=\"s\">localhost:5000\/fabric-payment-swarm\/fabric-peer<\/span>\r\n    <span class=\"na\">environment<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_VM_ENDPOINT=unix:\/\/\/host\/var\/run\/docker.sock<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_PEER_ID=peer0.org1.example.com<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_LOGGING_PEER=debug<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_CHAINCODE_LOGGING_LEVEL=DEBUG<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_PEER_LOCALMSPID=Org1MSP<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_PEER_MSPCONFIGPATH=\/etc\/hyperledger\/crypto-config\/peerOrganizations\/org1.example.com\/peers\/peer0.org1.example.com\/msp\/<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_PEER_ADDRESS=peer0:7051<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric-sample-nw<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_LEDGER_STATE_STATEDATABASE=CouchDB<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=<\/span>\r\n    <span class=\"na\">working_dir<\/span><span class=\"pi\">:<\/span> <span class=\"s\">\/etc\/hyperledger<\/span>\r\n    <span class=\"na\">command<\/span><span class=\"pi\">:<\/span> <span class=\"s\">peer node start<\/span>\r\n    <span class=\"na\">ports<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"m\">7051<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"m\">7053<\/span>\r\n    <span class=\"na\">volumes<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">\/var\/run\/docker.sock:\/host\/var\/run\/docker.sock<\/span>\r\n    <span class=\"na\">networks<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"pi\">-<\/span> <span class=\"s\">fabric-sample-nw<\/span>\r\n    <span class=\"na\">deploy<\/span><span class=\"pi\">:<\/span>\r\n      <span class=\"na\">replicas<\/span><span class=\"pi\">:<\/span> <span class=\"m\">1<\/span>\r\n      <span class=\"na\">placement<\/span><span class=\"pi\">:<\/span>\r\n        <span class=\"na\">constraints<\/span><span class=\"pi\">:<\/span>\r\n          <span class=\"pi\">-<\/span> <span class=\"s\">node.labels.type == node0<\/span>\r\n<span class=\"nn\">...<\/span>\r\n<\/code><\/pre>\n<h1>\u8ba9\u6211\u4eec\u5c1d\u8bd5\u4f7f\u7528Docker Swarm\u96c6\u7fa4\u5728\u5206\u5e03\u5f0f\u73af\u5883\u4e2d\u8fd0\u884c\u3002<\/h1>\n<p>\u8ba9\u6211\u4eec\u5728\u75314\u53f0VM\u4e0a\u7684node0~node3\u7ec4\u6210\u7684docker swarm\u96c6\u7fa4\u4e0a\u5206\u5e03\u5f0f\u8fd0\u884cHyperledger\/fabric\uff0c\u8003\u8651\u5230\u4e0a\u8ff0\u7684\u6ce8\u610f\u4e8b\u9879\u3002\u6211\u4eec\u5c06\u4f7f\u7528\u4ee5\u4e0b\u5bb9\u5668\u7ec4\u6765\u6784\u5efaHyperledger\/fabric\u7f51\u7edc\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d7b70913a08637a699456\/28-0.png\" alt=\"swarm.png\" \/><\/div>\n<h2>\u52a8\u7269\u56ed\u7ba1\u7406\u5458\u4e0e\u5361\u592b\u5361<\/h2>\n<p>\u4e3a\u4e86\u5728\u5206\u6563\u73af\u5883\u4e0b\u534f\u8c03orderer\u7684\u64cd\u4f5c\uff0c\u81f3\u5c11\u9700\u8981\u56db\u4e2akafka\u8282\u70b9\u548c\u4e09\u4e2a\u6216\u66f4\u591a\u5947\u6570\u4e2azookeeper\u8282\u70b9\u3002\uff08\u521b\u5efa\u57fa\u4e8eKafka\u7684\u8ba2\u8d2d\u670d\u52a1\uff09<\/p>\n<p>\u5728\u540c\u4e00\u8282\u70b9\u4e0a\u8fd0\u884c\u4e24\u4e2akafka\u662f\u6ca1\u6709\u5bb9\u9519\u610f\u4e49\u7684\uff0c\u6240\u4ee5\u5728\u5206\u5e03\u5f0f\u73af\u5883\u4e0b\u8fd0\u884cHyperledger\/fabric\u81f3\u5c11\u9700\u89814\u4e2a\u4ee5\u4e0a\u7684\u8282\u70b9\u3002<\/p>\n<h2>CA\u7684\u53ef\u7528\u6027<\/h2>\n<p>\u8fd9\u6b21\u7684Hyperledger\/fabric\u7f51\u7edc\u4e2d\uff0c\u8ba4\u8bc1\u673a\u6784\uff08ca\uff09\u6210\u4e3a\u4e86\u5355\u70b9\u6545\u969c\uff08SPOF\uff09\u3002\u4e0e\u53ef\u4ee5\u901a\u8fc7kafka\u548czookeeper\u8fdb\u884c\u5206\u5e03\u5f0f\u534f\u4f5c\u7684orderer\u4e0d\u540c\uff0c\u8ba4\u8bc1\u673a\u6784\u9700\u8981\u81ea\u884c\u5efa\u7acb\u9ad8\u53ef\u9760\u6027\u7684RDBMS\uff08PostgreSQL\u6216MySQL\uff09\u6216LDAP\u4f5c\u4e3a\u540e\u53f0\uff0c\u4ee5\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u548c\u6545\u969c\u8f6c\u79fb\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d7b70913a08637a699456\/34-0.png\" alt=\"fabric-ca.png\" \/><\/div>\n<p>\u7531\u4e8e\u6211\u5df2\u7ecf\u7b4b\u75b2\u529b\u5c3d\uff0c\u6240\u4ee5\u6211\u60f3\u5c06\u8ba4\u8bc1\u673a\u6784\u7684\u53ef\u7528\u6027\u653e\u5230\u53e6\u4e00\u4e2a\u673a\u4f1a\u3002<\/p>\n<h2>\u542f\u52a8Docker Swarm\u6a21\u5f0f\u96c6\u7fa4\u3002<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u79fb\u52a8\u5230node0\u7684swarm\u6a21\u5f0f\u76ee\u5f55\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/dev-solo$ cd ..\/swarm-kafka\/<\/p>\n<p>\u5728node0\u4e0a\u542f\u52a8swarm\u96c6\u7fa4\u3002<\/p>\n<p>\u7531\u4e8e\u6211\u4eec\u5728\u672c\u6b21\u9a8c\u8bc1\u7684VirtualboxVM\u4e0a\u5b89\u88c5\u4e862\u4e2a\u865a\u62df\u7f51\u5361\uff0c\u6240\u4ee5\u8981\u4f7f\u7528&#8211;advertise-addr\u6307\u5b9adocker swarm\u4f7f\u7528\u7684\u865a\u62df\u7f51\u5361\u7684IP\u5730\u5740\u3002<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker swarm init &#8211;advertise-addr 192.168.100.10<\/p>\n<p>\u6267\u884cdocker swarm init\u65f6\u4f1a\u663e\u793a\u7528\u4e8e\u5c06\u5176\u4ed6\u8282\u70b9\u6dfb\u52a0\u4e3aworker\u7684TOKEN\uff0c\u4f46\u672c\u6b21\u4e0d\u4f7f\u7528\u3002<\/p>\n<p>\u663e\u793a\u7528\u4e8e\u52a0\u5165swarm\u96c6\u7fa4\u4f5c\u4e3amaster\u7684TOKEN\u3002<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker swarm join-token manager<\/p>\n<p>\u5c06\u663e\u793a\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u547d\u4ee4\u5b57\u7b26\u4e32\uff1a<\/p>\n<p>docker swarm join &#8211;token SWMTKN-1-&#8230;.. 192.168.100.10:2377<\/p>\n<p>\u5728node1\u3001node2\u548cnode3\u4e0a\u5206\u522b\u6267\u884c3\u4e2d\u663e\u793a\u7684\u547d\u4ee4\uff0c\u5c06\u5b83\u4eec\u4f5c\u4e3amanager\u52a0\u5165swarm\u96c6\u7fa4\u3002<\/p>\n<p>ubuntu@node1:~$ docker swarm join &#8211;token SWMTKN-1-&#8230;&#8230; 192.168.100.10:2377<\/p>\n<p>ubuntu@node2:~$ docker swarm join &#8211;token SWMTKN-1-&#8230;&#8230; 192.168.100.10:2377<\/p>\n<p>ubuntu@node3:~$ docker swarm join &#8211;token SWMTKN-1-&#8230;&#8230; 192.168.100.10:2377<\/p>\n<p>\u7ed9\u6bcf\u4e2a\u8282\u70b9\u6dfb\u52a0\u6807\u7b7e\u3002<\/p>\n<p>\u4e3a\u4e86\u80fd\u591f\u5728yaml\u5b9a\u4e49\u4e2d\u6307\u5b9a\u8981\u5728\u54ea\u4e2a\u8282\u70b9\u4e0a\u542f\u52a8\u5bb9\u5668\uff0c\u6211\u4eec\u9700\u8981\u4e3a\u6bcf\u4e2a\u8282\u70b9\u6dfb\u52a0\u6807\u7b7e\u3002<\/p>\n<p>\u7531\u4e8e\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e3b\u673a\u540d\u6307\u5b9a\u7ea6\u675f\u6761\u4ef6\uff0c\u6240\u4ee5\u5728\u672c\u6b21\u9a8c\u8bc1\u4e2d\u5373\u4f7f\u4e0d\u6dfb\u52a0\u6807\u7b7e\u4e5f\u53ef\u4ee5\u8fd0\u884c\u3002<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker node ls<br \/>\nID HOSTNAME STATUS AVAILABILITY MANAGER STATUS<br \/>\nn8aex03epr54vk0js3i968j7e * node0 Ready Active Leader<br \/>\nklg2t4ho5v47osx7mckb2ngyt node1 Ready Active Reachable<br \/>\nkrwzoozg3l86l6ahvbhye5s8h node2 Ready Active Reachable<br \/>\nq31j94lguqvox13o5u84tsvvk node3 Ready Active Reachable<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker node update &#8211;label-add type=node0 n8aex03epr54vk0js3i968j7e<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker node update &#8211;label-add type=node1 klg2t4ho5v47osx7mckb2ngyt<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker node update &#8211;label-add type=node2 krwzoozg3l86l6ahvbhye5s8h<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker node update &#8211;label-add type=node3 q31j94lguqvox13o5u84tsvvk<\/p>\n<h2>\u5728swarm\u96c6\u7fa4\u4e2d\u542f\u52a8\u672c\u5730\u6ce8\u518c\u8868<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5728swarm\u96c6\u7fa4\u4e2d\u542f\u52a8\u672c\u5730\u6ce8\u518c\u8868\uff0c\u4ee5\u4fbf\u5728\u5206\u5e03\u5f0f\u73af\u5883\u7684\u5404\u4e2a\u8282\u70b9\u95f4\u5171\u4eab\u6784\u5efa\u7684Docker\u6620\u50cf\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker service create &#8211;name registry &#8211;publish 5000:5000 registry:2<\/p>\n<p>\u4e3a\u4e86\u751f\u6210\u5305\u542bHyperledger\/fabric\u7f51\u7edc\u7ba1\u7406\u8005\u4ee5\u5916\u7684\u4eba\u4e0d\u5e94\u77e5\u9053\u7684\u4fe1\u606f\uff08\u5982peer\u5bf9\u4ea4\u6613\u8fdb\u884c\u7b7e\u540d\u7684\u52a0\u5bc6\u5bc6\u94a5\uff09\u7684Docker\u6620\u50cf\uff0c\u6211\u4eec\u5c06\u5176\u6ce8\u518c\u5230\u672c\u5730\u6ce8\u518c\u8868\u4e2d\uff0c\u800c\u4e0d\u662f\u4f7f\u7528DockerHub\u7b49\u516c\u5171\u6ce8\u518c\u8868\u3002\u5982\u679c\u5df2\u7ecf\u5b58\u5728\u79c1\u6709\u7684Docker\u6ce8\u518c\u8868\u670d\u52a1\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8be5\u670d\u52a1\u3002<\/p>\n<h2>\u8bbe\u7f6eNFS<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5c06node0\u4e0a\u642d\u5efaNFS\u670d\u52a1\u5668\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>\u5728\u5206\u5e03\u5f0f\u73af\u5883\u4e0b\uff0c\u7531\u4e8eREST API\u5bb9\u5668\u9700\u8981\u5728\u591a\u4e2a\u8282\u70b9\u4e0a\u542f\u52a8\uff0c\u6240\u4ee5\u9700\u8981\u5728\u6bcf\u4e2aREST API\u5bb9\u5668\u4e0a\u5171\u4eab\u7528\u4e8e\u8fde\u63a5Hyperledger\/fabric\u7f51\u7edc\u8ba4\u8bc1\u673a\u6784\u7684\u5bc6\u94a5\u6587\u4ef6\u3002\u6b64\u5916\uff0c\u5728\u5c06peer\u52a0\u5165\u5230channel\u65f6\uff0c\u8fd8\u9700\u8981\u4f7f\u7528\u5728\u521b\u5efachannel\u65f6\u751f\u6210\u7684genesis\u6587\u4ef6\uff0c\u6240\u4ee5\u5982\u679c\u7531\u4e8e\u8282\u70b9\u6545\u969c\u7b49\u539f\u56e0\u4e22\u5931\u4e86genesis\u6587\u4ef6\uff0c\u5c06\u4f1a\u5bfc\u81f4\u65b0\u7684peer\u65e0\u6cd5\u52a0\u5165\u3002\u7531\u4e8e\u4e0a\u8ff0\u6587\u4ef6\u4e0d\u9700\u8981\u4e00\u76f4\u8fdb\u884c\u8bfb\u5199\u64cd\u4f5c\uff0c\u56e0\u6b64\u51b3\u5b9a\u4f7f\u7528NFS\u8fdb\u884c\u5171\u4eab\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5982\u679c\u5c06node0\uff08192.168.100.10\uff09\u4e0a\u7684\/opt\/nfs\/fabric-payment\u76ee\u5f55\u901a\u8fc7NFS\u8fdb\u884c\u5171\u4eab\uff1a<\/p>\n<p>\u5728node0\u4e0a\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5nfs-kernel-server\uff1a<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ sudo apt-get install nfs-kernel-server -y<\/p>\n<p>\u5728node0\u4e0a\u521b\u5efa\/opt\/nfs\/fabric-payment\/key_store\u548c\/opt\/nfs\/fabric-payment\/genesis_store\u76ee\u5f55\uff1a<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ sudo mkdir -p \/opt\/nfs\/fabric-payment\/key_store<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ sudo mkdir -p \/opt\/nfs\/fabric-payment\/genesis_store<\/p>\n<p>\u5728node0\u4e0a\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5c06\/opt\/nfs\/fabric-payment\u6dfb\u52a0\u5230\/etc\/exports\u6587\u4ef6\u4e2d\uff1a<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ sudo su -c &#8220;echo &#8216;\/opt\/nfs\/fabric-payment 192.168.100.0\/24(rw,sync,no_subtree_check,no_root_squash)&#8217; &gt;&gt; \/etc\/exports&#8221;<\/p>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5237\u65b0NFS\u5171\u4eab\u914d\u7f6e\uff1a<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ sudo exportfs -ra<\/p>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u91cd\u542fnfs-kernel-server\u670d\u52a1\uff1a<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ sudo systemctl restart nfs-kernel-server.service<\/p>\n<p>\u867d\u7136\u8fd9\u6b21\u662f\u5728node0\u4e0a\u5feb\u901f\u642d\u5efa\u4e86NFS\u670d\u52a1\u5668\uff0c\u4f46\u5982\u679c\u5df2\u7ecf\u6709\u8fd0\u884c\u4e2d\u7684NFS\u670d\u52a1\uff0c\u5219\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u73b0\u6709\u7684\u670d\u52a1\u3002<\/p>\n<p>\u5728node1~node3\u4e0a\u5b89\u88c5NFS\u5ba2\u6237\u7aef\u5e93\uff1a<\/p>\n<p>\u5728node1\u4e0a\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5nfs-common\uff1a<br \/>\nubuntu@node1:~$ sudo apt-get install nfs-common -y<\/p>\n<p>\u5728node2\u4e0a\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5nfs-common\uff1a<br \/>\nubuntu@node2:~$ sudo apt-get install nfs-common -y<\/p>\n<p>\u5728node3\u4e0a\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5nfs-common\uff1a<br \/>\nubuntu@node3:~$ sudo apt-get install nfs-common -y<\/p>\n<h2>\u5728swarm\u96c6\u7fa4\u4e0a\u542f\u52a8Hyperledger\/fabric\u7f51\u7edc<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u6839\u636e\u7b2c\u4e00\u6b65\u7684\u53c2\u8003\uff0c\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/ol>\n<\/li>\n<\/ol>\n<p>1. \u5b89\u88c5Docker<br \/>\n2. \u4eceGitHub\u4e0a\u514b\u9686fabric-payment-sample-docker\u548cfabric-payment-sample-api<br \/>\n3. \u4f7f\u7528go get\u514b\u9686chaincode<br \/>\n4. \u751f\u6210REST API\u5e94\u7528\u7684Bearer\u4ee4\u724c\u5e76\u751f\u6210Docker\u955c\u50cf<\/p>\n<p>\u5728fabric-payment-sample-docker\/swarm-kafka\u4e2d\u83b7\u53d6Hyperledger\/fabric 1.1.0-rc1\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u548cDocker\u955c\u50cf<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ curl -sSL https:\/\/goo.gl\/6wtTN5 | bash -s 1.1.0-rc1<\/p>\n<p>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u540e\uff0c\u751f\u6210Hyperledger\/fabric\u6240\u9700\u7684\u5bc6\u94a5\u548cfabric\u7f51\u7edc\u914d\u7f6e\u7b49\u7684artifact<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ source .env<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ export CA_ADMIN_PASSWORD=&lt;&lt;\u4efb\u610f\u7684\u5b57\u7b26\u4e32&gt;&gt;<br \/>\nubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ .\/generate_artifact.sh ${CA_ADMIN_PASSWORD} &lt;&lt;NFS\u670d\u52a1\u5668\u7684IP&gt;&gt; &lt;&lt;\u5171\u4eab\u76ee\u5f55&gt;&gt;<\/p>\n<p>\u4e0e\u5355\u72ec\u7684Docker\u4e0d\u540c\uff0c\u9700\u8981\u63d0\u4f9bNFS\u7684\u8bbe\u7f6e\u53c2\u6570\u3002<\/p>\n<p>generate_artifact.sh\u4f1a\u751f\u6210\u4e00\u4e2a\u5305\u542b\u4e86\u9488\u5bf9\u6bcf\u4e2a\u73af\u5883\u4e0d\u540c\u53d8\u91cf\u7684docker-compose.yaml\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u4e5f\u5b9a\u4e49\u4e86\u4f7f\u7528NFS\u5171\u4eab\u5377\u7684\u8bbe\u7f6e\u3002<\/p>\n<p>\u751f\u6210\u7684docker image\u5305\u542b\u4e86\u81ea\u52a8\u751f\u6210\u7684\u6bcf\u4e2a\u5bb9\u5668\u6240\u9700\u7684\u7528\u4e8e\u7b7e\u540d\u7684\u5bc6\u94a5\u3001chaincode\u548cREST API\u7684\u6e90\u4ee3\u7801\uff0c\u5e76\u6ce8\u518c\u5230\u672c\u5730\u4ed3\u5e93\u4e2d\u3002\u8be6\u7ec6\u5185\u5bb9\u8bf7\u67e5\u770bDockerfile\u3002<\/p>\n<p>\u5728\u5206\u5e03\u5f0f\u73af\u5883\u4e2d\u542f\u52a8Hyperledger\/fabric\u7f51\u7edc<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ .\/start_fabric.sh<\/p>\n<p>\u4e0e\u5355\u72ec\u7684Docker\u4e0d\u540c\uff0c\u8981\u5728swarm\u73af\u5883\u4e2d\u5c06\u5bb9\u5668\u5206\u5e03\u5230\u591a\u4e2a\u8282\u70b9\u4e0a\u542f\u52a8\uff0c\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728start_fabric.sh\u4e2d\u5df2\u5305\u542b\u7b49\u5f85\u5bb9\u5668\u542f\u52a8\u7684\u64cd\u4f5c\u3002\u8bf7\u786e\u8ba4\u6240\u6709\u5bb9\u5668\u90fd\u5df2\u542f\u52a8\uff08CURRENT STATE\u4e3aRunning\uff09\u3002<\/p>\n<p>\u7279\u522b\u662f\u7b2c\u4e00\u6b21\uff0c\u7531\u4e8e\u6bcf\u4e2a\u8282\u70b9\u90fd\u9700\u8981\u4ece\u672c\u5730\u4ed3\u5e93\u62c9\u53d6docker image\uff0c\u6240\u4ee5\u5728zookeeper\u548ckafka\u4e0d\u5b58\u5728\u7684\u60c5\u51b5\u4e0b\u5c1d\u8bd5\u542f\u52a8orderer\u65f6\u53ef\u80fd\u4f1a\u5931\u8d25\u3002<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker stack ps zookeeper<br \/>\nID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS<br \/>\njjn0hqts9w3t zookeeper_zookeeper2.1 localhost:5000\/hyperledger\/fabric-zookeeper:latest node2 Running Running about a minute ago<br \/>\nwwtfc54krest zookeeper_zookeeper1.1 localhost:5000\/hyperledger\/fabric-zookeeper:latest node1 Running Running about a minute ago<br \/>\n6pl9wohamgfl zookeeper_zookeeper0.1 localhost:5000\/hyperledger\/fabric-zookeeper:latest node0 Running Running about a minute ago<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker stack ps kafka<br \/>\nID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS<br \/>\nab0y5b66esy4 kafka_kafka1.1 localhost:5000\/hyperledger\/fabric-kafka:latest node1 Running Running about a minute ago<br \/>\nf65rcxrzou10 kafka_kafka0.1 localhost:5000\/hyperledger\/fabric-kafka:latest node0 Running Running about a minute ago<br \/>\n355ff4e4j0rf kafka_kafka3.1 localhost:5000\/hyperledger\/fabric-kafka:latest node3 Running Running about a minute ago<br \/>\n123u0483b4lh kafka_kafka2.1 localhost:5000\/hyperledger\/fabric-kafka:latest node2 Running Running about a minute ago<\/p>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ docker stack ps ${STACK_NAME}<br \/>\nID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS<br \/>\nkrfhlqfh3vvz fabric-payment_cli.krwzoozg3l86l6ahvbhye5s8h localhost:5000\/fabric-payment-swarm\/fabric-tools:latest node2 Running Running 38 seconds ago<br \/>\n1ctlrvha8ecv fabric-payment_cli.q31j94lguqvox13o5u84tsvvk localhost:5000\/fabric-payment-swarm\/fabric-tools:latest node3 Running Running 36 seconds ago<br \/>\nwcww4fuohsdi fabric-payment_cli.klg2t4ho5v47osx7mckb2ngyt localhost:5000\/fabric-payment-swarm\/fabric-tools:latest node1 Running Running 3 minutes ago<br \/>\nl9wp44p2mfub fabric-payment_cli.n8aex03epr54vk0js3i968j7e localhost:5000\/fabric-payment-swarm\/fabric-tools:latest node0 Running Running 3 minutes ago<br \/>\ntu1jc0fb1<\/p>\n<p>\u6ce8\u610f<\/p>\n<p>chaincode\u306e\u521d\u671f\u5316\u3092\u884c\u3063\u305fpeer\uff08\u4eca\u56de\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306fpeer0\uff09\u4ee5\u5916\u306eREST API\u306f\u3001\u521d\u56de\u547c\u3073\u51fa\u3057\u306b\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002\u3053\u308c\u306fJustInTime\u3067\u65b0\u305f\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u7528\u30b3\u30f3\u30c6\u30ca\u3092\u7acb\u3061\u4e0a\u3052\u3066peer\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308bchaincode\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3001\u305d\u306e\u5f8cchaincode\u7528\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u7acb\u3061\u4e0a\u3052\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u521d\u56de\u547c\u3073\u51fa\u3057\u306e\u524d\u5f8c\u3067 docker ps \u3067\u30b3\u30f3\u30c6\u30ca\u30ea\u30b9\u30c8\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001 dev-peer1.org1.example.com-fabric-payment-0.1-&#8230;.. \u306e\u3088\u3046\u306a\u540d\u524d\u306echaincode\u7528\u30b3\u30f3\u30c6\u30ca\u304c\u5897\u3048\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<h2>\u786e\u8ba4Hyperledger\/fabric\u7684\u5206\u5e03\u5f0f\u5904\u7406<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5728\u5176\u4ed6\u8282\u70b9\u4e0a\u9a8c\u8bc1\u6ce8\u518c\u7684\u8d26\u6237\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>\u5bf9\u4e8e\u5355\u72ec\u7684docker\u60c5\u51b5\uff0c\u53ef\u4f7f\u7528\u76f8\u540c\u7684REST API\u3002<\/p>\n<p>\u8fd0\u884c\u5728node0\u4e0a\u7684REST API\u7684\u7aef\u53e3\u662f3000\u3002\u540c\u6837\uff0cnode1\u662f3001\uff0cnode2\u662f3002\uff0cnode3\u662f3003\u3002<\/p>\n<p>\u7531\u4e8e\u4f7f\u7528\u4e86docker\u7684overlay\u7f51\u7edc\uff0c\u865a\u62df\u7f51\u7edc\u5f97\u4ee5\u6269\u5c55\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u8282\u70b9\u7684REST API\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4ecenode0\u542f\u52a8\u8fde\u63a5\u5230node1\u4e0a\u7684REST API\uff08\u7aef\u53e33001\uff09\u3002<\/p>\n<p>\u793a\u4f8b\uff09\u5728node0\u4e0a\u6ce8\u518c\u8d26\u6237<br \/>\nubuntu@node0:~$ cat ${API_PATH}\/api\/.config\/token.json | jq .token -r<br \/>\n4302E85F23783F132740B8A701B93534<br \/>\nubuntu@node0:~$ curl -H &#8220;Content-Type: application\/json&#8221; -H &#8220;Authorization: Bearer 4302E85F23783F132740B8A701B93534&#8221; http:\/\/localhost:3000\/fabric-payment\/accounts\/ -X POST -d &#8216;{&#8220;name&#8221;:&#8221;\u307b\u3052&#8221;}&#8217; | jq .<br \/>\n{<br \/>\n&#8220;model_type&#8221;: &#8220;account&#8221;,<br \/>\n&#8220;no&#8221;: &#8220;6107511000263813&#8221;,<br \/>\n&#8220;name&#8221;: &#8220;\u307b\u3052&#8221;,<br \/>\n&#8220;balance&#8221;: 0<br \/>\n}<\/p>\n<p>\u793a\u4f8b\uff09\u5728node1\u4e0a\u83b7\u53d6\u8d26\u6237\u5217\u8868<br \/>\nubuntu@node1:~$ curl -H &#8220;Content-Type: application\/json&#8221; -H &#8220;Authorization: Bearer 4302E85F23783F132740B8A701B93534&#8221; http:\/\/localhost:3001\/fabric-payment\/accounts\/ | jq .<br \/>\n[<br \/>\n{<br \/>\n&#8220;model_type&#8221;: &#8220;account&#8221;,<br \/>\n&#8220;no&#8221;: &#8220;6107511000263813&#8221;,<br \/>\n&#8220;name&#8221;: &#8220;\u307b\u3052&#8221;,<br \/>\n&#8220;balance&#8221;: 0<br \/>\n}<br \/>\n]<\/p>\n<p>\u901a\u8fc7\u4e00\u4e2aAPI\u8282\u70b9\u6ce8\u518c\u6216\u66f4\u65b0\u7684\u4fe1\u606f\u5c06\u88ab\u4f20\u9012\u7ed9Hyperledger\/fabric\u7f51\u7edc\u4e2d\u7684\u6240\u6709\u5bf9\u7b49\u8282\u70b9\u3002\u56e0\u6b64\uff0c\u5728\u63d0\u4ea4\u6210\u529f\u540e\uff0c\u53ef\u4ee5\u968f\u65f6\u4ece\u53e6\u4e00\u4e2a\u8282\u70b9\u7684REST API\u4e2d\u67e5\u8be2\u5230\u5b9e\u65f6\u6570\u636e\u3002<\/p>\n<h2>\u786e\u8ba4Hyperledger\/fabric\u7684\u6545\u969c\u6062\u590d\u3002<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u8282\u70b90\u53d1\u751f\u6545\u969c\uff0c\u4e0eHyperledger\/fabric\u7f51\u7edc\u65ad\u5f00\u8fde\u63a5\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>\u505c\u6b62\u8282\u70b90\u7684docker\u8fdb\u7a0b\u540e\uff0c\u8282\u70b90\u5c06\u88ab\u4ece\u96c6\u7fa4\u4e2d\u6392\u9664\u3002\u65b0\u7684Leader\u8282\u70b9\u5c06\u88ab\u9009\u51fa\uff0c\u96c6\u7fa4\u5c06\u5728\u8282\u70b91\u81f3\u8282\u70b93\u4e0a\u7ee7\u7eed\u8fd0\u884c\u3002<\/p>\n<p>ubuntu@node0:~$ sudo systemctl stop docker.service<\/p>\n<p>ubuntu@node1:~$ docker node ls<br \/>\nID HOSTNAME STATUS AVAILABILITY MANAGER STATUS<br \/>\nn8aex03epr54vk0js3i968j7e node0 Down Active Unreachable<br \/>\nklg2t4ho5v47osx7mckb2ngyt * node1 Ready Active Reachable<br \/>\nkrwzoozg3l86l6ahvbhye5s8h node2 Ready Active Leader<br \/>\nq31j94lguqvox13o5u84tsvvk node3 Ready Active Reachable<\/p>\n<p>\u6dfb\u52a0\u8d26\u6237\u3002<\/p>\n<p>\u5373\u4f7f\u51fa\u73b0\u4e00\u4e2a\u8282\u70b9\u5b95\u673a\uff0cHyperledger\/fabric\u7f51\u7edc\u4ecd\u7136\u5728\u8fd0\u884c\u3002\u6211\u4eec\u5c1d\u8bd5\u5728\u8282\u70b93\u4e0a\u6dfb\u52a0\u53e6\u4e00\u4e2a\u8d26\u6237\u3002<\/p>\n<p>ubuntu@node3:~$ curl -H &#8220;Content-Type: application\/json&#8221; -H &#8220;Authorization: Bearer 4302E85F23783F132740B8A701B93534&#8221; http:\/\/localhost:3003\/fabric-payment\/accounts\/ -X POST -d &#8216;{&#8220;name&#8221;:&#8221;\u3075\u304c&#8221;}&#8217; | jq .<br \/>\n{<br \/>\n&#8220;model_type&#8221;: &#8220;account&#8221;,<br \/>\n&#8220;no&#8221;: &#8220;9962914372253968&#8221;,<br \/>\n&#8220;name&#8221;: &#8220;\u3075\u304c&#8221;,<br \/>\n&#8220;balance&#8221;: 0<br \/>\n}<\/p>\n<p>ubuntu@node3:~$ curl -H &#8220;Content-Type: application\/json&#8221; -H &#8220;Authorization: Bearer 4302E85F23783F132740B8A701B93534&#8221; http:\/\/localhost:3003\/fabric-payment\/accounts\/ | jq .<br \/>\n[<br \/>\n{<br \/>\n&#8220;model_type&#8221;: &#8220;account&#8221;,<br \/>\n&#8220;no&#8221;: &#8220;6107511000263813&#8221;,<br \/>\n&#8220;name&#8221;: &#8220;\u307b\u3052&#8221;,<br \/>\n&#8220;balance&#8221;: 0<br \/>\n},<br \/>\n{<br \/>\n&#8220;model_type&#8221;: &#8220;account&#8221;,<br \/>\n&#8220;no&#8221;: &#8220;9962914372253968&#8221;,<br \/>\n&#8220;name&#8221;: &#8220;\u3075\u304c&#8221;,<br \/>\n&#8220;balance&#8221;: 0<br \/>\n}<br \/>\n]<\/p>\n<p>\u6062\u590d\u8282\u70b90\u7684\u6545\u969c\u3002<\/p>\n<p>\u5f53\u8282\u70b90\u6062\u590d\u6545\u969c\u65f6\uff0cswarm\u96c6\u7fa4\u5c06\u68c0\u6d4b\u5230\u5e76\u81ea\u52a8\u52a0\u5165swarm\u96c6\u7fa4\u3002\u4e4b\u524d\u964d\u7ea7\u7684stack\u4e5f\u4f1a\u6062\u590d\uff0c\u5e76\u4e14\u6240\u9700\u7684\u5bb9\u5668\u5c06\u81ea\u52a8\u5728\u8282\u70b90\u4e0a\u542f\u52a8\u3002<\/p>\n<p>\u6545\u969c\u6062\u590d\u540e\uff1a<br \/>\nubuntu@node0:~$ sudo systemctl start docker.service<br \/>\nubuntu@node0:~$ docker ps<br \/>\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES<\/p>\n<p>\u81ea\u52a8\u56de\u5f52\u5230swarm\u96c6\u7fa4\u4e4b\u540e\uff1a<br \/>\nubuntu@node0:~$ docker node ls<br \/>\nID HOSTNAME STATUS AVAILABILITY MANAGER STATUS<br \/>\n6k32ss9rdtfe6c0e0m6xf979y * node0 Ready Active Reachable<br \/>\n62retjrvcwkeky1q0mqveojvj node1 Ready Active Reachable<br \/>\nizk1hvipbfuhoedhdx6dmh5ri node2 Ready Active Leader<br \/>\n09w52jcgw2u4g5mjt0t1qe39b node3 Ready Active Reachable<\/p>\n<p>ubuntu@node0:~$ docker ps<br \/>\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES<br \/>\n0ec086151a3f localhost:5000\/fabric-payment-swarm\/api:latest &#8220;npm start&#8221; 49 seconds ago Up 35 seconds fabric-payment_api0.1.swhbo2iqrwgphku8mcson7nbq<br \/>\nb566619f22e0 localhost:5000\/fabric-payment-swarm\/fabric-ca:latest &#8220;sh -c &#8216;fabric-ca-se\u2026&#8221; 49 seconds ago Up 33 seconds 7054\/tcp fabric-payment_ca.1.p29wism0liy4b0iuud8qkamfs<br \/>\n313356c1b5a9 localhost:5000\/hyperledger\/fabric-zookeeper:latest &#8220;\/docker-entrypoint.\u2026&#8221; 49 seconds ago Up 33 seconds 2181\/tcp, 2888\/tcp, 3888\/tcp zookeeper_zookeeper0.1.390um287fl0eywo1gdeu0v4wp<br \/>\n88f896299029 localhost:5000\/fabric-payment-swarm\/fabric-orderer:latest &#8220;orderer&#8221; 49 seconds ago Up 32 seconds 7050\/tcp fabric-payment_orderer0.1.ogyc9a76hkwntx18vr6qgyhix<br \/>\ne916f36bc41e localhost:5000\/fabric-payment-swarm\/fabric-peer:latest &#8220;peer node start&#8221; 49 seconds ago Up 36 seconds fabric-payment_peer0.1.huz6q7x4763ky3jjtdlnqcohc<br \/>\n4e6a18cce499 localhost:5000\/hyperledger\/fabric-kafka:latest &#8220;\/docker-entrypoint.\u2026&#8221; 50 seconds ago Up 32 seconds 9092-9093\/tcp kafka_kafka0.1.vqvd3el46ce23l87jauhu0sbf<br \/>\neef8f7db4258 localhost:5000\/fabric-payment-swarm\/fabric-tools:latest &#8220;\/bin\/bash&#8221; 50 seconds ago Up 37 seconds fabric-payment_cli.yufr9amrmtml1b1owsvmnkb2z.k5p5vub6k3y8vtkh0jhp4msok<br \/>\nb56170b724e6 localhost:5000\/hyperledger\/fabric-couchdb:latest &#8220;tini &#8212; \/docker-ent\u2026&#8221; 51 seconds ago Up 29 seconds 4369\/tcp, 5984\/tcp, 9100\/tcp fabric-payment_couchdb0.1.tu2qy3xbiads9bez5yhqt1ecu<\/p>\n<p>\u8282\u70b90\u7684\u5bb9\u5668\u52a0\u5165Hyperledger\/fabric\u7f51\u7edc\u3002<\/p>\n<p>\u9057\u61be\u7684\u662f\uff0c\u65e0\u6cd5\u81ea\u52a8\u6062\u590d\u5230Hyperledger\/fabric\u7f51\u7edc\u3002\u5fc5\u987b\u52a0\u5165\u6b63\u5728\u8fd0\u884c\u7684\u901a\u9053\u5e76\u5b89\u88c5chaincode\u3002<br \/>\n1\uff09\u5b9a\u4e49\u53d8\u91cf<\/p>\n<p>ubuntu@node0:~$ ORDERER_ADDRESS=&#8221;orderer0:7050&#8243;<br \/>\nubuntu@node0:~$ PEER_ADDRESS=&#8221;peer0:7051&#8243;<br \/>\nubuntu@node0:~$ LOCALMSPID=&#8221;Org1MSP&#8221;<br \/>\nubuntu@node0:~$ PEER_MSPCONFIGPATH=&#8221;\/etc\/hyperledger\/crypto-config\/peerOrganizations\/org1.example.com\/users\/Admin@org1.example.com\/msp&#8221;<br \/>\nubuntu@node0:~$ CHANNEL_NAME=&#8221;fabric-sample&#8221;<br \/>\nubuntu@node0:~$ CHAINCODE_SRC=&#8221;github.com\/nmatsui\/fabric-payment-sample-chaincode&#8221;<br \/>\nubuntu@node0:~$ CHAINCODE_VERSION=&#8221;0.1&#8243;<br \/>\nubuntu@node0:~$ CLI=$(docker ps -f name=fabric-payment_cli -q)<\/p>\n<p>2\uff09\u4ecenfs\u4e2d<\/p>\n<h2>\u7ed3\u675fHyperledger\/Fabric\u7684\u7f51\u7edc\u3002<\/h2>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5173\u95edHyperledger\/fabric\u7f51\u7edc\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>ubuntu@node0:~\/fabric-payment-sample-docker\/swarm-kafka$ .\/terminate.sh &lt;&lt;NFS\u670d\u52a1\u5668\u7684IP&gt;&gt; &lt;&lt;\u5171\u4eab\u76ee\u5f55&gt;&gt;<\/p>\n<p>\u4e0e\u5355\u72ec\u4f7f\u7528Docker\u4e0d\u540c\uff0c\u9700\u8981\u5728\u53c2\u6570\u4e2d\u63d0\u4f9bNFS\u8bbe\u7f6e\u3002<\/p>\n<p>\u5728\u672c\u6b21\u811a\u672c\u548c\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0chyperledger\/fabric\u7684\u8ba4\u8bc1\u673a\u6784\u4fe1\u606f\u4f1a\u5728\u5bb9\u5668\u5220\u9664\u65f6\u4e00\u540c\u6d88\u5931\u3002\u56e0\u6b64\uff0c\u5982\u679c\u8ba4\u8bc1\u5bc6\u94a5\u6587\u4ef6\u4ecd\u7136\u5b58\u5728\uff0c\u5f53\u518d\u6b21\u542f\u52a8Hyperledger\/fabric\u7f51\u7edc\u65f6\u4f1a\u53d1\u751f\u8ba4\u8bc1\u9519\u8bef\u3002\u4e3a\u4e86\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\u53d1\u751f\uff0c\u5728terminate.sh\u4e2d\u5220\u9664\u4e86\u5b58\u50a8\u5728NFS\u4e2d\u7684\u5bc6\u94a5\u6587\u4ef6\u3002<\/p>\n<p>\u5728node1\u7684docker\u4e2d\uff0c\u53ef\u80fd\u4f1a\u6b8b\u7559\u4e00\u4e9b\u5df2\u505c\u6b62\u4f46\u672a\u5220\u9664\u7684\u5bb9\u5668\u3002\u8fd9\u662f\u56e0\u4e3a\u672a\u53d7swarm stack\u7ba1\u7406\u7684\u5bb9\u5668\uff0c\u5982chaincode\u5bb9\u5668\u7b49\uff0c\u5728\u5220\u9664stack\u540e\u65e0\u6cd5\u5220\u9664\u3002<\/p>\n<h1>\u6700\u540e<\/h1>\n<p>\u6211\u5728docker swarm\u96c6\u7fa4\u4e0a\u6210\u529f\u5730\u5206\u6563\u8fd0\u884c\u4e86Hyperledger\/fabric\u7f51\u7edc\uff0c\u4e00\u5207\u987a\u5229\u3002\u5982\u679c\u6709\u65f6\u95f4\uff0c\u6211\u4e5f\u60f3\u5728kubernetes\u4e0a\u5c1d\u8bd5\u4e00\u4e0b\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u662f\u5173\u4e8e\u4f7f\u7528\u5f00\u6e90\u8f6f\u4ef6\uff08OSS\uff09\u5206\u5e03\u5f0f\u8d26\u672c\u6280\u672fHyperledger\/fabric\u521b\u5efa\u7b80\u5355\u7684\u5b58\u53d6\u6b3e\u5904\u7406\uff0c\u5e76\u5c1d\u8bd5 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-46881","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26hyperledger-fabric\u5728docker-swarm\u4e0a\u8fdb\u884c\u5206\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u662f\u5173\u4e8e\u4f7f\u7528\u5f00\u6e90\u8f6f\u4ef6\uff08OSS\uff09\u5206\u5e03\u5f0f\u8d26\u672c\u6280\u672fHyperledger\/fabric\u521b\u5efa\u7b80\u5355\u7684\u5b58\u53d6\u6b3e\u5904\u7406\uff0c\u5e76\u5c1d\u8bd5 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26hyperledger-fabric\u5728docker-swarm\u4e0a\u8fdb\u884c\u5206\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-03T04:17:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-03T15:55:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d7b70913a08637a699456\/28-0.png\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/\",\"name\":\"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-02-03T04:17:37+00:00\",\"dateModified\":\"2024-05-03T15:55:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26hyperledger-fabric\u5728docker-swarm\u4e0a\u8fdb\u884c\u5206\/","og_locale":"zh_CN","og_type":"article","og_title":"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248","og_description":"\u672c\u6587\u662f\u5173\u4e8e\u4f7f\u7528\u5f00\u6e90\u8f6f\u4ef6\uff08OSS\uff09\u5206\u5e03\u5f0f\u8d26\u672c\u6280\u672fHyperledger\/fabric\u521b\u5efa\u7b80\u5355\u7684\u5b58\u53d6\u6b3e\u5904\u7406\uff0c\u5e76\u5c1d\u8bd5 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26hyperledger-fabric\u5728docker-swarm\u4e0a\u8fdb\u884c\u5206\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-02-03T04:17:37+00:00","article_modified_time":"2024-05-03T15:55:43+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d7b70913a08637a699456\/28-0.png"}],"author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/","name":"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-02-03T04:17:37+00:00","dateModified":"2024-05-03T15:55:43+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u8ba9\u6211\u4eec\u6765\u8bd5\u7740\u5c06\u5206\u5e03\u5f0f\u5206\u7c7b\u8d26Hyperledger\/fabric\u5728docker swarm\u4e0a\u8fdb\u884c\u5206\u5e03\u5f0f\u90e8\u7f72\uff083\/3\uff09\u301c\u5206\u5e03\u5f0f\u73af\u5883\u89e3\u91ca\u7248"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%ae%a9%e6%88%91%e4%bb%ac%e6%9d%a5%e8%af%95%e7%9d%80%e5%b0%86%e5%88%86%e5%b8%83%e5%bc%8f%e5%88%86%e7%b1%bb%e8%b4%a6hyperledger-fabric%e5%9c%a8docker-swarm%e4%b8%8a%e8%bf%9b%e8%a1%8c%e5%88%86\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/46881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=46881"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/46881\/revisions"}],"predecessor-version":[{"id":94870,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/46881\/revisions\/94870"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=46881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=46881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=46881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}