What Next: Shared Sybase Installation with OCFS2





Architecture




Prerequisite

You must have installed a Sybase Cluster on VirtualBox with shared virtual disk (cf How to install Sybase ASE Cluster Edition on VirtualBox with Shared Virtual Disk).

Components

  • 2 VMs with Oracle Linux 
  • 1 shared virtual disk for RawDevices (quorum and data)
  • => 1 shared virtual disk for Sybase software installation (Shared Installation) <=
  • 1 NAT Network to communicate with internet and your host
  • 1 Internal network (or private network)


Install OCFS2



To do on both nodes.

Insert Oracle Linux ISO in Virtual Drive


Install Missing Package

[root@oralin11 ~]#
[root@oralin12 ~]#

yum install --enablerepo=media -y ocfs2-tools

Unmount CDROM

[root@oralin11 ~]#
[root@oralin12 ~]#

umount /dev/cdrom

Select "Remove disk from virtual drive"


Configure OCFS2

[root@oralin11 ~]#
[root@oralin12 ~]#

sed -i 's/O2CB_ENABLED=false/O2CB_ENABLED=true/g' /etc/sysconfig/o2cb

/etc/init.d/o2cb load

o2cb_ctl -C -n ocfs2 -t cluster -a name=ocfs2
o2cb_ctl -C -n oralin11 -t node -a number=11 -a ip_address=10.1.0.11 -a ip_port=7777 -a cluster=ocfs2
o2cb_ctl -C -n oralin12 -t node -a number=12 -a ip_address=10.1.0.12 -a ip_port=7777 -a cluster=ocfs2

/etc/init.d/o2cb enable



Backup old Sybase Installation


Remember to use sybase user to administrate Sybase cluster or agents

Shutdown Cluster 

[sybase@oralin11 ~]$

sybcluster -U uafadmin -P -C mycluster -F "oralin11,oralin12"

sybcluster>

connect

mycluster>

Shutdown Cluster

Result:

Are you sure you want to shutdown the cluster? (Y or N): [ N ]
Y

INFO  - Shutdown of cluster mycluster has completed successfully.

Shutdown Agents

To do on both nodes.

[sybase@oralin11 ~]$ 
[sybase@oralin12 ~]$

UAF-2_5/bin/uafshutdown.sh

Result:

2011-07-30 18:08:38,866 INFO  [ShutdownHookThread] Agent smoothly exits.
Shutdown succeeded.

Check Cluster State

[sybase@oralin11 ~]$ 

$SYBASE/$SYBASE_ASE/bin/qrmutil --quorum-dev=/dev/sybase/quorum --display=state

Result:

Executing command 'display', argument 'state'...

State for cluster is 'down' (6).
State for instance 'SYB11' (1) is 'down' (6).
State for instance 'SYB12' (2) is 'down' (6).

Command 'display', argument 'state' succeeded.

qrmutil execution completed.

Backup oralin11

[root@oralin11 ~]#

tar cvfz /media/sf_VirtualBox_Shared/oralin11_opt_sybase.tgz /opt/sybase

Backup oralin12

[root@oralin12 ~]#

tar cvfz /media/sf_VirtualBox_Shared/oralin12_opt_sybase.tgz /opt/sybase/UAF-2_5/nodes/oralin12.cluster* /opt/sybase/ASE-15_0/sysam/SYB12.properties

Remove old "/opt/sybase" entry 

[root@oralin11 ~]#
[root@oralin12 ~]#

sed -i '/\/opt\/sybase/d' /etc/fstab




Modify Cluster Configuration



Backup Cluster Configuration

[sybase@oralin11 ~]$

$SYBASE/$SYBASE_ASE/bin/qrmutil --quorum-dev=/dev/sybase/quorum --extract-config=/media/sf_VirtualBox_Shared/mycluster_private.cfg 

Result:

Executing command 'extract cluster configuration', argument 'mycluster_private.cfg'...

Extracted input file 'mycluster_private.cfg'

Command 'extract cluster configuration', argument 'mycluster_private.cfg' succeeded.

qrmutil execution completed.

Change Configuration

[sybase@oralin11 ~]$

cp /media/sf_VirtualBox_Shared/mycluster_private.cfg /media/sf_VirtualBox_Shared/mycluster_shared.cfg

sed -i 's/installation mode = private/installation mode = shared/' /media/sf_VirtualBox_Shared/mycluster_shared.cfg
sed -i '/errorlog/{n;N;d}' /media/sf_VirtualBox_Shared/mycluster_shared.cfg

Install Modified Configuration

[sybase@oralin11 ~]$

$SYBASE/$SYBASE_ASE/bin/qrmutil --quorum-dev=/dev/sybase/quorum --cluster-input=/media/sf_VirtualBox_Shared/mycluster_shared.cfg

Result:

Loaded a new quorum configuration. qrmutil execution completed.

Stop VMs

[root@oralin11 ~]#
[root@oralin12 ~]#

init 0




Create Shared Virtual Disk



Launch Windows Command 

In Windows, Execute cmd.exe

Type all command below in this window except "C:\Users\fabien>".


Init PATH

C:\Users\fabien>

set PATH=%VBOX_INSTALL_PATH%;%PATH%

Create Shared Disk

Change "C:\Users\fabien\VirtualBox VMs" with your own path to VirtualBox VMs files.

C:\Users\fabien>

vboxmanage createhd --filename "C:\Users\fabien\VirtualBox VMs\sybase_bin.vdi" --size 2048 --format vdi --variant Fixed

Attach Shared Disk to VMs

Change "C:\Users\fabien\VirtualBox VMs" with your own path to VirtualBox VMs files.
Change "SATA controller" according to your language (eg. in French, it's "Controleur SATA" !).

C:\Users\fabien>

vboxmanage storageattach oralin11 --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium "C:\Users\fabien\VirtualBox VMs\sybase_bin.vdi" --mtype shareable
vboxmanage storageattach oralin12 --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium "C:\Users\fabien\VirtualBox VMs\sybase_bin.vdi" --mtype shareable




Restart VMs



Select "oralin11" and Click "Start"


Select "oralin12" and Click "Start"




Create Sybase Home



Create Partition

Only on oralin11.

[root@oralin11 ~]#

parted /dev/sdb mklabel msdos
parted /dev/sdb unit mb mkpart primary 1 2147

Create OCFS2 Filesystem

Only on oralin11.

[root@oralin11 ~]#

mkfs.ocfs2 -b 4096 -C 4k -L sybase_bin -N 2 /dev/sdb1 

Install new Sybase Home

On both nodes.

[root@oralin11 ~]#
[root@oralin12 ~]#

echo "LABEL=sybase_bin /opt/sybase ocfs2 _netdev 0 0" >>/etc/fstab


partprobe /dev/sdb
mount /opt/sybase
chown sybase:sybase /opt/sybase



Prepare Shared Sybase Installation



To do only on one node.

Restore Sybase Installation

[root@oralin11 ~]#

cd /
tar xvfz /media/sf_VirtualBox_Shared/oralin11_opt_sybase.tgz
tar xvfz /media/sf_VirtualBox_Shared/oralin12_opt_sybase.tgz

Transform Private Installation into a Shared One

[root@oralin11 ~]#

sed -i 's/property="ase.installation.mode" value="private"/property="ase.installation.mode" value="shared"/' /opt/sybase/UAF-2_5/nodes/oralin11.cluster/plugins/mycluster/agent-plugin.xml

sed -i 's/property="ase.installation.mode" value="private"/property="ase.installation.mode" value="shared"/' /opt/sybase/UAF-2_5/nodes/oralin12.cluster/plugins/mycluster/agent-plugin.xml



Start Agents


Start of Unified Agent on both nodes: oralin11 and oralin12

[sybase@oralin11 ~]$
[sybase@oralin12 ~]$ 

UAF-2_5/bin/uafstartup.sh &

Result:

2011-07-16 23:46:47,363 INFO  [main] Bootstrap completed successfully.



Delete old sybase_bin disk




Type all command below in a windows command except "C:\Users\fabien>".
Change "C:\Users\fabien\VirtualBox VMs" with your own path to VirtualBox VMs files.

Delete oralin11\sybase_bin.vdi

C:\Users\fabien>

del "C:\Users\fabien\VirtualBox VMs\oralin11\sybase_bin.vdi"

Delete oralin12\sybase_bin.vmdk

C:\Users\fabien>

del "C:\Users\fabien\VirtualBox VMs\oralin12\sybase_bin.vmdk"