尊龙凯时人生就是搏

ÔõÑùÔÚLinuxÉÏÉèÖü¯ÈºÎļþϵͳ

ÔõÑùÔÚlinuxÉÏÉèÖü¯ÈºÎļþϵͳ

СÐò£º

ÔÚÏÖ´úÊÖÒÕʱ´ú £¬Í¨¹ýÉèÖü¯ÈºÎļþϵͳÔÚLinuxЧÀÍÆ÷ÉÏʵÏָ߿ÉÓᢸßÐÔÄܵÄÎļþϵͳÕý±äµÃÔ½À´Ô½Ö÷Òª¡£¼¯ÈºÎļþϵͳ¿ÉÒÔÌṩ¶Ô¶à¸öÖ÷»ú¹²ÏíÎļþϵͳµÄÖ§³Ö £¬Ê¹µÃ¶à¸öÖ÷»ú¿ÉÒÔͬʱ¶ÁÈ¡ºÍдÈëÎļþ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxÉÏÉèÖÃÒ»¸ö»ù±¾µÄ¼¯ÈºÎļþϵͳ £¬ÒÔ¼°ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

µÚÒ»²¿·Ö£º¸ÅÊö

¼¯ÈºÎļþϵͳ»ù±¾ÉÏÊÇÔÚ¶à¸öÖ÷»úÉÏͬʱÔËÐеÄÂþÑÜʽÎļþϵͳ¡£Ëüͨ¹ý½«¶à¸ö´æ´¢½ÚµãÅþÁ¬µ½Ò»¸ö¹²Ïí´æ´¢×°±¸À´ÊµÏÖÊý¾ÝµÄ¹²ÏíºÍÈßÓà´æ´¢¡£ÔÚÉèÖü¯ÈºÎļþϵͳ֮ǰ £¬ÎÒÃÇÐèҪȷ±£ËùÓнڵ㶼Äܹ»¹²Ïí´æ´¢×°±¸ £¬²¢¾ß±¸ÏàͬµÄÍøÂçÅþÁ¬¡£

µÚ¶þ²¿·Ö£º×°ÖúÍÉèÖÃÎļþϵͳ

×°ÖÃÒÀÀµÈí¼þ°ü

ÔÚLinuxϵͳÉÏ £¬ÎÒÃÇÐèҪװÖÃһЩÒÀÀµÈí¼þ°ü £¬ÒÔÖ§³Ö¼¯ÈºÎļþϵͳµÄÕý³£ÔËÐС£ÀýÈç £¬ÔÚUbuntuÉÏ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî×°ÖÃËùÐèµÄÈí¼þ°ü£º

sudo apt-get install pacemaker corosync ocfs2-tools

µÇ¼ºó¸´ÖÆ

ÉèÖÃÍøÂçÅþÁ¬

ΪÁËʹ¶à¸öÖ÷ÐÔÄܹ»Ï໥ͨѶ £¬ÎÒÃÇÐèÒªÉèÖÃÍøÂçÅþÁ¬¡£¿ÉÒÔͨ¹ý±à¼­ÍøÂçÉèÖÃÎļþÀ´ÉèÖÃÍøÂçÅþÁ¬µÄ²ÎÊý¡£ÀýÈç £¬ÔÚUbuntuÉÏ¿ÉÒԱ༭/etc/network/interfacesÎļþ£º

sudo vi /etc/network/interfaces

µÇ¼ºó¸´ÖÆ

È»ºóÌí¼ÓÒÔÏÂÄÚÈÝ£º

auto eth0
iface eth0 inet static
 address 192.168.1.10
 netmask 255.255.255.0
 gateway 192.168.1.1

µÇ¼ºó¸´ÖÆ

ÉèÖÃȺ¼¯Èí¼þ

ÔÚÉèÖÃȺ¼¯Èí¼þ֮ǰ £¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸ö¹²Ïí´æ´¢×°±¸¡£¿ÉÒÔʹÓÃÏñiSCSIÕâÑùµÄÊÖÒÕÀ´½¨Éè¹²Ïí´æ´¢¡£Ê×ÏÈ £¬ÎÒÃÇÐèҪװÖÃiSCSIÈí¼þ°ü£º

sudo apt-get install tgt

µÇ¼ºó¸´ÖÆ

È»ºó £¬Æ¾Ö¤Ð§ÀÍÆ÷µÄÐèÇóÉèÖù²Ïí´æ´¢×°±¸¡£ÀýÈç £¬ÔÚUbuntuÉÏ¿ÉÒÔʹÓÃÈçÏÂÏÂÁÉèÒ»¸öiSCSI×°±¸£º

sudo tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2021-01.com.example:storage
sudo tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb

µÇ¼ºó¸´ÖÆ

ÉèÖü¯Èº

ÔÚËùÓнڵãÉÏ×°Öò¢ÉèÖÃȺ¼¯Èí¼þ £¬ÈçpacemakerºÍcorosync¡£¿ÉÒÔʹÓÃÈçÏÂÏÂÁî¾ÙÐÐ×°Öãº

sudo apt-get install pacemaker corosync

µÇ¼ºó¸´ÖÆ

È»ºó £¬±à¼­/etc/corosync/corosync.confÎļþ £¬ÉèÖÃȺ¼¯²ÎÊý£º

sudo vi /etc/corosync/corosync.conf

µÇ¼ºó¸´ÖÆ

ÀýÈç £¬ÒÔÏÂÊÇÒ»¸öʾÀýÉèÖÃÎļþ£º

totem {
 version: 2
 secauth: on
 cluster_name: mycluster
 transport: udpu
}

nodelist {
 node {
     name: node1
     ring0_addr: 10.0.0.1
 }
 node {
     name: node2
     ring0_addr: 10.0.0.2
 }
 node {
     name: node3
     ring0_addr: 10.0.0.3
 }
}

quorum {
 provider: corosync_votequorum
 two_node: 1
}

logging {
 to_logfile: yes
 logfile: /var/log/corosync.log
 to_syslog: yes
}

µÇ¼ºó¸´ÖÆ

µÚÈý²¿·Ö£º²âÊԺ͹ÊÕÏɨ³ý

Æô¶¯¼¯ÈºÈí¼þ

ÔÚÿ¸ö½ÚµãÉÏÆô¶¯¼¯ÈºÈí¼þ£º

sudo service corosync start
sudo service pacemaker start

µÇ¼ºó¸´ÖÆ

ÉèÖü¯Èº×ÊÔ´

ͨ¹ýʹÓü¯ÈºÖÎÀí¹¤¾ß £¬Èçcrmsh»òpcs £¬ÉèÖü¯Èº×ÊÔ´¡£ÒÔÏÂÊÇÒ»¸öʾÀýʹÓÃpcsÉèÖü¯Èº×ÊÔ´µÄÏÂÁ

sudo pcs resource create fs ocf:heartbeat:Filesystem device="/dev/sdb" directory="/mnt" fstype="ocfs2" cluster_options="noatime" op start timeout="90s" op stop timeout="100s" op monitor interval="10s"

µÇ¼ºó¸´ÖÆ

²âÊÔ¼¯ÈºÎļþϵͳ

ÔÚÒ»¸ö½ÚµãÉϹÒÔؼ¯ÈºÎļþϵͳ²¢¾ÙÐжÁд²Ù×÷£º

sudo mount /dev/sdb /mnt

µÇ¼ºó¸´ÖÆ

½áÂÛ£º

ͨ¹ý±¾ÎĵÄÏÈÈÝ £¬ÎÒÃÇÏàʶµ½ÔõÑùÔÚLinuxÉÏÉèÖÃÒ»¸ö»ù±¾µÄ¼¯ÈºÎļþϵͳ¡£ÔÚÏÖʵµÄÉú²úÇéÐÎÖÐ £¬Äú¿ÉÄÜÐèÒª¸üÖØ´óµÄÉèÖÃÀ´ÊµÏÖ¸ü¸ß¼¶µÄ¹¦Ð§ºÍÐÔÄÜ¡£¿ÉÊÇ £¬Õâ¸ö»ù´¡ÉèÖÿÉÒÔ×ÊÖúÄú×îÏÈʹÓü¯ÈºÎļþϵͳ £¬²¢ÎªÄúÌṩһ¸öѧϰºÍʵÑéµÄƽ̨¡£

²Î¿¼ÎÄÏ×£º

Ubuntu¹Ù·½Îĵµ£ºhttps://help.ubuntu.com/

Linux Cluster HOWTO: http://linux-ha.org/

Corosync¹Ù·½Îĵµ£ºhttps://corosync.github.io/corosync/

´úÂëʾÀý£º

#!/bin/bash

# Set up network interfaces
echo "auto eth0" >> /etc/network/interfaces
echo "iface eth0 inet static" >> /etc/network/interfaces
echo "address 192.168.1.10" >> /etc/network/interfaces
echo "netmask 255.255.255.0" >> /etc/network/interfaces
echo "gateway 192.168.1.1" >> /etc/network/interfaces

# Install required packages
apt-get update
apt-get install -y pacemaker corosync ocfs2-tools

# Create iSCSI storage device
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2021-01.com.example:storage
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb

# Install and configure cluster software
apt-get install -y pacemaker corosync
cat << EOF > /etc/corosync/corosync.conf
totem {
    version: 2
    secauth: on
    cluster_name: mycluster
    transport: udpu
}

nodelist {
    node {
        name: node1
        ring0_addr: 10.0.0.1
    }
    node {
        name: node2
        ring0_addr: 10.0.0.2
    }
    node {
        name: node3
        ring0_adddr: 10.0.0.3
    }
}

quorum {
    provider: corosync_votequorum
    two_node: 1
}

logging {
    to_logfile: yes
    logfile: /var/log/corosync.log
    to_syslog: yes
}
EOF

# Start cluster software
service corosync start
service pacemaker start

# Configure cluster resource
pcs resource create fs ocf:heartbeat:Filesystem device="/dev/sdb" directory="/mnt" fstype="ocfs2" cluster_options="noatime" op start timeout="90s" op stop timeout="100s" op monitor interval="10s"

# Mount cluster filesystem
mount /dev/sdb /mnt

µÇ¼ºó¸´ÖÆ

±¾ÎÄÏÈÈÝÁËÔõÑùÔÚlinuxÉÏÉèÖü¯ÈºÎļþϵͳ £¬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Í¨¹ýƾ֤±¾Îĵİ취¾ÙÐвÙ×÷ £¬Äú¿ÉÒÔÔÚLinuxЧÀÍÆ÷ÉÏʵÏָ߿ÉÓᢸßÐÔÄܵÄÎļþϵͳ¡£Ï£ÍûÕâƪÎÄÕÂÄܹ»¶ÔÄúÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖü¯ÈºÎļþϵͳµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ