ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÂþÑÜʽÎļþϵͳ
ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÂþÑÜʽÎļþϵͳ
СÐò£º
Ëæ×Å´óÊý¾ÝºÍÔÆÅÌËãµÄ¿ìËÙÉú³¤£¬ÂþÑÜʽÎļþϵͳÔÚÊý¾Ý´æ´¢ºÍÖÎÀíÖÐÆð×ÅÖÁ¹ØÖ÷ÒªµÄ×÷Ó᣸߿ÉÓÃÐÔÊÇÂþÑÜʽÎļþϵͳµÄÒ»¸öÖ÷ÒªÌص㣬ËüÄܹ»°ü¹ÜÊý¾ÝµÄ³¤ÆÚÐԺͿɿ¿ÐÔ£¬È·±£ÏµÍ³ÔÚÃæÁÙÓ²¼þ¹ÊÕÏ»òÍøÂçÖÐֹʱÈÔÄÜÕý³£ÔËÐС£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ÏÈÈÝÔõÑùÔÚLinux²Ù×÷ϵͳÉÏÉèÖÃÒ»¸ö¸ß¿ÉÓõÄÂþÑÜʽÎļþϵͳ£¬ÒÔÌṩÊý¾ÝµÄ³¤ÆÚÐԺͿɿ¿ÐÔ¡£
°ì·¨Ò»£º×°ÖúÍÉèÖÃÍøÂç´æ´¢£¨NAS£©
Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖò¢ÉèÖÃÒ»¸öÍøÂç´æ´¢£¨NAS£©ÏµÍ³¡£NASÈÏÕæ´æ´¢ºÍÖÎÀíÎļþ£¬ÎªÂþÑÜʽÎļþϵͳÌṩÊý¾Ý´æ´¢Ö§³Ö¡£ÒÔÏÂÊÇÔÚLinuxÉÏ×°ÖúÍÉèÖÃNASµÄ¼òÆÓʾÀý£º
ʹÓÃÒÔÏÂÏÂÁî×°ÖÃNFSЧÀÍÆ÷×é¼þ£º
sudo apt-get install nfs-kernel-server
µÇ¼ºó¸´ÖÆ
ÉèÖÃNFSЧÀÍÆ÷ÒÔÌṩ¹²ÏíĿ¼¡£ÔÚ/etc/exportsÎļþÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º
/mnt/shared *(rw,sync,no_root_squash)
µÇ¼ºó¸´ÖÆ
ÖØÆôNFSЧÀÍÆ÷ÒÔÓ¦Óøü¸Ä£º
sudo systemctl restart nfs-kernel-server
µÇ¼ºó¸´ÖÆ
ʹÓÃÒÔÏÂÏÂÁî²âÊÔNFS¹²ÏíÊÇ·ñÕý³£ÊÂÇ飺
showmount -e localhost
µÇ¼ºó¸´ÖÆ
ÈôÊÇÏÔʾ/mnt/shared *£¬ÔòÌåÏÖNFS¹²ÏíÒÑÀÖ³ÉÉèÖá£
°ì·¨¶þ£º×°ÖúÍÉèÖÃÂþÑÜʽÎļþϵͳÈí¼þ
ÔÚNASϵͳ׼±¸ºÃÖ®ºó£¬ÎÒÃÇÐèҪװÖúÍÉèÖÃÂþÑÜʽÎļþϵͳÈí¼þ¡£ÔÚÕâ¸öʾÀýÖУ¬ÎÒÃǽ«Ê¹ÓÃGlusterFS£¬Ò»¸öÊ¢ÐеĿªÔ´ÂþÑÜʽÎļþϵͳ¡£
ʹÓÃÒÔÏÂÏÂÁî×°ÖÃGlusterFSЧÀÍÆ÷×é¼þ£º
sudo apt-get install glusterfs-server
µÇ¼ºó¸´ÖÆ
½¨ÉèÒ»¸öеÄGlusterFS¾í£¨Ò²³ÆΪ´æ´¢³Ø£©¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý£º
sudo gluster volume create distfs replica 2 transport tcp server1:/mnt/shared server2:/mnt/shared
µÇ¼ºó¸´ÖÆ
Õâ¸öÏÂÁÉèÁËÒ»¸öÃûΪdistfsµÄ¾í£¬Ê¹ÓÃ2¸ö¸±±¾£¨ÂþÑÜʽÎļþ´æ´¢£©ÔÚserver1ºÍserver2ÉÏ¡£
Æô¶¯GlusterFS¾í£º
sudo gluster volume start distfs
µÇ¼ºó¸´ÖÆ
ʹÓÃÒÔÏÂÏÂÁîÉó²éGlusterFS¾íµÄ״̬£º
sudo gluster volume info
µÇ¼ºó¸´ÖÆ
ÈôÊÇÊä³öÖÐÏÔʾVolume distfs is started£¬ÔòÌåÏÖ¾íÒÑÀÖ³ÉÉèÖá£
°ì·¨Èý£ºÉèÖø߿ÉÓÃÐÔ
ΪÁËʵÏָ߿ÉÓÃÐÔ£¬ÎÒÃÇ¿ÉÒÔʹÓÃPacemakerºÍCorosyncÀ´¾ÙÐйÊÕϼì²âºÍ×Ô¶¯¹ÊÕÏתÒÆ¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý£º
ʹÓÃÒÔÏÂÏÂÁî×°ÖÃPacemakerºÍCorosync£º
sudo apt-get install pacemaker corosync
µÇ¼ºó¸´ÖÆ
ÉèÖÃPacemakerºÍCorosyncÒÔÆôÓø߿ÉÓÃÐԺ͹ÊÕÏתÒÆ¡£ÔÚ/etc/corosync/corosync.confÎļþÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º
node server1 node server2 primitive fs-gluster ocf:heartbeat:Filesystem params fstype=glusterfs directory=/mnt/mount_gluster device=distfs op start interval=0s timeout=60s op stop interval=0s timeout=60s op monitor interval=10s timeout=60s meta is-managed=true ms ms-gluster fs-gluster meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true colocation col-gluster inf: ms-gluster:Master order ord-gluster inf: ms-gluster:promote fs-gluster:start property cib-bootstrap-options: stonith-enabled=false no-quorum-policy=ignore
µÇ¼ºó¸´ÖÆ
Æô¶¯ºÍÉèÖÃPacemakerºÍCorosync£º
sudo systemctl enable corosync sudo systemctl enable pacemaker sudo systemctl start corosync sudo systemctl start pacemaker
µÇ¼ºó¸´ÖÆ
ʹÓÃÒÔÏÂÏÂÁîÉó²éPacemakerºÍCorosyncµÄ״̬£º
sudo crm_mon -r -1
µÇ¼ºó¸´ÖÆ
ÈôÊÇÊä³öÖÐÏÔʾOnline: [server1 server2]£¬ÔòÌåÏָ߿ÉÓÃÐÔÉèÖÃÀֳɡ£
½áÂÛ£º
ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇÀÖ³ÉÉèÖÃÁËLinuxÉϵĸ߿ÉÓÃÂþÑÜʽÎļþϵͳ¡£Õâ¸öϵͳÄܹ»³¤Æڵش洢ºÍÖÎÀíÊý¾Ý£¬²¢Í¨¹ý¹ÊÕϼì²âºÍ×Ô¶¯¹ÊÕÏתÒÆÀ´Ìṩ¸ß¿ÉÓÃÐÔ¡£Ï£ÍûÕâƪÎÄÕ¶ÔÄúÃ÷È·ºÍÉèÖø߿ÉÓÃÂþÑÜʽÎļþϵͳÓÐËù×ÊÖú¡£
²Î¿¼ÎÄÏ×£º
GlusterFS¹Ù·½Îĵµ£ºhttps://docs.gluster.org/
Pacemaker¹Ù·½Îĵµ£ºhttp://clusterlabs.org/doc/
Corosync¹Ù·½Îĵµ£ºhttps://corosync.github.io/corosync-docs/
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÂþÑÜʽÎļþϵͳµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡