CentOS獨佔啟用卷組的方法

來源:互聯網
上載者:User

CentOS獨佔啟用卷組的方法

需求背景:需要在CentOS的雙機實現共用盤獨佔啟用,即共用盤只掛載在其中一台機器,另一個機器不能同時掛載,必要時候可進行手工切換掛載到另一台機器。

實現方法:依賴rhcs叢集功能,利用vgchange -a e的方式獨佔啟用

一、環境準備


# cat /etc/redhat-release
CentOS release 6.6 (Final)

vim /etc/hosts

192.168.58.20 vm-test01
192.168.58.21 vm-test02


二、安裝叢集

1、安裝rhcs叢集相關軟體包

yum install -y cluster-glue resource-agents pacemaker
yum install -y luci ricci cman openais rgmanager lvm2-cluster gfs2-utils



2、 啟動叢集服務


service luci start
service ricci start
service rgmanager start
service cman start


啟動cman如出現錯誤:
Starting cman… xmlconfig cannot find /etc/cluster/cluster.conf [FAILED] 是因為節點還沒有加入叢集,沒有產生設定檔/etc/cluster/cluster.conf
可忽略


3、 設定叢集服務自啟動


chkconfig luci on
chkconfig ricci on
chkconfig rgmanager on
chkconfig cman on




4、 修改ricci使用者密碼

使用 passwd ricci 命令將使用者 ricci 密碼設定為 root 的密碼


三、配置叢集


ie登入 https://192.168.58.20:8084


create cluster


四、用共用盤建立卷組
pvcreate /dev/sdb
vgcreate vgrhcs1 /dev/sdb
lvcreate -L 20m -n lvtest1 vgrhcs1
mkfs.ext3 /dev/vgrhcs1/lvtest1
mkdir /rhcs1


在另一個節點同步卷組資訊
pvscan
vgscan
vgchange -a n vgrhcs1


在兩個節點均執行:
vim /etc/lvm/lvm.conf
locking_type = 3


在vg啟用的節點,增加節點的cluster屬性,執行
vgchange -a n vgrhcs1
vgchange -c y vgrhcs1

五、獨佔啟用卷組

vgchange -a e vgrhcs1
mount /dev/vgrhcs1/lvtest1 /rhcs1 mount上以後才能保證在任何節點都不能去啟用該vg


註:vgchange -a y vgxx 表示在所有節點啟用卷組

vgchange -a n vgxx表示在所有節點去啟用卷組

vgchange -a e vgxx 表示在一個節點獨佔啟用卷組

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.