{"id":433384,"date":"2021-04-18T15:39:32","date_gmt":"2021-04-18T07:39:32","guid":{"rendered":"http:\/\/4563.org\/?p=433384"},"modified":"2021-04-18T15:39:32","modified_gmt":"2021-04-18T07:39:32","slug":"%e9%9b%86%e7%be%a4%e9%80%9a%e4%bf%a1%ef%bc%9a%e4%bb%8e%e5%bf%83%e8%b7%b3%e8%af%b4%e8%b5%b7","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=433384","title":{"rendered":"\u96c6\u7fa4\u901a\u4fe1\uff1a\u4ece\u5fc3\u8df3\u8bf4\u8d77"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u96c6\u7fa4\u901a\u4fe1\uff1a\u4ece\u5fc3\u8df3\u8bf4\u8d77               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NebulaGraph <\/span>  <span><i><\/i> 10<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u200b&gt; \u672c\u6587\u9996\u53d1 Nebula Graph \u5b98\u7f51\uff1ahttps:\/\/nebula-graph.com.cn\/posts\/cluster-communication-heartbeat\/<\/p>\n<p>\u5728\u7528\u6237\u4f7f\u7528 Nebula Graph \u7684\u8fc7\u7a0b\u4e2d\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u5404\u79cd\u95ee\u9898\uff0c\u901a\u5e38\u6211\u4eec\u90fd\u4f1a\u5efa\u8bae\u5148\u901a\u8fc7 <code>show hosts<\/code> \u67e5\u770b\u96c6\u7fa4\u72b6\u6001\u3002\u53ef\u4ee5\u8bf4\uff0c\u6574\u4e2a Nebula Graph \u7684\u96c6\u7fa4\u72b6\u6001\u90fd\u662f\u9760\u5fc3\u8df3\u673a\u5236\u6765\u6784\u5efa\u7684\u3002\u672c\u6587\u5c06\u4ece\u5fc3\u8df3\u8bf4\u8d77\uff0c\u5e2e\u52a9\u4f60\u4e86\u89e3 Nebula Graph \u96c6\u7fa4\u5404\u4e2a\u8282\u70b9\u4e4b\u95f4\u901a\u4fe1\u7684\u673a\u5236\u3002<\/p>\n<h2>\u4ec0\u4e48\u662f\u5fc3\u8df3\uff1f\u6709\u4ec0\u4e48\u4f5c\u7528\uff1f<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/04\/20210419_607cdc7aa0f2f.png\" alt=\"\u96c6\u7fa4\u901a\u4fe1\uff1a\u4ece\u5fc3\u8df3\u8bf4\u8d77\" \/><\/p>\n<p>Nebula Graph \u96c6\u7fa4\u4e00\u822c\u5305\u542b\u4e09\u79cd\u8282\u70b9\uff0cgraphd \u4f5c\u4e3a\u67e5\u8be2\u8282\u70b9\uff0cstoraged \u4f5c\u4e3a\u5b58\u50a8\u8282\u70b9\uff0cmetad \u4f5c\u4e3a\u5143\u4fe1\u606f\u8282\u70b9\u3002\u672c\u6587\u8bf4\u7684\u5fc3\u8df3\uff0c\u4e3b\u8981\u662f\u6307 graphd \u548c storaged \u5b9a\u671f\u5411 metad \u4e0a\u62a5\u4fe1\u606f\u7684\u8fd9\u4e2a\u5fc3\u8df3\uff0c\u501f\u52a9\u5fc3\u8df3\uff0c\u6574\u4e2a\u96c6\u7fa4\u5b8c\u6210\u4e86\u4ee5\u4e0b\u529f\u80fd\u3002\uff08\u76f8\u5173\u53c2\u6570\u662f <code>heartbeat_interval_secs<\/code>\uff09<\/p>\n<blockquote>\n<p>\u5728 Nebula Graph \u4e2d\u7ecf\u5e38\u63d0\u53ca\u7684 raft \u5fc3\u8df3\u5219\u662f\u7528\u4e8e\u62e5\u6709\u540c\u4e00\u4e2a partition \u7684\u591a\u4e2a storaged \u4e4b\u95f4\u7684\u5fc3\u8df3\uff0c\u548c\u672c\u6587\u63d0\u7684\u5fc3\u8df3\u5e76\u4e0d\u76f8\u540c\u3002<\/p>\n<\/blockquote>\n<h3>1. \u670d\u52a1\u53d1\u73b0<\/h3>\n<p>\u5f53\u6211\u4eec\u542f\u52a8\u4e00\u4e2a Nebula Graph \u96c6\u7fa4\u65f6\uff0c\u9700\u8981\u5728\u5bf9\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u586b\u5199 <code>meta_server_addrs<\/code>\u3002graphd \u548c storaged \u5728\u542f\u52a8\u4e4b\u540e\uff0c\u5c31\u4f1a\u901a\u8fc7\u8fd9\u4e2a <code>meta_server_addrs<\/code> \u5730\u5740\uff0c\u5411\u5bf9\u5e94\u7684 metad \u53d1\u9001\u5fc3\u8df3\u3002\u901a\u5e38\u6765\u8bf4\uff0cgraphd \u548c storaged \u5728\u8fde\u63a5\u4e0a metad \u524d\u662f\u65e0\u6cd5\u5bf9\u5916\u8fdb\u884c\u670d\u52a1\u7684\u3002\u5f53 metad \u6536\u5230\u5fc3\u8df3\u540e\uff0c\u4f1a\u4fdd\u5b58\u76f8\u5173\u4fe1\u606f\uff08\u89c1\u4e0b\u6587\u7b2c 2 \u70b9\uff09\uff0c\u6b64\u65f6\u5c31\u80fd\u591f\u901a\u8fc7 show hosts \u770b\u5230\u5bf9\u5e94\u7684 storaged \u8282\u70b9\uff0c\u5728 2.x \u7248\u672c\u4e2d\uff0c\u4e5f\u80fd\u591f\u901a\u8fc7 <code>show hosts graph<\/code> \u770b\u5230 graphd \u8282\u70b9\u3002<\/p>\n<h3>2. \u4e0a\u62a5\u8282\u70b9\u4fe1\u606f<\/h3>\n<p>\u5728 metad \u6536\u5230\u5fc3\u8df3\u65f6\uff0c\u4f1a\u5c06\u5fc3\u8df3\u4e2d\u7684 ip \u3001port \u3001\u8282\u70b9\u7c7b\u578b\u3001\u5fc3\u8df3\u65f6\u95f4\u7b49\u7b49\u4fe1\u606f\u4fdd\u5b58\uff0c\u4ee5\u4f9b\u540e\u7eed\u4f7f\u7528\uff08\u89c1\u4e0b\u6587\uff09\u3002<\/p>\n<p>\u9664\u6b64\u4ee5\u5916 storaged \u5728\u81ea\u8eab leader \u6570\u91cf\u53d8\u5316\u7684\u65f6\u5019\u4e5f\u4f1a\u4e0a\u62a5 leader \u4fe1\u606f\uff0c\u5728 <code>show hosts<\/code> \u4e2d\u770b\u5230\u7684 Leader count \u548c Leader distribution \u5c31\u662f\u901a\u8fc7\u5fc3\u8df3\u6c47\u62a5\u7684\u3002<\/p>\n<h3>3. \u66f4\u65b0\u5143\u4fe1\u606f<\/h3>\n<p>\u5f53\u5ba2\u6237\u901a\u8fc7 console \u6216\u8005\u5404\u79cd\u5ba2\u6237\u7aef\uff0c\u5bf9\u96c6\u7fa4\u7684\u5143\u4fe1\u606f\u8fdb\u884c\u66f4\u6539\u4e4b\u540e\uff08\u4f8b\u5982 <code>create\/drop space<\/code>\u3001<code>create\/alter\/drop tag\/edge<\/code>\u3001<code>update configs<\/code> \u7b49\u7b49\uff09\uff0c\u901a\u5e38\u5728\u51e0\u79d2\u4e4b\u5185\uff0c\u6574\u4e2a\u96c6\u7fa4\u5c31\u90fd\u4f1a\u66f4\u65b0\u5143\u6570\u636e\u3002<\/p>\n<p>\u6bcf\u6b21 graphd \u548c storaged \u5728\u5fc3\u8df3\u7684\u54cd\u5e94\u4e2d\u4f1a\u5305\u542b\u4e00\u4e2a <code>last_update_time<\/code>\uff0c\u8fd9\u4e2a\u65f6\u95f4\u662f\u7531 metad \u8fd4\u56de\u7ed9\u5404\u4e2a\u8282\u70b9\u7684\uff0c\u7528\u4e8e\u544a\u77e5 metad \u81ea\u8eab\u6700\u540e\u4e00\u6b21\u66f4\u65b0\u5143\u4fe1\u606f\u7684\u65f6\u95f4\u3002\u5f53 graphd \u6216\u8005 storaged \u53d1\u73b0 metad \u7684\u5143\u4fe1\u606f\u6709\u66f4\u65b0\uff0c\u5c31\u4f1a\u5411 metad \u83b7\u53d6\u76f8\u5e94\u4fe1\u606f\uff08\u4f8b\u5982 space \u4fe1\u606f\u3001schema \u4fe1\u606f\u3001\u914d\u7f6e\u66f4\u6539\u7b49\u7b49\uff09\u3002<\/p>\n<blockquote>\n<p>\u6211\u4eec\u4ee5\u521b\u5efa\u4e00\u4e2a tag \u4e3a\u4f8b\uff0c\u5982\u679c\u5728 graphd\/storaged \u83b7\u53d6\u5230\u65b0\u521b\u5efa\u7684\u8fd9\u4e2a tag \u4fe1\u606f\u4e4b\u524d\uff0c\u6211\u4eec\u65e0\u6cd5\u63d2\u5165\u8fd9\u4e2a tag \u6570\u636e\uff08\u4f1a\u62a5\u7c7b\u4f3c <strong>No schema found<\/strong> \u8fd9\u6837\u7684\u9519\u8bef\uff09\u3002\u800c\u5f53\u901a\u8fc7\u5fc3\u8df3\u83b7\u53d6\u5230\u5bf9\u5e94\u4fe1\u606f\u5e76\u4fdd\u5b58\u81f3\u672c\u5730\u7f13\u5b58\u540e\uff0c\u5c31\u80fd\u591f\u6b63\u5e38\u5199\u5165\u6570\u636e\u4e86\u3002<\/p>\n<\/blockquote>\n<h2>\u5fc3\u8df3\u4e0a\u62a5\u7684\u4fe1\u606f\u6709\u4ec0\u4e48\u7528\uff1f<\/h2>\n<ul>\n<li><code>how hosts<\/code>\u3001<code>show parts<\/code> \u8fd9\u7c7b\u547d\u4ee4\u90fd\u662f\u901a\u8fc7 metad \u4e2d\u4fdd\u5b58\u7684\u5404\u4e2a\u8282\u70b9\u5fc3\u8df3\u4fe1\u606f\uff0c\u7ec4\u5408\u663e\u793a\u51fa\u6765\u7684\u3002<\/li>\n<li><code>balance data<\/code>\u3001<code>balance leader<\/code> \u7b49\u8fd0\u7ef4\u547d\u4ee4\uff0c\u9700\u8981\u901a\u8fc7\u83b7\u53d6\u5f53\u524d\u96c6\u7fa4\u5185\u54ea\u4e9b storaged \u8282\u70b9\u662f\u5728\u7ebf\u72b6\u6001\uff0c\u5b9e\u9645\u4e5f\u662f\u901a\u8fc7 metad \u5224\u65ad\u6700\u8fd1\u4e00\u6b21\u5fc3\u8df3\u65f6\u95f4\u662f\u5426\u5728\u9608\u503c\u4e4b\u5185\u3002<\/li>\n<li><code>create space<\/code>\uff0c\u5f53\u7528\u6237\u521b\u5efa\u4e00\u4e2a space \u65f6\uff0cmetad \u4e5f\u9700\u8981\u83b7\u53d6 storaged \u7684\u72b6\u6001\uff0c\u5c06\u8fd9\u4e2a space \u7684\u5404\u4e2a partition \u5206\u914d\u5230\u5728\u7ebf\u7684 storaged \u4e2d\u3002<\/li>\n<\/ul>\n<blockquote>\n<p>\u4ee5\u7528\u6237\u5bb9\u6613\u9047\u5230\u7684\u95ee\u9898\u4e3a\u4f8b\uff1a\u5047\u5982\u6211\u4eec\u542f\u52a8\u4e00\u4e2a storaged \u540e\uff0c\u5173\u6389\u5e76\u4fee\u6539\u7aef\u53e3\u53f7\uff0c\u7136\u540e\u518d\u542f\u52a8 storaged \u3002\u5982\u679c\u8fd9\u4e2a\u8fc7\u7a0b\u8db3\u591f\u5feb\uff0c\u90a3\u4e48\u901a\u8fc7 <code>show hosts<\/code> \u80fd\u770b\u5230\u4e24\u4e2a\u5728\u7ebf\u7684 storaged \u3002\u6b64\u65f6\uff0c\u5982\u679c\u65b0\u5efa\u4e00\u4e2a space\uff0c\u4f8b\u5982 <code>CREATE space test(partition_num=10, replica_factor=1)<\/code>\uff0c\u8fd9\u4e2a test space \u5c31\u4f1a\u5206\u5e03\u5728\u524d\u540e\u542f\u52a8\u7684\u4e24\u4e2a storage \u4e0a\u3002\u4f46\u5982\u679c\u7b49\u5230\u5728 show hosts \u4e2d\u770b\u5230\u5176\u4e2d\u4e00\u4e2a\u79bb\u7ebf\u540e\uff0c\u518d\u6267\u884c <code>CREATE space test(partition_num=10, replica_factor=1)<\/code>\uff0c\u5373\u4fbf\u79bb\u7ebf\u7684 storaged \u518d\u542f\u52a8\uff0c\u4e5f\u53ea\u6709\u4e00\u4e2a storaged \u62e5\u6709\u8fd9\u4e2a space \uff08\u521b\u5efa test space \u65f6 online \u7684\u90a3\u4e2a storaged \uff09\u3002<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/04\/20210419_607cdc7f64f81.png\" alt=\"\u96c6\u7fa4\u901a\u4fe1\uff1a\u4ece\u5fc3\u8df3\u8bf4\u8d77\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/04\/20210419_607cdc8739f6a.png\" alt=\"\u96c6\u7fa4\u901a\u4fe1\uff1a\u4ece\u5fc3\u8df3\u8bf4\u8d77\" \/><\/p>\n<h2>\u5fc3\u8df3\u7684\u6f14\u53d8\u5386\u53f2<\/h2>\n<p>\u5728 18-19 \u5e74\u7684\u65f6\u5019\uff0c\u5f53\u65f6\u7684\u5fc3\u8df3\u673a\u5236\u6ca1\u6709\u8fd9\u4e48\u5b8c\u5584\u3002\u4e00\u65b9\u9762\uff0c\u65e0\u8bba\u5143\u4fe1\u606f\u662f\u5426\u66f4\u6539\uff0c\u90fd\u4f1a\u4ece metad \u83b7\u53d6\u6700\u65b0\u7684\u5143\u4fe1\u606f\u3002\u800c\u901a\u5e38\u6765\u8bf4\uff0c\u5143\u4fe1\u606f\u6539\u52a8\u4e0d\u4f1a\u5f88\u9891\u7e41\uff0c\u5b9a\u671f\u83b7\u53d6\u5143\u4fe1\u606f\u6709\u4e00\u5b9a\u7684\u8d44\u6e90\u6d6a\u8d39\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u60f3\u8981\u5c06\u4e00\u4e2a storaged \u8282\u70b9\u52a0\u5165\u548c\u79fb\u9664\u90fd\u662f\u901a\u8fc7\u7c7b\u4f3c <code>add\/delete hosts<\/code> \u8fd9\u6837\u7684\u547d\u4ee4\uff0c\u91c7\u53d6\u7684\u662f\u7c7b\u4f3c\u767d\u540d\u5355\u7684\u673a\u5236\u3002\u5bf9\u4e8e\u5176\u4ed6\u6ca1\u6709\u8ba4\u8bc1\u8fc7\u7684\u8282\u70b9\uff0c\u90fd\u65e0\u6cd5\u5bf9\u5916\u670d\u52a1\uff0c\u8fd9\u6837\u505a\u56fa\u7136\u4e5f\u6709\u4e00\u4e9b\u4f18\u52bf\uff0c\u5e26\u6765\u7684\u6700\u5927\u95ee\u9898\u5c31\u662f\u4e0d\u591f\u53cb\u597d\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728 19 \u5e74\u5e95\u5f00\u59cb\uff0c\u6211\u4eec\u5bf9\u5fc3\u8df3\u505a\u4e86\u4e00\u7cfb\u5217\u7684\u6539\u52a8\uff0c\u7279\u522b\u9e23\u8c22\u793e\u533a\u7528\u6237 @zhanggguoqing \u3002\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u7684\u9a8c\u8bc1\u8e29\u5751\u540e\uff0c\u57fa\u672c\u5c31\u5f62\u6210\u4e86\u73b0\u5728\u7684\u5f62\u5f0f\u3002<\/p>\n<h2>\u989d\u5916\u7684\u8865\u5145<\/h2>\n<p>\u6709\u5173\u5fc3\u8df3\u8fd8\u6709\u4e00\u4e2a\u6d89\u53ca\u5230\u7684\u95ee\u9898\u5c31\u662f <em>cluster.id<\/em> \u8fd9\u4e2a\u6587\u4ef6\u3002\u5b83\u5b9e\u9645\u662f\u4e3a\u4e86\u9632\u6b62 storaged \u4e0e\u9519\u8bef\u7684 metad \u901a\u4fe1\uff0c\u5927\u81f4\u539f\u7406\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0cmetad \u5728\u542f\u52a8\u7684\u65f6\u5019\u4f1a\u6839\u636e <code>meta_server_addrs<\/code> \u8fd9\u4e2a\u53c2\u6570\uff0c\u751f\u6210\u4e00\u4e2a hash \u503c\u5e76\u4fdd\u5b58\u5728\u672c\u5730 kv \u4e2d\u3002<\/li>\n<li>storaged \u5728\u542f\u52a8\u7684\u65f6\u5019\u4f1a\u5c1d\u8bd5\u4ece <em>cluster.id<\/em> \u8fd9\u4e2a\u6587\u4ef6\u4e2d\u83b7\u53d6\u5bf9\u5e94 metad \u7684 hash \u503c\uff0c\u5e76\u9644\u9001\u5728\u5fc3\u8df3\u4e2d\u53d1\u9001\uff08\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u5219\u7b2c\u4e00\u6b21\u4f7f\u7528 0 \u4ee3\u66ff\u3002\u6536\u5230\u5fc3\u8df3\u54cd\u5e94\u65f6\uff0c\u5c06 metad \u7684 hash \u503c\u4fdd\u5b58\u5728 <em>cluster.id<\/em> \u8fd9\u4e2a\u6587\u4ef6\u4e2d\uff0c\u540e\u7eed\u4e00\u76f4\u4f7f\u7528\u8be5\u503c\uff09\u3002<\/li>\n<li>\u5728\u5fc3\u8df3\u5904\u7406\u4e2d\uff0cmetad \u4f1a\u6bd4\u8f83\u672c\u5730 hash \u503c\u548c\u6765\u81ea storaged \u5fc3\u8df3\u8bf7\u6c42\u4e2d\u7684 hash \u503c\uff0c\u5982\u679c\u4e0d\u5339\u914d\u5219\u62d2\u7edd\u3002\u6b64\u65f6\uff0cstoraged \u662f\u65e0\u6cd5\u5bf9\u5916\u670d\u52a1\u7684\uff0c\u4e5f\u5c31\u662f <em>Reject wrong cluster host<\/em> \u8fd9\u4e2a\u65e5\u5fd7\u7684\u7531\u6765\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fc3\u8df3\u673a\u5236\u5927\u81f4\u7684\u4ecb\u7ecd\uff0c\u611f\u5174\u8da3\u7684\u4f60\u53ef\u4ee5\u53c2\u8003\u4e0b\u6e90\u7801\u5b9e\u73b0\uff0cGitHub \u4f20\u9001\u95e8\uff1ahttps:\/\/github.com\/vesoft-inc\/nebula-graph\u3002<\/p>\n<h2>\u63a8\u8350\u9605\u8bfb<\/h2>\n<ul>\n<li>\u5206\u5e03\u5f0f\u56fe\u6570\u636e\u5e93 Nebula Graph \u7684 Index \u5b9e\u8df5<\/li>\n<li>\u5206\u5e03\u5f0f\u56fe\u6570\u636e\u5e93 Nebula Graph \u4e2d\u7684\u96c6\u7fa4\u5feb\u7167\u5b9e\u8df5<\/li>\n<\/ul><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u96c6\u7fa4\u901a\u4fe1\uff1a\u4ece\u5fc3\u8df3\u8bf4\u8d77 \u8cc7\u6df1\u5927\u4f6c :&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/433384"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=433384"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/433384\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=433384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=433384"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=433384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}