mysql主从服务器搭建配置

主服务器的(db1)配置

●my.cnf设置

[mysqld]
default-character-set=utf8
skip-character-set-client-handshake
default-table-type=InnoDB
wait_timeout=31536000
interactive_timeout=31536000

max_connections = 3000
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 20M
innodb_log_buffer_size = 128M
innodb_log_file_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
join_buffer_size = 256K
read_buffer_size = 2M
key_buffer_size = 1M
myisam_sort_buffer_size = 2M
table_open_cache = 1024
tmp_table_size = 16M

# Master/Slave
server-id = 1
log-bin = master-mysql-bin
binlog-do-db = mmy_production
binlog-do-db = ah_production

 

从服务器的配置
●my.cnf设置

[mysqld]
default-character-set=utf8
skip-character-set-client-handshake
default-table-type=InnoDB
wait_timeout=31536000
interactive_timeout=31536000

max_connections=300
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 20M
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 8M
join_buffer_size = 256K
read_buffer_size = 2M
key_buffer_size = 1M
myisam_sort_buffer_size = 1M

# Master/Slave
server-id = 2
master-host=db1
master-user=replication
master-password=replication
master-port=3306
master-connect-retry=60
replicate-do-db = mmy_production
replicate-do_db = ah_production

 

你可能感兴趣的:(Mysql主从)