centos6.0 + MySQL-5.5.15

はじめに

自分向けのメモ。
master1台、slave1台でmysqlレプリケーションを行う。

環境

  • OS
    • CentOS6.0(on ESXi5)
      • master 1台
      • slave 1台

MySQL設定

事故防止のため、slave側でMySQL再起動などを実施した際は、
明示的にslave startさせるようにしておく。
パラメータ最適化は....後回しの方向で。

  • master向けmy.cnf


[client]
port = 3306

[mysqld]
character_set_server = utf8

max_connections = 150
thread_cache_size = 8

sort_buffer_size = 4M

table_open_cache = 4096

max_allowed_packet = 16M

default_storage_engine = InnoDB

server-id = 1
port = 3306
log-bin = mysql-bin
expire_logs_days = 5
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
innodb_buffer_pool_size = 64M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128M

key_buffer_size = 1M

query_cache_type = 1
query_cache_size = 16M

slow_query_log = 1
long_query_time = 1.0

  • slave向けmy.cnf


[client]
port = 3306

[mysqld]
character_set_server = utf8


max_connections = 150
thread_cache_size = 8

sort_buffer_size = 4M

table_open_cache = 4096

max_allowed_packet = 16M

default_storage_engine = InnoDB

server-id = 2
port = 3306
relay-log = mysqld-relay-bin
relay-log-index = mysqld-relay-bin
skip-slave-start

innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
innodb_buffer_pool_size = 64M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128M

key_buffer_size = 1M

query_cache_type = 1
query_cache_size = 16M

slow_query_log = 1
long_query_time = 1.0