Build HA Based on RHEL6.3-KVM three-node Virtual Machine command line

Source: Internet
Author: User
We have been experimenting with the RedHat5 and 6 Versions of HA since January May of this year. I found the HA manual of version 6 on the Internet and found that although the project uses the dual-node mode most, if the dual-node mode is only for HA, A three-node or more arbitration disk is required. In addition, the HA project generally uses a graphical interface, such as system-config-cluster of version 5 and LUCI of version 6. The command line is also set up in Linux.

Start

We have been experimenting with the RedHat5 and 6 Versions of HA since September of this year. I found the HA manual of version 6 on the Internet and found that although the project uses the dual-node mode most, if the dual-node mode is only for HA, A three-node or more arbitration disk is required. In addition, the HA project generally uses a graphical interface, such as system-config-cluster of version 5 and LUCI of version 6. The command line is also set up in a Linux system, the command line for CCS of version 6 is recorded in the HA manual.

After a weekend, I tried to build HA using command lines in a three-node environment. Because I don't have a suitable device, I want to use a virtual machine. The biggest problem in a virtual machine environment is the fence device. After searching for a long time on the Internet, I found that if vmware-workstation does not support the fence function (Version 9 has never been used and is not supported by version 8 ). Unless it is an ESX or vmware-server product, I personally think it is possible that the virtualization layer must beEssenceIt is an operating system rather than an application software. At the end of the show, I found a blog in CSDN that helped me a lot. Using the rhel kvm virtual machine, we will record the experiment results in two days.

 

Cheng

Let's talk about the environment:

Use my notebook to run the vmware-workstation8.0, create a virtual machine RHEL6.3-x64; Memory 4 GB; hard disk 50 GB with 10 GB, single Nic, host name is server6. Fortunately, the notebook memory is large enough (8 GB), otherwise it will be suspended: the CPU of the virtual machine system must support virtualization technology, which should be set when selecting the virtual machine hardware configuration. There is a virtualization engine option in the Virtual Machine CPU item, the configuration is as follows:

After installing the system, set up the underlying application:

Configure the network, and the IP address is 192.168.0.10. In fact, I love how to set it up, just to connect to my local (LAPTOP) for ssh convenience;

The Master name is server6, and the root password is 123456;

To install the FTP components, go to the Packages directory on the installation CD and run the rpm command to install the vsftpd and ftp components. The ftp component is installed because I found that the configuration of YUM is in the ftp MODE. If the ftp component is not installed, other machines can use the YUM of the local machine, but the local machine cannot install anything, haha.

YUM source (vsftp), if it's just a general application, yum's repo file can be written very easily, but if you want to use a large component or kit, you need to configure it comprehensively, as shown below for my profile rhel-server.repo


[Rhel-main]
Name = Red Hat Enterprise Linux $ Main
Baseurl = ftp: // 192.168.122.1/pub/
Enabled = 1
Gpgcheck = 0
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Rhel-Server]
Name = Server
Baseurl = ftp: // 192.168.122.1/pub/Server
Enabled = 1
Gpgcheck = 0
[HighAvailability]
Name = HighAvailability
Baseurl = ftp: // 192.168.122.1/pub/HighAvailability
Enabled = 1
Gpgcheck = 0
[LoadBalancer]
Name = LoadBalancer
Baseurl = ftp: // 192.168.122.1/pub/LoadBalancer
Enabled = 1
Gpgcheck = 0
[ScalableFileSystem]
Name = ScalableFileSystem
Baseurl = ftp: // 192.168.122.1/pub/ScalableFileSystem
Enabled = 1
Gpgcheck = 0
[ResilientStorage]
Name = ResilientStorage
Baseurl = ftp: // 192.168.122.1/pub/ResilientStorage
Enabled = 1
Gpgcheck = 0

We can see that the IP address is 192.168.122.1, and this IP address is the default IP address of the virtual network card after KVM is installed. This YUM is used to provide the installation source for the three virtual machines, so the IP address is written like this;

The scsi-target component is installed because a 10 Gb iscsi disk is required for virtual machines (two hard disks are configured on the local VM );

Kvm component, yum install kvm virt-manager libvirt, in addition to yum install qemu \*. Otherwise, an error will be reported when KVM is started;

Luci components, in case of poor command line configuration, you can go through the web interface to see the situation, or compare the differences between the two to find the correct path, during the two-day experiment, I felt that the decision was wise;

Finally, disable the firewall and selinux, list the port numbers of all services in the cluster on the Internet, and configure iptables. I think this is the first time to use the command line to build a three-node service. You can do this first and sometimes re-configure the firewall.

Start the kvm service and start it on its own after all underlying systems are built (especially kvm ).

/Etc/init. d/lib1_d start & chkconfig lib1_d on

Check the KVM running status lsmod | grep kvm *

Kvm_intel 52570 0

Kvm 314739 1 kvm_intel

If the above result is displayed, the kvm runs normally.

Before using KVM to create a virtual machine, you need to put the rhel6.3 image into the local virtual machine drive, so that KVM can automatically identify the installation source. The installation process is not detailed. After all, this topic is HA rather than KVM.

Run the virsh-c qemu command: // system list.

 

Id Name State

----------------------------------------------------

1-RHEL6.3-HA1 running

2-RHEL6.3-HA2 running

3 RHEL6.3-HA3 running

We can see that all three VMS are running, and KVM also provides a graphical interface to run virt-manager.

After installation, configure the underlying components and services of the three VMS.

Host Name: s1.example.com s2.example.com s3.example.com

IP Address: 192.168.122.2 192.168.122.3 192.168.122.4

The hosts of the local virtual machine is as follows:

192.168.122.2 s1.example.com s1
192.168.122.3 s2.example.com s2
192.168.122.4 s3.example.com s3
192.168.122.1 server6

The three-node root password is 123456.

YUM sources are the same as local virtual machines. Firewall and SELINUX are disabled.

Install the iscsi component and apache2. The service started by HA in this experiment is apache2, and the site files are all on the iscsi disk.

First, operate on s1. The iscsi disk is recognized as/dev/sda and needs to be divided into two zones, one being the storage site file; the other being used as the arbitration disk.

The final result is:

 

Device Boot Start End Blocks Id System

/Dev/sda1 1 955 977904 83 Linux

/Dev/sda2 956 10240 9507840 83 Linux

Sda1 is used as an arbitration disk, so it will not be used for the moment;

Format sda2 and mount it to/mnt. Create a wwwdirectory and index.html under The directory to facilitate The experiment, write a sentence to The index.html file, echo "The page for HA in ccs">/mnt/www/index.html

Install apache2 and point the default site path to/mnt/www/to verify that the apache configuration is successful. Then, detach sda2, attach sda2 to apache2, and then uninstall sda2. The apache2 service is not started automatically.

Install the HA component. According to the configuration file of my YUM source, the installation is simple. yum groupinstall High *

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.