{"id":591,"date":"2024-12-17T16:23:08","date_gmt":"2024-12-17T08:23:08","guid":{"rendered":"http:\/\/192.168.5.24\/?p=591"},"modified":"2025-05-22T16:50:48","modified_gmt":"2025-05-22T08:50:48","slug":"glusterfs%e7%be%a4%e6%9e%b6%e7%9a%84%e6%90%ad%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/bigvip.dpdns.org\/?p=591","title":{"rendered":"glusterfs\u7fa4\u67b6\u7684\u642d\u5efa"},"content":{"rendered":"\n<p>      glusterfs\u6ca1\u6709\u4e13\u7528\u7684\u7ba1\u7406\u8282\u70b9\uff0c\u6bcf\u4e2aglusterfs\u8282\u70b9\u670d\u52a1\u5668\u90fd\u662f\u7ba1\u7406\u8282\u70b9\u548c\u5b58\u50a8\u8282\u70b9\uff0c\u4e0d\u5b58\u5728\u5355\u72ec\u6545\u969c\u95ee\u9898\u3002glusterfs\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\u63d0\u4f9b\u6587\u4ef6\u5b58\u50a8\u7c7b\u578b\u5171\u4eab\u670d\u52a1\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u51c6\u5907\u5de5\u4f5c<\/h2>\n\n\n\n<p>1\u3001\u670d\u52a1\u5668\u89c4\u5212<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>192.168.168.147 storage1\n192.168.168.146 storage2\n192.168.168.144 storage3\n192.168.168.143 storage4\n192.168.168.142 client<\/code><\/pre>\n\n\n\n<p>2\u3001\u8bbe\u7f6e\u65f6\u95f4\u540c\u6b65<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>storage1\u4f5c\u4e3a\u65f6\u95f4\u670d\u52a1\u5668\n\n&#91;root@localhost ~]# grep -Ev \"^&#91;&#91;:space:]]*(#|$)\" \/etc\/chrony.conf\nserver 0.centos.pool.ntp.org iburst\nserver 1.centos.pool.ntp.org iburst\nserver 2.centos.pool.ntp.org iburst\nserver 3.centos.pool.ntp.org iburst\ndriftfile \/var\/lib\/chrony\/drift\nmakestep 1.0 3\nrtcsync\nlocal stratum 10\nlogdir \/var\/log\/chrony\n\n\u5176\u5b83\u670d\u52a1\u5668\u4f5c\u4e3a\u5ba2\u6237\u7aef\uff1a\n\n\n&#91;root@localhost gv0]# grep -Ev \"^&#91;&#91;:space:]]*(#|$)\" \/etc\/chrony.conf\nserver 192.168.168.147 iburst\ndriftfile \/var\/lib\/chrony\/drift\nmakestep 1.0 3\nrtcsync\nlogdir \/var\/log\/chrony\n\n\u9a8c\u8bc1\n\n&#91;root@localhost ~]# timedatectl\n      Local time: Tue 2024-12-17 15:19:25 CST\n  Universal time: Tue 2024-12-17 07:19:25 UTC\n        RTC time: Tue 2024-12-17 07:19:26\n       Time zone: Asia\/Shanghai (CST, +0800)\n<strong>     NTP enabled: yes\nNTP synchronized: yes<\/strong>\n RTC in local TZ: no\n      DST active: n\/a\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u5b89\u88c5glusterfs-server<\/h2>\n\n\n\n<p>1\u3001\u5728\u6240\u6709storage\u670d\u52a1\u5668\u4e0a(\u4e0d\u5305\u62ecclient)\u5b89\u88c5glusterfs-server\u8f6f\u4ef6\u5305\uff0c\u5e76\u542f\u52a8\u670d\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># yum install glusterfs-server\n# systemctl start glusterd\n# systemctl enable glusterd\n# systemctl status glusterd<\/code><\/pre>\n\n\n\n<p>2\u3001\u6240\u6709storage\u670d\u52a1\u5668\u5efa\u7acb\u96c6\u7fa4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@storage1 ~]# gluster peer probe storage2\n&#91;root@storage1 ~]# gluster peer probe storage3\n&#91;root@storage1 ~]# gluster peer probe storage4\n\n\u67e5\u770bpeer\u60c5\u51b5\n&#91;root@localhost ~]# gluster peer status\nNumber of Peers: 3\n\nHostname: storage2\nUuid: 6967d3bf-5ecd-4fc8-822f-93b2d30427e0\nState: Peer in Cluster (Connected)\n\nHostname: storage3\nUuid: 8040be49-39a0-4990-b49b-8213f3ffef24\nState: Peer in Cluster (Connected)\n\nHostname: storage4\nUuid: 13c69026-2527-4af0-b1a6-35ca26c68011\nState: Peer in Cluster (Connected)\n<\/code><\/pre>\n\n\n\n<p>3\u3001\u521b\u5efa\u5b58\u50a8\u5377(\u5728\u4efb\u610f\u4e00\u4e2astorage\u670d\u52a1\u5668\u4e0a\u505a)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gluster volume create gv1 replica 4 storage1:\/data\/gv0\/ \nstorage2:\/data\/gv0\/ storage3:\/data\/gv0\/ storage4:\/data\/gv0\/ force\n\n\u5377\u7c7b\u578b\u652f\u6301\uff1a&#91;stripe &lt;COUNT&gt;] &#91;replica &lt;COUNT&gt;] &#91;disperse &#91;&lt;COUNT&gt;]] &#91;redundancy &lt;COUNT&gt;]\n\u56e0\u4e3a\u5728\u6839\u5206\u533a\u521b\u5efa\u6240\u4ee5\u9700\u8981force\u53c2\u6570\u5f3a\u5236\uff08\u5176\u4ed6\u5206\u533a\u4e0d\u9700\u8981force\uff09\n\n\u67e5\u770b\u5b58\u50a8\u5377\u4fe1\u606f\uff1a\n&#91;root@localhost ~]# gluster volume info gv1\n\nVolume Name: gv1\nType: Distribute\nVolume ID: 3e7a0134-387e-4ffe-b45a-7cff0660ae36\nStatus: Started\nSnapshot Count: 0\nNumber of Bricks: 4\nTransport-type: tcp\nBricks:\nBrick1: storage1:\/data\/gv0\nBrick2: storage2:\/data\/gv0\nBrick3: storage3:\/data\/gv0\nBrick4: storage4:\/data\/gv0\nOptions Reconfigured:\nperformance.client-io-threads: on\ntransport.address-family: inet\nnfs.disable: on<\/code><\/pre>\n\n\n\n<p>4\u3001\u542f\u52a8\u5b58\u50a8\u5377<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# gluster volume start gv1\nvolume start: gv1: success<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001client\u5b89\u88c5\u4f7f\u7528<\/h2>\n\n\n\n<p>\u5b89\u88c5\u5ba2\u6237\u7aef\u5e76\u6302\u8f7d\u5206\u533a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]#yum -y install glusterfs-4.1.9-1.el7.x86_64 glusterfs-fuse-4.1.9-1.el7.x86_64\n\n&#91;root@localhost ~]# mount -t glusterfs storage1:gv1 \/mnt\n&#91;root@localhost ~]# df -h\nFilesystem               Size  Used Avail Use% Mounted on\nstorage1:gv0              17G  1.9G   16G  11% \/mnt\n\n\u8fd9\u91ccclient\u662f\u6302\u8f7dstorage1\uff0c\u4e5f\u53ef\u4ee5\u6302\u8f7dstorage2,storage3,storage4\u4efb\u610f\u4e00\u4e2a\u3002\uff08\u4e5f\u5c31\u662f\u8bf4\u8fd94\u4e2astorage\u90fd\u5e72\u6d3b\u3002\u8fd9\u662fglusterfs\u7684\u4e00\u4e2a\u7279\u70b9\uff0c\u5176\u5b83\u7684\u5206\u5e03\u5f0f\u5b58\u50a8\u8f6f\u4ef6\u57fa\u672c\u4e0a\u90fd\u4f1a\u6709\u4e13\u95e8\u7684\u7ba1\u7406server)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001glusterfs\u5377\u7684\u5220\u9664<\/h2>\n\n\n\n<p>1\u3001\u5148\u5728\u5ba2\u6237\u7aefumount\u5df2\u7ecf\u6302\u8f7d\u7684\u76ee\u5f55<\/p>\n\n\n\n<p>2\u3001\u5728\u4efb\u4e00\u4e2astorage\u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u505c\u6b62gv1\u5e76\u5220\u9664<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# gluster volume stop gv1\nStopping volume will make its data inaccessible. Do you want to continue? (y\/n) y\nvolume stop: gv1: success\n\n&#91;root@localhost ~]# gluster volume delete gv1\nDeleting volume will erase all information about the volume. Do you want to continue? (y\/n) y\nvolume delete: gv1: success<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u5728\u7ebf\u88c1\u51cf\u4e0e\u5728\u7ebf\u6269\u5bb9<\/h2>\n\n\n\n<p>\u5728\u7ebf\u88c1\u51cf\u4e0d\u662f\u6240\u6709\u6a21\u5f0f\u7684\u5377\u90fd\u652f\u6301\u3002\u4e0b\u9762\u6211\u4ee5distributed\u5377\u6765\u505a\u88c1\u51cf\u4e0e \u6269\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# gluster volume create gv1 storage1:\/data\/gv0 storage2:\/data\/gv0 storage3:\/data\/gv0 force\n\n&#91;root@localhost ~]# gluster volume remove-brick gv1 storage4:\/data\/gv0 force\nRemove-brick force will not migrate files from the removed bricks, so they will no longer be available on the volume.\nDo you want to continue? (y\/n) y\nvolume remove-brick commit force: success\n&#91;root@localhost ~]# gluster volume info gv1\n\nVolume Name: gv1\nType: Distribute\nVolume ID: 3e7a0134-387e-4ffe-b45a-7cff0660ae36\nStatus: Started\nSnapshot Count: 0\nNumber of Bricks: 3\nTransport-type: tcp\nBricks:\nBrick1: storage1:\/data\/gv0\nBrick2: storage2:\/data\/gv0\nBrick3: storage3:\/data\/gv0\nOptions Reconfigured:\nperformance.client-io-threads: on\ntransport.address-family: inet\nnfs.disable: on\n\n&#91;root@localhost ~]# gluster volume add-brick gv1 storage4:\/data\/gv0 force\nvolume add-brick: success\n&#91;root@localhost ~]# gluster volume info gv1\n\nVolume Name: gv1\nType: Distribute\nVolume ID: 3e7a0134-387e-4ffe-b45a-7cff0660ae36\nStatus: Started\nSnapshot Count: 0\nNumber of Bricks: 4\nTransport-type: tcp\nBricks:\nBrick1: storage1:\/data\/gv0\nBrick2: storage2:\/data\/gv0\nBrick3: storage3:\/data\/gv0\nBrick4: storage4:\/data\/gv0\nOptions Reconfigured:\nperformance.client-io-threads: on\ntransport.address-family: inet\nnfs.disable: on<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6ce8\u610f\u4e8b\u9879\uff1a<\/h2>\n\n\n\n<p>1\u3001\u5173\u4e8eglusterfs\u5377\u7684\u521b\u5efa\u3001\u5220\u9664\u7b49\u5de5\u4f5c\u4e0d\u9700\u8981\u540c\u65f6\u5728\u591a\u53f0glusterfs\u96c6\u7fa4\u670d\u52a1\u5668\u4e0a\u9762\u8fdb\u884c\u64cd\u4f5c\uff0c\u53ea\u9700\u5728\u5176\u4e2d\u4e00\u53f0\u64cd\u4f5c\u5373\u53ef\u3002<\/p>\n\n\n\n<p>2\u3001glusterfs\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6570\u636e\u6ca1\u6709\u8fdb\u884c\u52a0\u5bc6\uff0c\u5728\u96c6\u7fa4\u7684\u4efb\u4f55\u4e00\u6761\u670d\u52a1\u5668\u4e0a\u90fd\u53ef\u4ee5\u76f4\u63a5\u67e5\u770b\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>glusterfs\u6ca1\u6709\u4e13\u7528\u7684\u7ba1\u7406\u8282\u70b9\uff0c\u6bcf\u4e2aglusterfs\u8282\u70b9\u670d\u52a1\u5668\u90fd\u662f\u7ba1\u7406\u8282\u70b9\u548c\u5b58\u50a8\u8282\u70b9\uff0c\u4e0d\u5b58\u5728\u5355\u72ec\u6545\u969c\u95ee [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[20,36],"tags":[91,90],"class_list":["post-591","post","type-post","status-publish","format-aside","hentry","category-linux","category-36","tag-glusterfs","tag-90","post_format-post-format-aside"],"_links":{"self":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=591"}],"version-history":[{"count":11,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/591\/revisions"}],"predecessor-version":[{"id":1180,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/591\/revisions\/1180"}],"wp:attachment":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}