MySQL drbd Data Synchronization

Source: Internet
Author: User
ArticleDirectory
    • I. Software Packages
I. Software Packages

A) drbd-8.3.2.tar.gz (Master/Slave)

B) mysql-5.0.27.tar.gz (Master/Slave)

Ii. Installation Steps

A) CD/var/local/software

B) tar zxvf drbd-8.3.2.tar.gz

C) CD drbd-8.3.2

D) Make

E) make install

F) insmod drbd/drbd. Ko

G) lsmod | grep drbd

H) vi/etc/hosts

59.64.28.22 VM1

59.64.28.57 VM2

J) vi/etc/drbd. conf

Global {usage-count yes ;}

Common {syncer {rate 10 m ;}}

Resource R0 {

Protocol C;

Startup {

Degr-WFC-Timeout 120;

}

# Disk {

# On-io-error detach;

#}

Net {

Cram-HMAC-Alg sha1;

Shared-secret "foofunfactory ";

}

# Syncer {

# Rate 10 m;

# Al-extents 257;

#}

On VM1 {

Device/dev/drbd0;

Disk/dev/sda3;

Address 59.64.28.22: 7788;

Meta-disk internal;

}

On VM2 {

Device/dev/drbd0;

Disk/dev/sda3;

Address 59.64.28.57: 7788;

Meta-disk internal;

}

}

K) mkfs. ext3/dev/sda3

L) dd If =/dev/Zero of =/dev/sda3 BS = 1 m COUNT = 1

M) drbdadm create-MD R0 (executed on the master)

N)/etc/init. d/drbd start

O) drbdsetup/dev/drbd0 primary-o

P) drbdadm primary R0

Q) drbdadm secondary R0

R) mkdir/mnt/drdb

S) Mount/dev/drbd0/mnt/drbd

T) Note: The drbd device of the standby machine cannot be mounted.

U) install MySQL configuration as follows

./Configure \

-- Prefix =/usr/local/MySQL \

-- Localstatedir =/mnt/drbd /\

-- Disable-maintainer-mode \

-- With-mysqld-user = MySQL \

-- With-Unix-socket-Path =/tmp/MySQL. Sock \

-- Without-Comment \

-- Without-Debug \

-- With-keys \

-- With-mysqld-ldflags =-all-static \

-- With-client-ldflags =-all-static

Iii. Master-slave switchover

A) Service MySQL stop

B) umount/dev/drb0;

C)/etc/init. d/drbd stop

D) drbdadm primary R0

E) Mount/dev/drbd0/mnt/drbd

F) drbdadm secondary R0

Iv. Related commands

A)/etc/init. d/drbd status // view master synchronization status

Drbd driver loaded OK; device status:

Version: 8.3.2 (API: 88/proto: 86-90)

Git-Hash: dd7985327f146f33b86d4bff5ca8c94234ce840e build by root@localhost.localdomain, 2010-11-24 19:22:37

M: res CS Ro ds p mounted fstype

0: R0 connected primary/secondary uptodate/uptodate C/mnt/drbd ext3

B)/etc/init. d/drbd status // view the standby synchronization status

Drbd driver loaded OK; device status:

Version: 8.3.2 (API: 88/proto: 86-90)

Git-Hash: dd7985327f146f33b86d4bff5ca8c94234ce840e build by root@localhost.localdomain, 2010-08-14 14:56:54

M: res CS Ro ds p mounted fstype

0: R0 connected secondary/primary uptodate/uptodate C

C)/etc/init. d/drbd start/stop/status

D) CAT/proc/drbd

E) drbdsetup/dev/drbd1 primary-o

F) drbdadm create-MD R0

G) dd If =/dev/Zero of =/dev/sda2 BS = 1 m COUNT = 1

H) drbdadm secondary R0

I) drbdadm primary R0

J) umount/dev/drbd0

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.