How to activate a volume group exclusively on CentOS

Source: Internet
Author: User

How to activate a volume group exclusively on CentOS

Requirement Background: The shared disk must be activated exclusively on the CentOS dual-host. That is, the shared disk is only attached to one machine, and the other machine cannot be mounted at the same time, if necessary, you can manually switch and mount to another machine.

Implementation Method: relying on the rhcs cluster function, vgchange-a e is used for exclusive activation.

I. Environment preparation


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

Vim/etc/hosts

192.168.58.20 vm-test01
192.168.58.21 vm-test02


Ii. Install the Cluster

1. Install software packages related to the rhcs Cluster

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



2. Start the cluster service


Service luci start
Service ricci start
Service rgmanager start
Service cman start


If an error occurs when starting cman:
Starting cman... Xmlconfig cannot find/etc/cluster. conf [FAILED] is because the node has not been added to the cluster and no configuration file/etc/cluster. conf is generated.
Negligible


3. Set the cluster service to start automatically


Chkconfig luci on
Chkconfig ricci on
Chkconfig rgmanager on
Chkconfig cman on




4. Modify the ricci User Password

Use the passwd ricci command to set your ricci password to the root password.


3. Configure the Cluster


Ie log on to https: // 192.168.58.20: 8084


Create cluster


4. Create a volume group with a shared Disk
Pvcreate/dev/sdb
Vgcreate vgrhcs1/dev/sdb
Lvcreate-L 20 m-n lvtest1 vgrhcs1
Mkfs. ext3/dev/vgrhcs1/lvtest1
Mkdir/rhcs1


Synchronize volume group information on another node
Pvscan
Vgscan
Vgchange-a n vgrhcs1


Run the following command on both nodes:
Vim/etc/lvm. conf
Locking_type = 3


Add the cluster attribute of the node to the node activated by vg and run
Vgchange-a n vgrhcs1
Vgchange-c y vgrhcs1

5. Exclusively activate a volume group

Vgchange-a e vgrhcs1
Mount/dev/vgrhcs1/lvtest1/rhcs1 mount to ensure that the vg cannot be activated on any node.


Note: vgchange-a y vgxx indicates that the volume group is activated on all nodes.

Vgchange-a n vgxx indicates that the volume group is activated on all nodes.

Vgchange-a e vgxx indicates that the volume group is activated exclusively on a node.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.