Master,Slave間のデータ通信量を下げる
使用したのはMySQL5.0
Master,Slave両方のmy.cnfに下記を追加
------------------------------------------------
[mysqld]
port = 3306
socket = /tmp/mysql.sock
これ追加![ダウン](https://stat.ameba.jp/blog/ucs/img/char/char2/175.gif)
slave_compressed_protocol = 1
------------------------------------------------
MySQLを再起動(Master,Slave両方)
確認
# /usr/local/mysql5.0/bin/mysql
mysql> show variables like 'slave_compressed_protocol';
+---------------------------+-------+
| Variable_name | Value |
+---------------------------+-------+
| slave_compressed_protocol | ON |
+---------------------------+-------+
Valueが”ON”になっていれば終了
トラフィックはかなり下がるが、当然CPU使用率が上がる
トラフィックは1/5程度になる
CPUはuser領域が最低1割増しくらいかな?まぁ、誤差の範囲内
■MySQL4.1の場合
4.1の場合my.cnfに設定した後の確認がちょっと違います
mysql> show variables like 'slave_compressed_protocol';
Empty set (0.00 sec)
値が取れないので
mysql> select @@slave_compressed_protocol;
+-----------------------------+
| @@slave_compressed_protocol |
+-----------------------------+
| 1 |
+-----------------------------+
■Onlineでの変更
mysql> set global slave_compressed_protocol = 1;
使用したのはMySQL5.0
Master,Slave両方のmy.cnfに下記を追加
------------------------------------------------
[mysqld]
port = 3306
socket = /tmp/mysql.sock
![ダウン](https://stat.ameba.jp/blog/ucs/img/char/char2/175.gif)
![ダウン](https://stat.ameba.jp/blog/ucs/img/char/char2/175.gif)
slave_compressed_protocol = 1
------------------------------------------------
MySQLを再起動(Master,Slave両方)
確認
# /usr/local/mysql5.0/bin/mysql
mysql> show variables like 'slave_compressed_protocol';
+---------------------------+-------+
| Variable_name | Value |
+---------------------------+-------+
| slave_compressed_protocol | ON |
+---------------------------+-------+
Valueが”ON”になっていれば終了
トラフィックはかなり下がるが、当然CPU使用率が上がる
トラフィックは1/5程度になる
CPUはuser領域が最低1割増しくらいかな?まぁ、誤差の範囲内
■MySQL4.1の場合
4.1の場合my.cnfに設定した後の確認がちょっと違います
mysql> show variables like 'slave_compressed_protocol';
Empty set (0.00 sec)
値が取れないので
mysql> select @@slave_compressed_protocol;
+-----------------------------+
| @@slave_compressed_protocol |
+-----------------------------+
| 1 |
+-----------------------------+
■Onlineでの変更
mysql> set global slave_compressed_protocol = 1;