Search Topic

Part-6: Database server’s configurations with DRBD & Heartbeat.

Part-6:

Database server’s configurations with DRBD & Heartbeat.

 

 6.1 : Setup LVM Partitions on both servers.

Note : we have extra 8 GB sdb on dbase1 & same on dbase2.

LVM setup Needs tree portions to setup.

1: Creation of Physical Volume.

2: Creation of Volume Group.

3: Creation of Logical Volume.

Have a look on lvm Diagram for better understanding.

                                                                              figure 1.1

First make two partitions on both servers using fdisk and type should be lvm. ( /dev/sdb1, /dev/sdb2 )

6.2 : Tell to kernal we updated partitions using ‘partprobe’ command.

6.3 : lets move on setting up lvm, we will create first layer of lvm ( physical volumes )

Note : using ‘pvdisplay’ you can view your recently updated physical volumes.

6.4 Create a volume Group named ‘vg_db’.  ( second layer of LVM ).

Now we have a around 8 GB volume group with the name of ‘vg_db’.
Note : verify your volume group using ‘vgdisplay’ command.

6.5 : Create two logical volumes.
1.lv_db ( 5GB )
2.lv_meta ( 256MB )

Create lv_db ( logical volume ) 5 GB.

Create logical volume ‘lv_meta’ 256MB.

Note : Here we have done LVM setup on ‘dbase1′. You must perform same steps on ‘dbase2′

6.6 : Install DRBD on both servers. with yum.

Find this article for ‘how to install drbd on centos 6.2′.

6.7 : Configure DRBD on Database Servers.(dbase1, dbase2) loadb ‘modprobe drbd’.

Load on dbase2.

6.8 : Add this module on startup.

dbase2

6.9 : Edit vi /etc/drbd.conf delete all lines and paste below contents.

6.10 : Copy this file on dbase2 using ‘scp’ command.

6.11 : Add these lines in ‘/etc/sysctl.conf’

6.12 : ‘sysctl -p’ on dbase1.

6.13 : Copy this file on dbase2 using scp.

6.14 : ‘sysctl -p’ on dbase2.

6.15 : Commands to Create, attach and connect resource 0 on both Database servers.
on dbase1 & dbase2.

If you Notice the last some lines of output gives warning and also some commands to fix that warning. so the next step for fixing this problem.
6.16 : Run some commands to create drbdsetup on both servers.

Note : Same Commands run on ‘dbase2′.

Run this command on both servers

Sync r0 on both servers using this command.

Now Connect r0 on both database servers.

6.17 : Now time to decide which one would be primary node in my case dbase1 is primary node. so this command only for primary node.

6.18 : You can check your Synchronization by issuing this command.

6.19 : Again this command only for primary node.

6.20 : Make Ex4 file system on lv only on dabase1.

6.21 : Make db_data directory and mount /dev/drbd0 on db_data directory.

6.22 : Just make the same directory on dbase2.

6.23 : Install MySql On Both Servers
Find this article for How to Install Mysql server.

6.24 : MySql Configurations
Change mysqls db data location by editing this file ‘/etc/my.cnf’.

6.25 : copy my.cnf on dbase2 using scp

6.25 : Create ‘mysql’ directory in ‘/db_data’.

6.26 : change ownership from ‘root’ to ‘mysql’

6.27 : Allow web servers to use mysql

6.28 : Install HeartBeat On Both Servers
Find this article for How to Install HeartBeat on CentOs 6.2

6.29 : HeartBeat Configurations.

Create ‘ha.cf’ file and paste below contents.

Copy this file on dbase2.

Create ‘haresources’ file and paste below contents.

Create ‘haresources’ file on dbase2 and paste below contents.

Crete ‘vi /etc/ha.d/authkeys’ file on both servers and paste file contents.

Change file’s permissions.

Copy this file on dbase2.

6.30 : Time to start heartbeat service on both servers

6.31 : chkconfig heartbeat service on both servers.

Note : Our Databases are available on db.broexperts.com. in case of failure of primary server the secondary server which is dabse2 can handle the situation and will keep the network alive.

if you have any problem you can comment me here.

Follow Us
  • Facebook
    Likes
    1054
  • Twitter
    Followers
    14
  • You tube
    Scribers
    830
Best Sellings OS
CentOS 7 Order Now
Ubuntu Order Now
Linux Mint Order Now
Puppy Order Now
Netrunner Order Now
Debian Order Now
Robolinux Order Now
Zorin OS Order Now
Linux Lite Order Now
Manjaro Order Now
Bodhi Order Now
Kali Order Now
Simplicity Order Now
PCLinuxOS Order Now
Tails Order Now
Rocks Cluster Order Now
openSUSE Order Now
Lubuntu Order Now
Fedora Order Now
online poll by Opinion Stage
UserOnline