I. Preparations
Virtual System: VM esx 4.1 IP: 172.21.2.184
Install sshd by default.
Vi/etc/ssh/sshd_config
Change PermitRootLogin no to PermitRootLogin yes, save and exit
Then Restart sshd.
Service sshd restart
In this way, you can remotely log on to this virtual machine using ssh.
Use IE to access http: // 172.21.2.184 and download vSphere Client and vSphere Vcenter
Install the vSphere Client.
Ii. Create a VM
Create two virtual hosts
System: centos 5.4
Hard Disk; 20 GB
Memory: 388 MB
Set only one Nic. The heartbeat IP uses a private IP address. This is the test environment.
The IP addresses are 172.21.2.177 and 172.21.2.43 respectively.
Host Name: VMZJJTES01 and VMZJJTEST02
Disable the firewall and selinux for testing convenience.
Enter the created VM system.
Edit the hosts file
Vi/etc/hosts
127.0.0.1 vmzjtest01 localhost. localdomain VMZJJTEST01
: 1 localhost6.localdomain6 localhost6
172.21.2.177 VMZJJTEST01
172.21.2.43 VMZJJTEST02
And
127.0.0.1 vmzjtest02 localhost. localdomain VMZJJTEST02
: 1 localhost6.localdomain6 localhost6
172.21.2.177 VMZJJTEST01
172.21.2.43 VMZJJTEST02
View System Kernel
Uname-
Linux VMZJJTEST02 2.6.18-164. el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 GNU/Linux
The virtual machine is ready.
3. Create a virtual shared Disk
Use putty to remotely log on to the 172.21.2.184 virtual server.
Create Disk
Cd/vmfs/volumes/4 exxxxxxxxxxxxxx
The above 4exxxxxx varies depending on the virtual server.
Mkdir mydisk
Cd mydisk
Create a 10 Gb shared Disk
Vmkfstools-c 10240 m-a lsilogic-d eagerzeroedthick mydisk. vmdk
4. Add a Virtual Disk
Log on to the vSphere Client, select VMZJJTEST01, and select edit-add disk-select existing virtual disk-independent-permanent. Note that if the local hard disk of the virtual machine is scsi 0 node, such as scsi0: 0, then the added virtual shared disk should be set to scsi1: 0 or a later node. This is important.
Go to the directory where the VM of 172.21.2.184 is located.
Cd/vmfs/volumes/4 exxxxxxxxxxxxxx
Edit VMZJJTEST01.xmx
You need to modify or add the following items:
Scsi1.sharedBus = "virtual"
Disk. locking = "false"
DiskLib. dataCacheMaxSize = "0"
DiskLib. datachemaxreadaheadsize = "0"
DiskLib. DataCacheMinReadAheadSize = "0"
DiskLib. dataCachePageSize = "4096"
DiskLib. maxUnsyncedWrites = "0"
In this way, the virtual shared disk is added, and you can add another one.
V. Installing ocfs2
Download the corresponding ocfs2 version based on the kernel.
Download three installation packages in the following order:
Ocfs2-tools-1.4.4-1.el5.i386.rpm
Ocfs2-2.6.18-164.el5-1.4.7-1.el5.i686.rpm
Ocfs2console-1.4.4-1.el5.i386.rpm
Use rpm-ivh xxxxxx for direct installation.
After the installation is complete, enter the ocfs2 graphic interface
Ocfs2console &
Note: The above graphic interface is obtained using xming software.
Start o2cb
/Etc/init. d/o2cb start
Click-cluster-Configure Nodes in the graphic interface to Configure the node.
Enter the corresponding host name and IP address, and port 7777. Add two hosts here.
Click "application"-"exit ".
Assume that the above configuration is set in VMZJJTEST01. Log on to the machine and run the following command:
Scp/etc/ocfs2/cluster. conf root@172.21.2.43:/etc/ocfs2/
The above command may prompt that the machine 172.21.2.43 has no directory. Please create a directory on this machine
Mkdir/etc/ocfs2
Then, configure the two machines as follows:
/Etc/init. d/o2cb unload
/Etc/init. d/o2cb offline ocfs2
/Etc/init. d/o2cb configure
Processing the O2CB driver. this will configure the on-boot properties of the O2CB driver. the following questions will determine whether the driver is loaded onboot. the current values will be shown in brackets ('[]'). hitting <ENTER> without typing an answer will keep that current value. ctrl-Cwill abort. load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter "none" to clear) [ocfs2]: ocfs2
Writing O2CB configuration: OK
Loading module "configfs": OK
Mounting configfs filesystem at/config: OK
Loading module "ocfs2_nodemanager": OK
Loading module "ocfs2_dlm": OK
Loading module "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at/dlm: OK
Starting cluster ocfs2: OK
The roughly displayed content is shown as above, which is slightly different. Please make your own judgment.
This setting is required for both machines.
6. Partitioning and mounting
Use fdisk/dev/sdb to divide a virtual shared disk into two partitions.
They are/dev/sdb5 and/dev/sdb6.
Run the following command to format the file system:
# Mkfs. ocfs2-B 4 K-C 32 K-N 4-L webdatafile/dev/sdb5
/Dev/sdb6: replace webdatafile with the webos.-L parameter and then set it.
Then create the directories u01 and u02
Mount/dev/sdb5 and/dev/sdb6 to the u01 and u02 directories respectively.
Mount-t ocfs2-o datavolume, nointr-L "webdatafile"/u01
Mount-t ocfs2-o datavolume, nointr-L "webos"/u02
Partition and format the file system on one machine.
However, mounting requires two instances at the same time.
7. Automatically Start o2cb and mount u01 and u02 at startup
Chkconfig -- add o2cb
Chkconfig o2cb on
The fstab for automatic mounting is as follows:
/Dev/sdb5/u01 ocfs2 _ netdev, datavolume, nointr 0 0
/Dev/sdb6/u02 ocfs2 _ netdev, datavolume, nointr 0 0
For more information about the functions and principles of OCFS2, see Gu Ge.
This article is from the "Sui QIQIU" blog