Powered By Blogger

Wednesday, 1 June 2011

Installation and configuration MMM setup

Documents for MMM setup:
For installing the MMM setup we require the following to be installed first
yum -y install perl-Algorithm-Diff perl-Class-Singleton perl-DBD-MySQL perl-Log-Log4perl perl-Log-Dispatch perl-Proc-Daemon perl-MailTools
we should download the "perl-Net-ARP-1.0.2-1.el5.rf.x86_64" perl module  and get installed
rpm -ivh perl-Net-ARP-1.0.2-1.el5.rf.x86_64.rpm
mkdir mmm
cd mmm
wget http://mysql-mmm.org/_media/:mmm2:mysql-mmm-2.0.9.tar.gz
tar zxvf :mmm2:mysql-mmm-2.0.9.tar.gz
cd mysql-mmm-2.0.9
make install
To know the installation has done properly or not
echo $?

Then we need to setup master-master replicaton on server1( x.x.x.1) and server2(x.x.x.2)
Here are the permissions those need to be created in order to monitor the replication on server1 and server2
###########
create three users on db1 and db2

grant replication client on  *.* TO 'mmm_monitor''%' IDENTIFIED BY 'monitor_password';
GRANT SUPER, REPLICATION CLIENT, PROCESS ON *.* TO 'mmm_agent''%' IDENTIFIED BY 'agent_password';
grant replication slave on *.* to 'slave_user'%' IDENTIFIED BY 'slave_user';

And do not forget to check if the following setting is there in my.cnf file of both server1 and server2
log_slave_updates = 1
on server 1
CHANGE MASTER TO master_host='x.x.x.2', master_port=3306, master_user='replication',
master_password='replication_password', master_log_file='<file>', master_log_pos=<position>;
 on server 2
 mysql> CHANGE MASTER TO master_host='x.x.x.1', master_port=3306, master_user='replication',
master_password='replication_password', master_log_file='<file>', master_log_pos=<position>;
the start the slave on both servers server1 and server2.
on server1 and server2 we should have the following three configuration files as follows:
/etc/mysql-mmm/mmm_common.conf
/etc/mysql-mmm/mmm_agent.conf
/etc/default/mysql-mmm-agent
Note: Config files:mm_common.conf is common on all there servers server1(x.x.x.1), server2(x.x.x.2) and server3(x.x.x.3)
where server1 and server2 are DB-HOSTS and server2 is monitorig server

# cat /etc/mysql-mmm/mmm_common.conf
active_master_role writer
<host default>
cluster_interface eth0
pid_path /var/run/mysql-mmm/mmm_agentd.pid
bin_path /usr/libexec/mysql-mmm/
replication_user rep_monitor
replication_password RepMonitor
agent_user rep_monitor
agent_password RepMonitor
</host>
<host db1>
ip x.x.x.1
mode master
peer db2
</host>
<host db2>
ip x.x.x.2
mode master
peer db1
</host>
<role writer>
hosts db1, db2
ips x.x.x.123
mode exclusive
</role>
<role reader>
hosts db1, db2
ips x.x.x.121, x.x.x.122
mode balanced
</role>
<check ping>
check_period 1
trap_period 5
timeout 2
</check>
<check mysql>
check_period 1
trap_period 2
timeout 2
restart_after 10000
</check>
<check rep_backlog>
check_period 5
trap_period 10
max_backlog 60
timeout 2
restart_after 10000
</check>
<check rep_threads>
check_period 1
trap_period 5
timeout 2
restart_after 10000
</check>

# /etc/mysql-mmm/mmm_agent.conf
this db1
Note: on server 2 the mmm_agent.conf should have "this db2"
# /etc/default/mysql-mmm-agent
ENABLED=1

after configuration of three files start the agent on server1 and server2
on server1 and server2 ( start the mmm-agent)
/etc/init.d/mysql-mmm-agent start
/etc/init.d/mysql-mmm-agent status
ps -ef | grep mysql-mmm-agent
Now go to the monitor-server(server3).
we should have the following files
note: just the file mmm_common.conf on server2 to server3
Config files:
/etc/mysql-mmm/mmm_common.conf
/etc/mysql-mmm/mmm_mon.conf
/etc/default/mysql-mmm-monitor
cat /etc/mysql-mmm/mmm_mon.conf
<monitor>
        ip                                      127.0.0.1
        pid_path                                /var/run/mmmd_mon.pid
        bin_path                                /usr/bin/mysql-mmm/
        status_path                             /var/lib/misc/mmmd_mon.status
        ping_ips                                x.x.x.1,x.x.x.2
</monitor>
<host default>
        monitor_user                    mmm_monitor
        monitor_password                mmm_monitor
</host>
debug 0

# Enable Monitor
# /etc/default/mysql-mmm-monitor
ENABLED=1

start monitoring server on server3.
etc/init.d/mysql-mmm-monitor start
ps -ef | grep mmm-moitor
the command to see mmm_status
/usr/sbin/mmm_control show
 set_online db1
/usr/sbin/mmm_control set_active
to know the status
/usr/sbin/mmm_control show
to know more about commands
/usr/sbin/mmm_control -help
To know more about installations and configurations given below are the url
http://mysql-mmm.org/mmm2:guide

No comments:

Post a Comment