ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÍøÂç´æ´¢£¨ÈçNFS£©
ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÍøÂç´æ´¢£¨Èçnfs£©
ÏÈÈÝ£º
ÍøÂçÎļþϵͳ£¨NFS£©ÊÇÒ»ÖÖ³£ÓõÄÂþÑÜʽÎļþϵͳ£¬ÔÊÐí²î±ðµÄÅÌËã»úÖ®¼ä¹²ÏíÎļþ¡£ÔÚLinuxÇéÐÎÏ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖø߿ÉÓõÄÍøÂç´æ´¢À´È·±£ÏµÍ³µÄÎȹÌÐԺͿɿ¿ÐÔ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄNFS£¬²¢ÌṩһЩ´úÂëʾÀý¡£
°ì·¨Ò»£º×°ÖÃNFS
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚËùÓнڵãÉÏ×°ÖÃNFSÈí¼þ°ü¡£ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐ×°Öãº
$ sudo apt-get install nfs-kernel-server
°ì·¨¶þ£ºÉèÖÃNFS
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÔÚÖ÷½ÚµãÉÏÉèÖÃNFS¡£±à¼/etc/exportsÎļþ£¬²¢Ìí¼Ó¹²ÏíĿ¼µÄÉèÖá£ÀýÈ磬ÈôÊÇÎÒÃÇÏëÒª¹²ÏíĿ¼/var/nfsdata£¬²¢ÔÊÐíËùÓнڵ㶼¿ÉÒÔ»á¼û£¬¿ÉÒÔÔÚ/etc/exportsÎļþÖÐÌí¼ÓÒÔÏÂÐУº
/var/nfsdata *(rw,sync,no_subtree_check)
ÄúÒ²¿ÉÒÔƾ֤ÐèÒªÉèÖÃÆäËûµÄÑ¡ÏÈçÖ»ÔÊÐíÌض¨½Úµã»á¼û¡¢Ö»¶ÁȨÏ޵ȡ£
°ì·¨Èý£ºÆô¶¯NFSЧÀÍ
Íê³ÉÉèÖúó£¬ÎÒÃÇÐèÒªÆô¶¯NFSЧÀÍ£¬²¢È·±£ÆäÔÚϵͳÆô¶¯Ê±×Ô¶¯Æô¶¯¡£ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Æô¶¯²¢ÉèÖÿª»ú×ÔÆô¶¯£º
$ sudo systemctl start nfs-kernel-server
$ sudo systemctl enable nfs-kernel-server
°ì·¨ËÄ£ºÉèÖÃÍøÂç´æ´¢µÄ¸ß¿ÉÓÃ
ΪÁËʵÏÖÍøÂç´æ´¢µÄ¸ß¿ÉÓÃÐÔ£¬ÎÒÃÇ¿ÉÒÔʹÓÃLinux-HA¹¤¾ß°üÀ´¼à¿ØºÍÖÎÀíNFSЧÀÍ¡£ÒÔÏÂÊÇÒ»¸ö¼òÆӵĴúÂëʾÀý£¬ÑÝʾÔõÑùʹÓÃLinux-HA¹¤¾ß°üÀ´ÉèÖø߿ÉÓõÄNFS¡£
°ì·¨Ò»£º×°ÖÃLinux-HA¹¤¾ß°ü
ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´×°ÖÃLinux-HA¹¤¾ß°ü£º
$ sudo apt-get install pacemaker corosync
°ì·¨¶þ£ºÉèÖÃLinux-HA
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÉèÖÃLinux-HAÒÔʵÏÖÍøÂç´æ´¢µÄ¸ß¿ÉÓá£Ê×ÏÈ£¬ÔÚËùÓнڵãÉϱà¼/etc/ha.d/authkeysÎļþ£¬²¢Ìí¼ÓÒÔÏÂÄÚÈÝ£º
auth 3
3 md5 YourSharedSecretKey
È»ºó£¬±à¼/etc/ha.d/ha.cfÎļþ£¬²¢ÉèÖÃÈçÏÂÄÚÈÝ£º
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
auto_failback on
node node1
node node2
°ì·¨Èý£ºÉèÖÃ×ÊÔ´ÊðÀí
ÎÒÃÇ»¹ÐèÒªÉèÖÃ×ÊÔ´ÊðÀíÒÔʵÏÖNFSЧÀ͵ĸ߿ÉÓ᣽¨ÉèÒ»¸öеÄÎļþ/etc/ha.d/groups£¬²¢Ìí¼ÓÒÔÏÂÐУº
group nfs-group node1 node2
resource nfs_res_nfs1
exclusive lockfile fsid=0 block_device /dev/nfs_share script /usr/lib/ocf/resource.d/filesystem/nfs op monitor interval="10s"
µÇ¼ºó¸´ÖÆ
ÔÚÉÏÊöÉèÖÃÖУ¬ÎÒÃǽ¨ÉèÁËÒ»¸öÃûΪnfs-groupµÄ×ÊÔ´×飬²¢½«nfs_res_nfs1×ÊÔ´·ÖÅɸø¸Ã×ÊÔ´×é¡£Äú¿ÉÒÔƾ֤ÐèÒªÐÞ¸Ä×ÊÔ´µÄÃû³ÆºÍÆäËû²ÎÊý¡£
°ì·¨ËÄ£ºÆô¶¯Linux-HAЧÀÍ
Íê³ÉÉèÖúó£¬ÎÒÃÇ¿ÉÒÔÆô¶¯Linux-HAЧÀÍ£¬²¢È·±£ÆäÔÚϵͳÆô¶¯Ê±×Ô¶¯Æô¶¯¡£ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Æô¶¯²¢ÉèÖÿª»ú×ÔÆô¶¯£º
$ sudo systemctl start pacemaker
$ sudo systemctl enable pacemaker
½áÂÛ£º
ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇ¿ÉÒÔÔÚLinuxÉÏÉèÖø߿ÉÓõÄÍøÂç´æ´¢£¨ÈçNFS£©¡£Õâ¿ÉÒÔÌá¸ßϵͳµÄÎȹÌÐԺͿɿ¿ÐÔ£¬È·±£Êý¾ÝµÄÇå¾²ºÍ¿É»á¼ûÐÔ¡£Ï£Íû±¾ÎĶÔÄúÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÍøÂç´æ´¢£¨ÈçNFS£©µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡