High Availability cluster configuration in RedHatAS3
Source: Internet
Author: User
High Availability cluster configuration in RedHatAS3-Linux Enterprise Application-Linux server application information. For details, refer to the following section. This article references part of the chinaunix Forum rdd Brothers article http://www.chinaunix.net/jh/4/325828.html (RedHat AS2.1 cluster configuration StepbyStep under Vmware, in addition, the configuration on AS3.0 is more user-friendly than the HA configuration of AS2.1, according to the Red Hat Cluster Suite routing and management a luster document on the redhat official website, however, there are many differences between the configuration of AS2.1 and AS2.1, which is also the reason why I failed to follow the rdd brothers' article for successful configuration. There is almost no Chinese information about redhat AS3.0HA configuration on the network, I found very few E files and found only the configuration instructions on the redhat official website.
???????????????????????????????????????
Implementing system software and hardware Environments
Hardware: p4 2.4G, 80G, 512 M DDR
Host system: win2000pro sp4
Virtual Machine Software: Vmware GSX Server 3.1
Install the basic systems of Vmware GSX Server 3.1 and Redhat AS3.0
1. Install Vmware GSX Server3.1
I believe that all of you have installed workstation, and the process is almost the same. There is not much nonsense here. One thing to note is that VMware GSX Server2.5 cannot open the Virtual System of Vmware workstation4.52, GSX Server2.5 is earlier than 4.52, so .......
2. Install Redhat AS3.0
Remember to install the xwindows desktop system. Set the hostname to linux1 and the ip address to 10.0.0.155.
3. COPY and configure another AS3.0 system to COPY the files of the first system installed to another folder. Open the rhel3.vmx file in the editor and modify displayName? =? "Linux1" to "Linux2"
Modify the Virtual Hardware configuration of the system and delete the NIC, as shown in. The reason for this step is that if the files copied from the first system run simultaneously, the MAC addresses of the two systems may conflict. Because the network adapter is deleted, the second system must be started after the system is deleted, when the kudzu process is started, the system will prompt that there are redundant configuration files (that is, the configuration file of the NIC has been deleted), select to delete the redundant configuration files, and then disable the linux2 system, add a new Nic to linux2. Start linux2 again
Start linux2. During the startup process, the system detects the NIC because the NIC is added again. Then, reconfigure the NIC and set the IP address of linux2 to 10.0.0.156. (Note: Some people may think this is troublesome, but the MAC address conflict of the network card is also impossible. Who makes us lazy and don't want to reinstall a system)
Check the following files to modify the Host Name and network configuration file.
# Vi? /Etc/sysconfig/network
Change HOSTNAME = linux1 to HOSTNAME = linux2
# Vi? /Etc/hosts
Change 10.0.0.155 linux1 to 10.0.0.156 linux2
(Note: Some may ask, why not write linux1 and heartbeat addresses in the hosts file directly? In fact, I am doing this to make the document clearer, to add these items at the next step, although it is a little troublesome, but it can be avoided by some friends who do not understand)
In this way, the two complete AS3.0 systems are successfully configured and enter the second stage.
Ii. Use Vmware to virtualize and configure hardware required for HA
1. Create a New Nic for each of the two systems
Turn off the two systems and add a network adapter working in the bridge mode to each of the two systems. The method is similar to that shown in the first figure.
2. Create a shared Disk
Create a shared disk sdb for the HA system. The size is 500 mb, as shown in.
First, enable the linux1 system settings and create a disk. the disk file name is share. vmdk. Select the Allocate all disk space now option.
We recommend that you set the mount point of the newly added disk to scsi 1:0, as shown in. This is the bare device of the system.
Then, enable the linux2 settings and add a shared disk to linux2. However, this time, the existing disk is selected, and the shared disk used is the one just created for linux1, as shown in
Also in Configuration? Editor? Modify the "Vitual? Disk? Node "is scsi? 1:0
In this way, a new Nic and a shared disk are created for each system. Because the disk will be locked when the system starts, when linux1 is started, the shared disk will be locked, and linux2 will not be able to start. Therefore, you must make some settings, open the rhel3.vmx file in the two Vmware folders in the editor, and add the following line:
Disk. locking? =? False
In this way, the hardware is configured.
3. Configure the newly added Nic
Start the linux1 system. The system detects the newly added nic at startup. Select Configuration and set the IP address of the second Nic to 192.168.123.1.
Modify the/etc/hosts file of the linux1 system. The modified content is as follows:
Start the linux2 system at the same time. The setting method is the same as that of linux1.
4. Configure the shared Disk
Run linux1 in shell
# Fdisk/dev/sdb // note that parted can also be used
The added shared disk is divided into two zones: sdb1 and sdb2, each of which is MB in size.
Edit the/etc/sysconfig/rawdevices file on the two servers and bind the partition to the bare device.
# Vi? /Etc/sysconfig/rawdevices
Join
/Dev/raw/raw1/dev/sdb1
/Dev/raw/raw2/dev/sdb2?
Restart service
# Service? Rawdevices? Restart
Run
# Raw? Qa, the following content is displayed
/Dev/raw/raw1: bound to major 8, minor 17
/Dev/raw/raw2: bound to major 8, minor 18
Format the shared disk. The size of each disk is 4 kb.
Mkfs. ext3-j-B 4096/dev/sdb1
Mkfs. ext3-j-B 4096/dev/sdb2
Note: use the "-B" option to set the disk block to 4 K. A small block will consume too much time for disk check.
Modify/etc/sysconfig/rawdevices in linux2 and restart the rawdevices service? Qa Check System
Now, hardware preparation is complete.
3. install and configure the basic HA System
Here we only configure the CLUSTER service that comes with AS3.0, which involves the specific http, ftp, mysql, and oracle HA services will be introduced in the next section.
Installation confirmation the HA software package of AS3.0 is installed in the system
Here, we mainly use two software packages: clumanager and redhat-config-cluster.
Use rpm? Run the q command to check whether these two software packages are installed. If they are not installed, install them using the following methods:
With ISO or CD, AS3.0 has a total of eight CDs. We usually only use the first four, and the other four, the third of which is the cluster software, also includes IPVS
Software, such as software installed on the CD, such as downloading these two software packages on the network for separate installation
Rpm -- Uvh clumanager-; .. rpm
Rpm -- Uvh redhat-config-cluster-;. noarch. rpm
Note: There are many src software packages on the network. After downloading the software package, you must use the rpmbuild command to re-compile the software and install the software.
Start basic HA Configuration
Start xwindows on linux1. I am running gnome and start to run the Configuration tool.
Select the icon in the lower left corner, system settings, server settings, and Cluster (or run # redhat-config-cluster in the command line)
The following figure is displayed (garbled characters in the upper left corner of the terminal are displayed because I am using remote XWINDOWS and the settings are incorrect)
Next, click cluster> configuration in the menu bar.
Shown in
You can change the Cluster Name in the Cluster Name field. Here I set it to test_cluster.
Then, add the members in the cluster, and click menu bar> create, as shown in
(Note: Make sure that the following content is displayed only when Members is selected in the list)
Enter the Ip addresses of both machines, as shown in figure
Select cluster> shared state in the menu bar to view the bare device settings, as shown in figure
Click OK to continue
Open clusterdaemon properties in the menu bar and the following window appears.
This window is the cluster configuration window. For details, please refer to the redhat official documentation.
One note is that the slide bar in the middle is to configure the server to wait for 15 seconds. We cannot set it too small. Here we use 15 seconds by default.
In the clumembd window, select Enable Broadcast Heartbeating and click OK. A Window prompt will pop up, because we configure dual-node HA, so no
Manage it, click OK, and then exit the window after saving the cluster configuration.
Start the local cluster daemon on the menu bar. Wait a moment and the following status will appear.
The cluster on linux1 is successfully configured.
Then we need to configure linux2. configuring linux2 is actually very simple. COPY the/etc/cluster. xml file in the linux1 system to the/etc/directory of linux2.
(Note: cluster. xml is not generated when two software packages are installed. It is generated when the redhat-config-cluster command is run for the first time, and the cluster in AS2.1. conf stores the same content, but the format is changed. This is the main configuration file of the Cluster. Make sure that the file is the same for each node on the cluster. In addition, the redhat official document strongly warns you: do not manually modify the xml file ,)
Copy this file to linux2 and then execute it in the linux2 command line.
# Service clumanager start
The system shows that the execution is successful. Wait a moment and you will find a change in linux1, as shown in
The command for starting and disabling cluster services is service clumanager start | stop.
(Note: If you do not want to use the GUI to monitor node running after the configuration is complete, run it in shell.
# Clustat? I 10 // status monitoring, refresh every 10 seconds
The following result is displayed:
QUOTE:
Cluster Status-test_cluster 13:57:22
Cluster Quorum Incarnation #1
Shared State: Shared Raw Device Driver v1.2
Member Status
----------------------------
10.0.0.155 Active <-- You are here
10.0.0.156 Active
Service Status Owner (Last) Last Transition Chk Restarts
----------------------------------------------------------------
In this way, a "Bare" cluster system that does not contain any services is successfully configured because it does not contain any applications and makes no sense, next, we will configure a common http service to test it.
4. Example: configure the HA service of the HTTP Server
1. Add a shared disk to the http service
On the disk, the program files shared by apache are stored on the two systems. That is to say, apache's zoonetroot is put on this shared disk, which is created in the same way as when a bare device is created. Please note that, this shared disk is different from the bare device above.
2. Create a shared Disk Load point and configure the http service on the two machines.
Start two machines. Here I add a new hard disk as sdc. I format it in ext3 format and create the www folder under the root directory of each machine as the apache web directory, at the same time, load the created sdc1 partition to the/www directory.
# Mkdir/www
# Mount/dev/sdc1/www // this step is only performed on linux1.
Then install apache. You don't need to talk about it. Point out that the apache installation on the two machines must be the same, including the configuration file. After the installation is complete, modify httpd. conf: point the root directory to/www. Here I use the RPM package of apache2.0 that comes with AS3.0,
On linux1, go to the/wwwdirectory and save index.html in the directory for testing.
In this way, the http service on the two machines is fully configured.
3. Configure the http service based on the Cluster
On xwindows Linux of linux1, start the cluster configuration tool (refer to), add the "new" service name "httpd" in the httpd service menu bar, and set the detection interval to 4 seconds, the httpd service startup script is the apache STARTUP script. Here I use the rpm package's default installation script/etc/rc. d/init. d/httpd
Click "OK" to add a service, as shown in
As shown in, select the httpd service and click "Add Child" in the menu bar, as shown in
Add Device to the shared Device of the httpd service first. The Device point is the sdc1 we created, the loading point is/www, the format is ext3, and the mode is rw read/write mode. Click OK, add an IP address for this service. This IP address is the IP address accessed by the client browser. We set it to 10.0.0.157, the mask is the same as the network setting, and set it to 255.0.0.0, and the broadcast address to 10.0.0.255.
This completes adding, as shown in figure
Save settings and return to the cluster monitoring status
All the above operations are performed on linux1. To ensure that the configuration of linux1 and linux2 clusters is the same, copy the/etc/cluster. xml of linux1 to/etc/cluster. xm of linux2.
L. Start the cluster service on the two machines at the same time, view the monitoring status chart again, and you will find that a new service has been added. Click "enable" and "run" the service above, the HTTP service is running.
In this way, the http service in the entire cluster is configured and started to run.
5. perform a simple test on the configured Service
1. Test basic functions
Enter 10.0.0.157 in IE on the Windows Server, and you will see the test page under the/www directory.
2. if one of the machines is disabled in the fault test, you will find that 10.0.0.157 is still accessible. You can use ssh to connect to this IP address, you will find that you are connected to a running machine.
3. if you manually disable the apache service, the cluster software will still start the apache service. That is to say, the service is controlled by the cluster software, rather than manually, unless you stop the clumanger service.
Vi. Postscript
With the cluster software of AS3.0, the configuration is still quite flexible. In its official documentation, I will illustrate how to use this software to configure multiple services such as Oracle, MySQL, Samba, NFS, and HTTP. I am also preparing to configure the Oracle HA service. Due to my limited level, I agree to have many mistakes in this article. In fact, I am still a bit confused about some of them. If there are any mistakes, please point out that nothing has happened recently, I have been studying clusters, load balancing this thing, the next step is to study lvs, interested friends can study together, Emailushli@163.net.
I 've been mixing it in CU for more than two years. I wrote something seriously for the first time. It's really awesome ........
This article corresponds to the one written the day before. In fact, redhat in the console also provides a powerful set
The main command is redhat-config-cluster-cmd. In addition
Clusvcadm, clushudown, and other commands. The following describes how to use the commands in the console in the previous article
Configure and repeat.
1. List the current cluster name
Redhat-config-cluster-cmd -- cluster
2. Set the current cluster name to "test_cluster"
Redhat-config-cluster-cmd -- cluster -- name = 'test _ cluster'
3. display the current bare device status
Redhat-config-cluster-cmd? Sharedstate
4. Add a cluster node named "10.0.0.155"
Redhat-config-cluster-cmd -- add_member -- name = 10.0.0.155
5. Modify the name of a node from member2 to member3.
Redhat-config-cluster-cmd -- member = member2 -- name = member3
6. delete a node named member3.
Redhat-config-cluster-cmd -- member = member3 -- del_member
7. List the services in the current cluster
Redhat-config-cluster-cmd? Services
8. Add a service named httpd.
Redhat-config-cluster-cmd -- add_service -- name = httpd
9. List the subnodes under the service named httpd
Redhat-config-cluster-cmd -- service = httpd
10. Set httpd service related information, detection time, startup script, etc.
Redhat-config-cluster-cmd -- service = httpd \
-- Checkinterval = 15 \
-- Userscript =/etc/rc. d/init. d/httpd
11. Delete the cluster service named httpd
Redhat-config-cluster-cmd -- service = httpd \
-- Del_service
12. List httpd service IP addresses
Redhat-config-cluster-cmd -- service = httpd \
-- Service_ipaddresses
13. Set the external service IP address of httpd to 10.0.0.157.
Redhat-config-cluster-cmd -- service = httpd \
-- Add_service_ipaddress \
-- Ipaddress = 10.0.0.157
14. Set the mask address and broadcast address of the Service ip address of the other party.
Redhat-config-cluster-cmd -- service = httpd \
-- Service_ipaddress = 10.0.0.157 \
-- Netmask = 255.0.0.0 \
-- Broadcast = 10.0.0.255
15. Delete the IP address 10.0.0.157 of the httpd service.
Redhat-config-cluster-cmd -- service = httpd \
-- Service_ipaddress = 10.0.0.157 \
-- Del_service_ipaddress
16. List httpd service devices
Redhat-config-cluster-cmd -- service = httpd \
-- Devices
17. Add the shared disk sdc1 to the httpd service
Redhat-config-cluster-cmd -- service = httpd \
-- Add_device \
-- Name =/dev/sdc1
18. Set shared disk Parameters
Redhat-config-cluster-cmd -- service = httpd \
-- Device =/dev/sdc1 \
-- Mount \
-- Mountpoint =/www \
-- Fstype = ext3 \
-- Options = rw \
19. Enable the httpd service on the 10.0.0.155 Node
Clusvcadm-e httpd-m 10.0.0.155
20. Disable the httpd service on the 10.0.0.155 node.
Clusvcadm-d httpd-m 10.0.0.155
21. Stop the httpd service on the 10.0.0.155 node.
Clusvcadm-s httpd-m 10.0.0.155
For more commands, run the following commands on the console:
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.