반응형
l MMM (MySQL Multi-Master Manager) INSTALLATION

<Server Allocation>
Name
IP
Host Name
Server ID
Monitor
10.1.1.111
mon
-
Master 1
10.1.1.121
db1
1
Master 2
10.1.1.131
db2
2

<Virtual IPs Allocation>
IP
ROLE
DB Work Grantee
10.1.1.211
writer
write only
10.1.1.221
reader
read only
10.1.1.231
reader
read only


<Install MMM>
## Dual-Repl. MySQL 구성 및 초기 설치과정은 기존 참고자료들을 참고하도록 생략.

## MySQL Server Configuration File Parameter Value 추가 (MySQL node both)
-      /etc/my.cnf

. . .

# Setting For Replication  (db1)
binlog_cache_size=4M
max_binlog_size=512M
expire_logs_days = 2
relay-log-purge = 1
log_slave_updates = 1
skip-slave-start
auto_increment_increment = 2
auto_increment_offset = 1      # Set Unique Value to Both Server
bind-address = 0.0.0.0
. . .


. . .

# Setting For Replication (db2)
binlog_cache_size=4M
max_binlog_size=512M
expire_logs_days = 2
relay-log-purge = 1
log_slave_updates = 1
skip-slave-start
auto_increment_increment = 2
auto_increment_offset = 2      # Set Unique Value to Both Server
bind-address = 0.0.0.0
. . .


## MySQL Dual-Repl. 구성 설치 후 MMM설치를 위한 추가적인 GRANTEE작업
MySQL >
GRANT SUPER, REPLICATION SLAVE, REPLICATION CLIENT, PROCESS ON *.* TO replusr@'10.1.1.%' IDENTIFIED BY ‘replusr!@#$’;


## MMM 설치를 위한 필요 패키지 설치
yum install make libart_lgpl.x86_64   perl-Algorithm-Diff   perl-DBD-mysql   perl-DateManip  perl-IPC-Shareable  perl-Log-Dispatch  perl-Log-Dispatch-FileRotate  perl-Log-Log4perl  perl-MIME-Lite  perl-Mail-Sender  perl-MailTools  perl-Net-ARP  perl-Params-Validate  perl-Proc-Daemon  perl-TimeDate  perl-XML-DOM  perl-XML-Parser  perl-XML-RegExp  rrdtool  rrdtool-perl  perl-Class-Singleton

## 모니터링 노드의 경우 mysql library 환경 추가 설치 (DB 노드는 이미 설치되어 있음)
rpm -ivh MySQL-shared-compat-5.5.30-1.rhel5.x86_64.rpm  (monitor node)

## MMM 패키지 설치
wget http://mysql-mmm.org/_media/:mmm2:mysql-mmm-2.2.1.tar.gz

tar -zxvf :mmm2:mysql-mmm-2.2.1.tar.gz && rm -fr :mmm2:mysql-mmm-2.2.1.tar.gz

cd mysql-mmm-2.2.1

make install


mkdir -p  /usr/lib/perl5/vendor_perl/5.8.8/MMM /usr/lib/mysql-mmm /usr/sbin /var/log/mysql-mmm /etc /etc/mysql-mmm /etc/init.d/
cp -r lib/Common/ /usr/lib/perl5/vendor_perl/5.8.8/MMM
[ -f /etc/mysql-mmm/mmm_common.conf ] || cp etc/mysql-mmm/mmm_common.conf /etc/mysql-mmm/
mkdir -p /usr/lib/mysql-mmm/agent/
cp -r lib/Agent/ /usr/lib/perl5/vendor_perl/5.8.8/MMM
cp -r bin/agent/* /usr/lib/mysql-mmm/agent/
cp -r etc/init.d/mysql-mmm-agent /etc/init.d/
cp sbin/mmm_agentd /usr/sbin
[ -f /etc/mysql-mmm/mmm_agent.conf  ] || cp etc/mysql-mmm/mmm_agent.conf  /etc/mysql-mmm/
mkdir -p /usr/lib/mysql-mmm/monitor/
cp -r lib/Monitor/ /usr/lib/perl5/vendor_perl/5.8.8/MMM
cp -r bin/monitor/* /usr/lib/mysql-mmm/monitor/
cp -r etc/init.d/mysql-mmm-monitor /etc/init.d/
cp sbin/mmm_control sbin/mmm_mond /usr/sbin
[ -f /etc/mysql-mmm/mmm_mon.conf    ] || cp etc/mysql-mmm/mmm_mon.conf    /etc/mysql-mmm/
mkdir -p /usr/lib/mysql-mmm/tools/
cp -r lib/Tools/ /usr/lib/perl5/vendor_perl/5.8.8/MMM
cp -r bin/tools/* /usr/lib/mysql-mmm/tools/
cp sbin/mmm_backup sbin/mmm_clone sbin/mmm_restore /usr/sbin
[ -f /etc/mysql-mmm/mmm_tools.conf  ] || cp etc/mysql-mmm/mmm_tools.conf  /etc/mysql-mmm/




















echo $?
0



< Configuration File Setting >

# vi /etc/mysql-mmm/mm_common.conf (both all node)  
   (주석내용은 config 작성시 반드시 제거할 것!!!)

active_master_role      writer

<host default>
cluster_interface                eth1              ## Ethernet Interface
pid_path                         /var/run/mmm_agentd.pid
bin_path                         /usr/lib/mysql-mmm/
replication_user                 replusr
replication_password           5emffld)
agent_user                      replusr
agent_password                5emffld)
</host>

<host db1>
ip                                 10.1.1.121   ## MySQL Master 1 node real ip
mode                            master
peer                              db2
</host>

<host db2>
ip                                 10.1.1.131   ## MySQL Master 2 node real ip
mode                            master
peer                              db1
</host>

<role writer>
hosts                             db1, db2
ips                                10.1.1.211    ## Monitor node virtual ip
mode                             exclusive
</role>

<role reader>
hosts                             db1, db2
ips                                10.1.1.221, 10.1.1.231    ## MySQL Master nodes virtual ip
mode                             balanced
</role>


# vi /etc/mysql-mmm/mmm_agent.conf (mysql node both)

include mmm_common.conf
this db1     ## When node is second master then input db2


include mmm_common.conf
this db2     ## When node is second master then input db2


# vi /etc/mysql-mmm/mmm_mon.conf (monitor node)

include mmm_common.conf
<monitor>
ip                                        127.0.0.1
pid_path                                /var/run/mmm_mond.pid
bin_path                                /usr/lib/mysql-mmm/
status_path                             /var/lib/misc/mmm_mond.status
ping_ips                                10.1.1.121, 10.1.1.131
</monitor>

<host default>
monitor_user                       replusr
monitor_password                ‘replusr!@#$’
</host>

debug 0


<Starting MMM>

- Start the agents (mysql node both) –

chkconfig mysql-mmm-agent on

/etc/init.d/mysql-mmm-agent start
Daemon bin: '/usr/sbin/mmm_agentd'
Daemon pid: '/var/run/mmm_agentd.pid'
Starting MMM Agent daemon... Ok


- Start the monitor (monitor node) -

/etc/init.d/mysql-mmm-monitor start
Daemon bin: '/usr/sbin/mmm_mond'
Daemon pid: '/var/run/mmm_mond.pid'
Starting MMM Monitor daemon: Ok


- mmm_control to check the status of the cluster –


mmm_control show
db1(10.168.1.121) master/AWAITING_RECOVERY. Roles:
db2(10.168.1.131) master/AWAITING_RECOVERY. Roles:

mmm_control checks all
db2  ping         [last change: db22013/06/13 15:39:09]  OK
db2  mysql        [last change: db22013/06/13 15:39:09]  OK
db2  rep_threads  [last change: db22013/06/13 15:39:09]  OK
db2  rep_backlog  [last change: db22013/06/13 15:39:09]  OK: Backlog is null
db1  ping         [last change: db22013/06/13 15:39:09]  OK
db1  mysql        [last change: db22013/06/13 15:39:09]  OK
db1  rep_threads  [last change: db22013/06/13 15:39:09]  OK
db1  rep_backlog  [last change: db22013/06/13 15:39:09]  OK: Backlog is null

tail -f /var/log/mysql-mmm/mmm_mond.log
상세 로그내역은 직접 확인.

mmm_control set_online db1
OK: State of 'db1' changed to ONLINE. Now you can wait some time and check its new roles!

mmm_control set_online db2
OK: State of 'db2' changed to ONLINE. Now you can wait some time and check its new roles!

$ mmm_control show
db1(10.168.1.121) master/ONLINE. Roles: reader(10.168.1.231), writer(10.168.1.211)
db2(10.168.1.131) master/ONLINE. Roles: reader(10.168.1.221)



출처 : http://dba-jadelee.blogspot.kr/2014/10/mmm-mysql-multi-master-manager.html

반응형

'연구개발 > MYSQL' 카테고리의 다른 글

Seconds_Behind_Master  (0) 2015.03.18
MHA  (0) 2015.03.18
MySQL INNODB Status Monitoring  (0) 2015.03.14
show status를 통한 MySQL 상태 분석하기  (0) 2015.03.13
tmux - 여러개의 터미널을 실행할 수 있는 TTY 멀티플렉서  (0) 2015.03.09

+ Recent posts