안녕 하세요 질문이 있어서 글을 올립니다..
현제 4.1.7 을 2대 놓고
master 는 update insert 등을 하고
slave 에는 select 만 하고
리플리케이션으로 돌리고 있습니다..
사용자는 그렇게 많지는 않습니다. 하지만 양은 좀 있습니다..
첨에는 문제 없시 잘 작동하였지만..
시간이 지나자 master 는 별 문제 없지만 slave 에 접속하는 속도가 현저하게 떨어져서 어떨땐 먹통이 되어 버립니다.
서버로드도 별로 걸리지 않고 mysqld CPU 점유율도 그렇게 되지 않는데 접속도 느리고 select 도 느려졌습니다..
그래서 processlist 를 봤더니.. 다음 처럼 나옵니다.
+-------+-------------+---------------------+-----+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+-------------+---------------------+-----+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+
| 1 | system user | | | Connect | 354034 | Waiting for master to send event | |
| 2 | system user | | xxx | Connect | 44 | Locked | update xxxxx
set
title='???? ?????? ?????.. ?????? ???????', content=' |
| 46159 | xxxuser | xxx.xxx.xxx.xx:2718 | msn | Query | 49 | Sorting result | select id, title, subtitle, left(content,300) as content, idx, indate, left(indate,10) as d, right(i |
| 46164 | xxxuser | xxx.xxx.xxx.xx:2878 | msn | Query | 42 | Sorting result | select id, title, subtitle, left(content,300) as content, idx, indate, left(indate,10) as d, right(i |
| 46173 | xxxuser | xxx.xxx.xxx.xx:3856 | msn | Query | 24 | Locked | select id,title,indate,code, left(content,300) as content from article where ( id >= '20070309000000 |
| 46177 | xxxuser | xxx.xxx.xxx.xx:3023 | msn | Query | 18 | Locked | select id,title,indate,code, left(content,300) as content from article where ( id >= '20070309000000 |
| 46185 | xxxuser | xxx.xxx.xxx.xx:2176 | msn | Query | 3 | Locked | select id,title,indate,code, left(content,300) as content from article where ( id >= '20070309000000 |
| 46187 | root | localhost | | Query | 0 | | show processlist |
+-------+-------------+---------------------+-----+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+
xxx 는 이해해 주세요 ㅜㅜ
이런식으로 slave 에서 update 가 되면서 Locked 가 걸리고 그 후에 select 쿼리도 Locked 가 걸려서 접속 select 가 느려지는거 같습니다.
그래서 찾아 봤더니 DB 를 제시작하거나 정상 종료를 하지 않았을때 마스터와 슬레이브 통신(??) log 가 깨진다는군요..
그래서 그 로그에서 찾는데 오래 걸려서 Locked 걸리는거 같습니다.
이걸 해결 할 방법이 혹시 있나 해서 고수님들께 물어 볼라고 글 올립니다..
제가 mysql 실력이 허접해서 ㅜㅜ
혹시 같은 경험이나 해결책 아시는분 있으면 답변 부탁 드립니다..
그럼 읽어주셔서 감솨 ^_^;;
|