Menu

11 Mart 2013 Pazartesi

Virtual Box Uzerinde OCFS2 kurulumu

Merhaba, Baslik biraz kisa oldu :) aslinda baslik Virtualbox Uzerinde calistirdigimiz iki linux makine arasinda OCFS2 ile paylasilan disk nasil olusturabiliriz onu gorecegiz.

Virtual RAC

Ilk once, virtualbox uzerinde paylasilan(sharedable) bir disk olusturmali ve her iki makineye baglamaliyiz.
1. Kendi makinemizde:
   sudo bash
  [sudo] password for easlan:
  root@ertugrul:~# mkdir -p /storage/disk1
  root@ertugrul:~# chmod -R 777 /storage/disk1
  root@ertugrul:~# chmod -R 777 /storage/disk1
  easlan@ertugrul:~$ cd /storage/disk1

 # Sonra disk olusturuyoruz
  easlan@ertugrul:/disk1$ VBoxManage createhd --filename sanaldisk.vdi --size 5120 --       format VDI --variant Fixed
  0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
  Disk image created. UUID: 5cd924a1-59ce-421c-b9c7-7a59769f4c3f
  # Virtual Makinemize bagliyoruz.
  easlan@ertugrul:/disk1$ VBoxManage storageattach wlserver1 --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium sanaldisk.vdi --mtype shareable
  # Paylasilan yapiyoruz.
  easlan@ertugrul:/disk1$ VBoxManage modifyhd sanaldisk.vdi --type shareable
  -- Ikinci Makine icin olusturdugumuz diski gosteriyoruz.
  easlan@ertugrul:/disk1$ VBoxManage storageattach wlserver2 --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium sanaldisk.vdi --mtype shareable  
  wlserver1 linux makinemiz icersinden :
  [oracle@linux1 dev]$ cd /dev
  [oracle@linux1 dev]$ ls sd*
  sda  sda1  sda2  sdb   
   ~ Sonra her iki makineyede OCFS2 kurariz.


OCFS2 kurmak icin, linux makinemizin kernel versiyonunu ogrenerek indirip yukluyoruz.


# rpm -Uvh ocfs2-2.6.18-194.el5-1.4.7-1.el5.x86_64.rpm \ ocfs2console-1.6.3-2.el5.x86_64.rpm \ ocfs2-tools-1.6.3-2.el5.x86_64.rpm \ ocfs2-tools-debuginfo-1.6.3-2.el5.x86_64.rpm
Sonra ocfs2console`u baslatiyoruz.
[root@wlserver1 /]# ocfs2console
OCFS2 Console

Sonra Cluster > Configure Nodes
OCFS2 Information

Burada kac tane node`umuz varsa onlarin hepsini ekliyoruz.
OCFS2 Node Configuration





Icinden "/etc/init.d/o2cb" asagidakileri siliyoruz.
### BEGIN INIT INFO## Provides: o2cb## Required-Start: $network## Should-Start:## Required-Stop:## Default-Start: 2 3 5## Default-Stop:## Description: Load O2CB cluster services at system boot.### END INIT INFO
Asagidaki komutlari calistiyoruz.
[root@wlserver1 /] chkconfig --del o2cb 
[root@wlserver1 /] chkconfig --add o2cb 
[root@wlserver1 /] chkconfig --list 
o2cbo2cb 0:off 1:off 2:on 3:on 4:on 5:on 6:off
    [root@wlserver1 /] /etc/init.d/o2cb offline ocfs2
Cleaning heartbeat on ocfs2: OK
Stopping cluster ocfs2: OK
#
[root@wlserver1 /] /etc/init.d/o2cb unload
Unmounting ocfs2_dlmfs filesystem: OK
Unloading module "ocfs2_dlmfs": OK
Unmounting configfs filesystem: OK
Unloading module "configfs": OK
#
[root@wlserver1 /] /etc/init.d/o2cb configure
Configuring the O2CB driver.
This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets ('[]'). Hitting
without typing an answer will keep that current value. Ctrl-C
will abort.
Load O2CB driver on boot (y/n) [y]:
Cluster to start on boot (Enter "none" to clear) [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
[root@wlserver1 /] cd /dev 
[root@wlserver1 /] ls sd*
                     sda sda1 sda2 sdb 
[root@wlserver1 /] fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Sonra ocfs2console yeninden aciyoruz ve diski mount edecez.

[root@wlserver1 /] ocfs2console 

Menuden Tasks > Format
OCFS2 Format

OCFS2 Console

Gelen pencereden mount etmek istediginiz yolu seciyoruz.
 Mountpoint : /paylasilan

ve son olarak diskimizi automount olabilmesi icin fstab altina ekliyoruz.
[root@wlserver1 /] vi /etc/fstab
/dev/sdb1 /paylasilan ocfs2 _netdev,datavolume 0 0
Bukadar suanda her iki node`da /paylasilan altini ortak olarak kullanabiliriz.

~~~~~~~~~~~~~~~~~~~~~~ Yaptiklarimizi test etmek icin~~~~~~~~~~~~~~~~~~~~~~~
Herhangi bir node uzerinde /paylasilan adinda olusturdugumuz klasor icinde bir dosya olusturalim ve diger tarafda gorunecekmi bakalim.
node1 uzerinden
[oracle@wlserver1 /]$ cd /paylasilan/
[oracle@wlserver1 paylasilan]$ vi deneme.txt
node2 uzerinden
cd /paylasilan/
[oracle@wlserver2 paylasilan]$ ls
deneme.txt  lost+found
[oracle@wlserver2 paylasilan]$ cat deneme.txt
Bu ocfs2 denemesidir.
[oracle@wlserver2 paylasilan]$ vi deneme.txt
[oracle@wlserver2 paylasilan]$ cat deneme.txt
Bu ocfs2 denemesidir.
Simdi ikinci nodedan actik
node1 uzerinden
[oracle@wlserver1 paylasilan]$ cat deneme.txt
Bu ocfs2 denemesidir.
Simdi ikinci nodedan actik
## Yukaridada goruldugu gibi suanda hangi makinede degisiklik yapsak aninda digeri goruyor.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Burada mesala node1 kapatip actiginizda node2 bu alanda degisiklik yapabilecek ve node1 tekrar basladiginda node2`nin yaptigi degisiklikleri gorecektir.

Hiç yorum yok:

Yorum Gönder