{"id":16151,"date":"2024-11-18T08:35:38","date_gmt":"2024-11-18T00:35:38","guid":{"rendered":"https:\/\/fwq.ai\/blog\/16151\/"},"modified":"2024-11-18T08:35:38","modified_gmt":"2024-11-18T00:35:38","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8linux%e4%b8%8a%e9%85%8d%e7%bd%ae%e9%ab%98%e5%8f%af%e7%94%a8%e7%9a%84%e8%99%9a%e6%8b%9f%e5%8c%96%e5%ad%98%e5%82%a8%ef%bc%88%e5%a6%82ceph%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/16151\/","title":{"rendered":"\u5982\u4f55\u5728Linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\uff08\u5982Ceph\uff09"},"content":{"rendered":"<p>\u5982\u4f55\u5728linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\uff08\u5982ceph\uff09<\/p>\n<p>\u5f15\u8a00\uff1a<br \/>\u5728\u73b0\u4ee3\u7684\u4e91\u8ba1\u7b97\u73af\u5883\u4e2d\uff0c\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002Ceph\u662f\u4e00\u79cd\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u5b58\u50a8\u7cfb\u7edf\uff0c\u5b83\u80fd\u591f\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u4f38\u7f29\u6027\uff0c\u800c\u4e14\u5728\u865a\u62df\u5316\u73af\u5883\u4e2d\u5f97\u5230\u4e86\u5e7f\u6cdb\u5e94\u7528\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\uff0c\u5e76\u63d0\u4f9b\u76f8\u5173\u4ee3\u7801\u793a\u4f8b\u3002<\/p>\n<p>\u7b2c\u4e00\u90e8\u5206\uff1aCeph\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Ceph<br \/>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5Ceph\uff1a<\/p>\n<pre>sudo apt-get install ceph<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u914d\u7f6eCeph\u96c6\u7fa4<br \/>\u7f16\u8f91\/etc\/ceph\/ceph.conf\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>[global]\nfsid = &lt;fsid&gt;\nmon initial members = &lt;mon-node1&gt;, &lt;mon-node2&gt;, &lt;mon-node3&gt;\nmon host = &lt;ip-node1&gt;, &lt;ip-node2&gt;, &lt;ip-node3&gt;\n\n[osd]\nosd journal size = 1024\n\n[mon]\nmon data = \/var\/lib\/ceph\/mon\/$cluster-$id\nmon initial members = &lt;mon-node1&gt;, &lt;mon-node2&gt;, &lt;mon-node3&gt;\n\n[mds]\nmds data = \/var\/lib\/ceph\/mds\/$cluster-$id&lt;\/mon-node3&gt;&lt;\/mon-node2&gt;&lt;\/mon-node1&gt;&lt;\/ip-node3&gt;&lt;\/ip-node2&gt;&lt;\/ip-node1&gt;&lt;\/mon-node3&gt;&lt;\/mon-node2&gt;&lt;\/mon-node1&gt;&lt;\/fsid&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u66ff\u6362  \u3001  \u3001  \u3001  \u3001  \u3001  \u548c  \u4e3a\u76f8\u5e94\u7684\u503c\u3002\u8fd9\u4e9b\u503c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u7684\u73af\u5883\u8fdb\u884c\u8bbe\u7f6e\u3002       <\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u542f\u52a8Ceph\u96c6\u7fa4<br \/>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u542f\u52a8Ceph\u96c6\u7fa4\uff1a<\/p>\n<pre>sudo systemctl start ceph-mon.target\nsudo systemctl start ceph-osd.target\nsudo systemctl start ceph-mds.target<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e8c\u90e8\u5206\uff1a\u914d\u7f6e\u9ad8\u53ef\u7528\u6027<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Corosync\u548cPacemaker<br \/>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5Corosync\u548cPacemaker\uff1a<\/p>\n<pre>sudo apt-get install corosync pacemaker<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u914d\u7f6eCorosync<br \/>\u7f16\u8f91\/etc\/corosync\/corosync.conf\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>totem {\n        cluster_name: &lt;cluster-name&gt;\n        token: &lt;token&gt;\n        secauth: off\n        transport: udpu\n        interface {\n                ringnumber: 0\n                bindnetaddr: &lt;ip-node1&gt;\n                mcastaddr: &lt;mcast-addr&gt;\n                mcastport: &lt;mcast-port&gt;\n        }\n        interface {\n                ringnumber: 1\n                bindnetaddr: &lt;ip-node2&gt;\n                mcastaddr: &lt;mcast-addr&gt;\n                mcastport: &lt;mcast-port&gt;\n        }\n        interface {\n                ringnumber: 2\n                bindnetaddr: &lt;ip-node3&gt;\n                mcastaddr: &lt;mcast-addr&gt;\n                mcastport: &lt;mcast-port&gt;\n        }\n}\n\nquorum {\n        provider: corosync_votequorum\n        expected_votes: &lt;num-nodes&gt;\n        two_node: 1\n}\n\nnodelist {\n        node {\n                ring0_addr: &lt;ip-node1&gt;\n                nodeid: 1\n        }\n        node {\n                ring0_addr: &lt;ip-node2&gt;\n                nodeid: 2\n        }\n        node {\n                ring0_addr: &lt;ip-node3&gt;\n                nodeid: 3\n        }\n}&lt;\/ip-node3&gt;&lt;\/ip-node2&gt;&lt;\/ip-node1&gt;&lt;\/num-nodes&gt;&lt;\/mcast-port&gt;&lt;\/mcast-addr&gt;&lt;\/ip-node3&gt;&lt;\/mcast-port&gt;&lt;\/mcast-addr&gt;&lt;\/ip-node2&gt;&lt;\/mcast-port&gt;&lt;\/mcast-addr&gt;&lt;\/ip-node1&gt;&lt;\/token&gt;&lt;\/cluster-name&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u66ff\u6362  \u3001  \u3001  \u3001  \u3001  \u3001  \u3001  \u548c  \u4e3a\u76f8\u5e94\u7684\u503c\u3002        <\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u542f\u52a8Corosync\u548cPacemaker<br \/>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u542f\u52a8Corosync\u548cPacemaker\uff1a<\/p>\n<pre>sudo systemctl enable corosync\nsudo systemctl enable pacemaker\nsudo systemctl start corosync\nsudo systemctl start pacemaker<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u56db\u6b65\uff1a\u914d\u7f6eCeph\u8d44\u6e90<br \/>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u914d\u7f6eCeph\u8d44\u6e90\uff1a<\/p>\n<pre>sudo pcs resource create ceph_mon ocf:ceph:mon \n--params mon_name=mon \nop monitor interval=10s\n\nsudo pcs resource create ceph_osd ocf:ceph:osd \n--params osd_device=\/dev\/sdb \nop start timeout=90s \nop stop timeout=90s \nop monitor interval=10s\n\nsudo pcs resource create ceph_mds ocf:ceph:mds \n--params mds_name=mds \nop monitor interval=10s<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e9b\u547d\u4ee4\u5c06\u521b\u5efaCeph\u7684mon\u3001osd\u548cmds\u8d44\u6e90\uff0c\u5e76\u6307\u5b9a\u4e00\u4e9b\u53c2\u6570\u3002<\/p>\n<p>\u7ed3\u8bba\uff1a<br \/>\u4ee5\u4e0a\u5c31\u662f\u5728Linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\u7684\u65b9\u6cd5\u3002\u901a\u8fc7\u4f7f\u7528Ceph\u548cCorosync-Pacemaker\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u5b9e\u73b0\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\u73af\u5883\u3002\u5e0c\u671b\u672c\u6587\u80fd\u5bf9\u8bfb\u8005\u5728Linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\u63d0\u4f9b\u4e00\u4e9b\u5e2e\u52a9\u3002<\/p>\n<p>\u53c2\u8003\u8d44\u6599\uff1a<\/p>\n<ul>\n<li>Ceph\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/docs.ceph.com\/<\/li>\n<li>Corosync\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/corosync.github.io\/corosync-docs\/index.html<\/li>\n<li>Pacemaker\u5b98\u65b9\u6587\u6863\uff1ahttp:\/\/clusterlabs.org\/<\/li>\n<li>Linux\u72b6\u6001\u7ba1\u7406\u5668\u4f7f\u7528\u6307\u5357\uff1ahttps:\/\/access.redhat.com\/documentation\/en-us\/red_hat_enterprise_linux\/7\/html\/high_availability_add-on_reference\/<\/li>\n<li>Linux\u96c6\u7fa4\u5305\u6307\u5357\uff1ahttps:\/\/access.redhat.com\/documentation\/en-us\/red_hat_enterprise_linux\/7\/html\/high_availability_add-on_guide\/<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728Linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\uff08\u5982Ceph\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\uff08\u5982ceph\uff09 \u5f15\u8a00\uff1a\u5728\u73b0\u4ee3\u7684\u4e91\u8ba1\u7b97\u73af\u5883\u4e2d\uff0c\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002Ceph\u662f\u4e00\u79cd\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u5b58\u50a8\u7cfb\u7edf\uff0c\u5b83\u80fd\u591f\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u4f38\u7f29\u6027\uff0c\u800c\u4e14\u5728\u865a\u62df\u5316\u73af\u5883\u4e2d\u5f97\u5230\u4e86\u5e7f\u6cdb\u5e94\u7528\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Linux\u4e0a\u914d\u7f6e\u9ad8\u53ef\u7528\u7684\u865a\u62df\u5316\u5b58\u50a8\uff0c\u5e76\u63d0\u4f9b\u76f8\u5173\u4ee3\u7801\u793a\u4f8b\u3002 \u7b2c\u4e00\u90e8\u5206\uff1aCeph\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e \u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Ceph\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728Linux\u7cfb\u7edf\u4e0a\u5b89\u88c5Ceph\uff1a sudo apt-get install ceph \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e8c\u6b65\uff1a\u914d\u7f6eCeph\u96c6\u7fa4\u7f16\u8f91\/etc\/ceph\/ceph.conf\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a [global] fsid = &lt;fsid&gt; mon initial members = &lt;mon-node1&gt;, &lt;mon-node2&gt;, &lt;mon-node3&gt; mon host = &lt;ip-node1&gt;, &lt;ip-node2&gt;, &lt;ip-node3&gt; [osd] osd journal size = 1024 [mon] mon data = \/var\/lib\/ceph\/mon\/$cluster-$id mon initial members = &lt;mon-node1&gt;, &lt;mon-node2&gt;, &lt;mon-node3&gt; [mds] mds data = \/var\/lib\/ceph\/mds\/$cluster-$id&lt;\/mon-node3&gt;&lt;\/mon-node2&gt;&lt;\/mon-node1&gt;&lt;\/ip-node3&gt;&lt;\/ip-node2&gt;&lt;\/ip-node1&gt;&lt;\/mon-node3&gt;&lt;\/mon-node2&gt;&lt;\/mon-node1&gt;&lt;\/fsid&gt; \u767b\u5f55\u540e\u590d\u5236 \u66ff\u6362 \u3001 \u3001 \u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-16151","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/16151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=16151"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/16151\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=16151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=16151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=16151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}