heartbeat+DRBD+mysql+haproxy

heartbeat+DRBD+mysql+haproxy

heartbeat+DRBD+mysql mainly realizes the single point of failure of mysql master

haproxy implements load balancing from mysql

Specific architecture diagram

Host name

IP

Purpose dbm3 192.168.3.3 heartbeat+DRBD+Mysql main dbm4 192.168.3.4 heartbeat+DRBD+Mysql active and standby < td valign="top" width="224">dbs6 192.168.3.6 slave(master_host=192.168.3.2) dbs7 192.168.3.7 slave(master_host=192.168. 3.2) dbs8 192.168.3.8 slave(master_host =192.168.3.2) haproxy 192.168.3.5 slave read IP

1, set hostname and resolution

Edit the /etc/hosts file and add the following content

192.168.3.3 dbm3

192.168.3.4 dbm4

192.168.3.5 haproxy

192.168.3.6 dbs6

192.168.3.7 dbs7

192.168.3.8 dbs8

2, Disk partition planning

Plan the space size according to specific needs

3, DRBD deployment

p>

Import source: rpm -Uvh elrepo-release-6-6.el6.elrepo.noarch.rpm

Install DRBD via yum

yum install drbd83-utils kmod -drbd83

4, check if the DRBD installation is successful:

modprobe -l | grep -i drbd
lsmod | grep -i drbd

the installation is successful After that, there are drbdadm, drbdmeta, drbdsetuo commands, and the /etc/init.d/drbd startup script under the /sbin directory.

5, DRBD configuration

1. DRBD hard disk partition

The size of the hard disk space used by the two servers as the DRBD partition should be the same. Use fdisk to create two partitions, such as sdb1 and sdb2.

2.drbd.conf Configuration file

Node role Host name IP address DRBD partition
< /td>
primary node dbm3 192.168 .3.3 /dev/sdb1
secondary node dbm4 192.168.3.4 /dev/sdb1

The following is the configuration of drbd.conf:

global {
usage-count no;

#Whether to participate in DRBD user statistics, by default Yes

}

common {
protocol C;
#Use the third protocol of DRBD, which means that it is considered after receiving the write confirmation from the remote host Write complete
disk {
on-io-error detach;
no-disk-flushes;
no-md-flushes;
}

net {
Sndbuf-size 512k;
# timeout 60; # 6 seconds (unit = 0.1 seconds)
# connect-int 10; # 10 seconds (unit = 1 second)
# ping-int 10; # ping-int 10 seconds (unit = 1 second)
# ping-timeout 5; # 500 ms (unit = 0.1 seconds)
max-buffers 8000;
unplug-watermark 1024;
max-epoch-size 8000;
# ko-count 4;
# allow-two- primaries;

cram-hmac-alg “sha1”; shared-secret “pRrcAwF5Rtltz29Ml1”; after-sb-0pri disconnect; after-sb-1pri disconnect; after-sb-2pri disconnect; rr-conflict disconnect ; # Data-integrity-alg “md5”; # no-tcp-cork;} syncer {rate 200M; al-extents 517; })resource appdata {on dbm3 {device device /dev/drbd0; /dev/ db1; /dev/ db 192.168.3.3:7788; meta-disk /dev/sdb2 [0]; on dbm4 {device /dev/drbd0; disk /dev/sdb1; address 192.168.3.4:7788; meta-disk /dev/sdb2 [0] ; }}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2554 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.