Assume
Master1 = 172.16.1.1
Master2 = 172.16.1.2
Database users
GRANT ALL PRIVILEGES ON *.* TO 'slaveuser'@'localhost'IDENTIFIED BY 'slavepw' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'slaveuser'@'%' IDENTIFIED BY 'slavepw' WITH GRANT OPTION;
Master1
=========================================================
[mysqld]
auto_increment_increment=2
auto_increment_offset=1
# Replication Master Server
# binary logging is required for replication
log-bin=master1-bin
binlog-ignore-db=mysql
binlog-ignore-db=test
# required unique id between 1 and 2^32 - 1
server-id = 1
#following is the slave settings so this server can connect to master2
master-host = 172.16.1.2
master-user = slaveuser
master-password = slavepw
master-port = 3306
#If you want to enable log add this entry for [mysqld] section:
log-error=/var/log/mysqld.log
========================================================
Master 2
==========================================================
[mysqld]
auto_increment_increment=2
auto_increment_offset=2
# Replication Master Server
# binary logging is required for replication
log-bin=master2-bin
binlog-ignore-db=mysql
binlog-ignore-db=test
# required unique id between 1 and 2^32 - 1
server-id = 2
#following is the slave settings so this server can connect to master2
master-host = 172.16.1.1
master-user = slaveuser
master-password = slavepw
master-port = 3306
#If you want to enable log add this entry for [mysqld] section:
log-error=/var/log/mysqld.log
==============================================================
Master 1
grant replication slave on *.* to slaveuser@'172.16.1.2' identified by 'slavepw';
Master 2
grant replication slave on *.* to slaveuser@'172.16.1.1' identified by 'slavepw';
=============================================
Restart both
=============================================
show slave status\G
This Blog is about new technologies, Linux, Sysadmin, Devops, Programming, AWS, Cloud platforms, HP, Hardware, Tech news, Networking, How tos, Configurations, Apache, PHP, Java, Kubernetes, Docker, Openstack, MySQL,
Tuesday, June 29, 2010
Configure High Availability Heartbeat in RHEL5
Required RPMs.
heartbeat-2.99.0-3.1.i386.rpmheartbeat-common-2.99.0-3.1.i386.rpm
heartbeat-common-devel-2.99.0-3.1.i386.rpm
heartbeat-debuginfo-2.99.0-3.1.i386.rpm
heartbeat-devel-2.99.0-3.1.i386.rpm
heartbeat-ldirectord-2.99.0-3.1.i386.rpm
heartbeat-pils-2.1.4-9.el5.i386.rpm
heartbeat-resources-2.99.0-3.1.i386.rpm
Dependencies.
ipvsadm-1.24-8.1.i386.rpmipvsadm-debuginfo-1.24-8.1.i386.rpm
libltdl3-1.4.3-9sls.i586.rpm
libnet-1.1.2.1-1.1.i386.rpm
libnet-1.1.2.1-2.rf.i386.rpm
libnet-debuginfo-1.1.2.1-1.1.i386.rpm
libnet-debuginfo-1.1.2.1-2.rf.i386.rpm
lynx-2.8.5-11.i386.rpm
lynx-debuginfo-2.8.5-11.i386.rpm
openais-0.80.3-6.1.i386.rpm
openais-debuginfo-0.80.3-6.1.i386.rpm
openais-devel-0.80.3-6.1.i386.rpm
perl-libwww-perl-5.805-1.1.1.noarch.rpm
perl-MailTools-1.76-1.noarch.rpm
perl-Net-SSLeay-1.32-1.el5.rf.i386.rpm
perl-TimeDate-1.16-3.2.1.noarch.rpm
Pre-Configuration Requirements
- Assign hostname node01 to primary node with IP address 172.16.4.80 to eth0.
- Assign hostname node02 to slave node with IP address 172.16.4.81.
Configuration files
- authkeys
- ha.cf
- haresources
==================================================================================
#Add Following auth 2
2 sha1 test-ha
==================================================================================
chmod 600 /etc/ha.d/authkeys
vim /etc/ha.d/ha.cf ==================================================================================
#Add following lines logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node node01
node node02
==================================================================================
vim /etc/ha.d/haresources ==================================================================================
#Add following line node01 172.16.4.82 httpd ==================================================================================
Copy the /etc/ha.d/ directory from node01 to node02:scp -r /etc/ha.d/ root@node02:/etc/
vim /etc/httpd/conf/httpd.conf
#Add following line
Listen 172.16.4.82:80
Copy the /etc/httpd/conf/httpd.conf file to node02:
scp /etc/httpd/conf/httpd.conf root@node02:/etc/httpd/conf/
Create the file index.html on both nodes (node01 & node02):
Now start heartbeat on the primary node01 and slave node02
/etc/init.d/heartbeat start
Monday, June 21, 2010
Monday, June 14, 2010
Subscribe to:
Posts (Atom)