蝔撘 Debug 敺敺Y洵銝銵餈質絲靘敺颲(蝔撘蝣澆云憭 compile ), 虫蝔桀瘜撠望臬敺W餈, 甇敺撖怠亦 DB, 撠勗 DB 憪敺, 隞亙停航蝔撘臬瑁芯 SQL 隤瘜.(隞乩芯誑 MySQL 箔蜓) 銋券餈質馱瘜舐 tcpdump wireshark 3306 port,憭芾 MySQL 撟曄車寞臭誑, 撠隞交甇∠嗡葉銝蝔, /etc/my.cnf(CentOS), restart mysql 喳: 蝚砌蝔: Slow query SQL 隤瘜: - log_slow_queries = /var/log/mysql/mysql-slow.log
- long_query_time = 2 (頞 2蝘 SQL 隤瘜閮韏瑚, 閮剔凋暺靘閮日臭臭蝔格寞 XD)
g+ z3 }0 j% ~. p' R
蝚砌蝔: 閮 MySQL Replication binlog: - log_bin = /var/log/mysql/mysql-bin.log (甇斗閬 mysqlbinlog 閫靘)
- mysql 撠 INSERT/UPDATE/DELETE 隤瘜閮潭迨(雿航瘜航質雿喟銝), 航撖怎策 SLAVE 函 log 瑼
2 O- y" _/ ?: y3 O9 B3 Y
蝚砌蝔: 刻行迨寞, 撠 MySQL 瑁瘥銵隞文券質韏瑚: - log = /var/log/mysql/mysql.log
( N8 q6 q7 I- W& B/ U
restart mysql 敺, tail -f /var/log/mysql/mysql.log 撠勗臭誑啣! * K+ g, |' t7 {6 G- A; \4 V* |
|