mysql 主从文件配置,my.cnf

主库
[client]
port		= 1231
socket		= /var/lib/mysql/mysql.sock
[mysqld]
port		= 1231
socket		= /var/lib/mysql/mysql.sock
character-set-server=utf8
collation-server=utf8_general_ci
skip-name-resolve
log-slave-updates
skip-slave-start
innodb_file_per_table
datadir		= /var/lib/mysql
back_log = 50
max_connections = 1000
max_connect_errors = 10
table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 8
thread_concurrency = 8
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
default-storage-engine = INNODB
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
log-bin=mysql-bin
sync_binlog=1
binlog_format=mixed
slow_query_log
long_query_time = 2
server-id = 51
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
innodb_buffer_pool_size = 28G
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
expire_logs_days = 10
[mysqldump]
quick
max_allowed_packet = 32M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192

从库
[client]
port		= 1231
socket		= /var/lib/mysql/mysql.sock


[mysqld]

port		= 1231
socket		= /var/lib/mysql/mysql.sock
character-set-server=utf8
collation-server=utf8_general_ci

skip-name-resolve

log-slave-updates
innodb_file_per_table
read_only

datadir		= /var/lib/mysql

back_log = 50


max_connections = 1000

max_connect_errors = 10

table_open_cache = 2048


max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

sort_buffer_size = 2M

join_buffer_size = 2M

thread_cache_size = 8

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 2M

ft_min_word_len = 4


default-storage-engine = INNODB

thread_stack = 192K

transaction_isolation = REPEATABLE-READ

tmp_table_size = 64M

log-bin=mysql-bin
sync_binlog=1

binlog_format=mixed




slow_query_log

long_query_time = 2




server-id = 52






key_buffer_size = 32M

bulk_insert_buffer_size = 64M

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

myisam_recover




innodb_buffer_pool_size = 28G



innodb_write_io_threads = 8
innodb_read_io_threads = 8


innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 1


innodb_log_buffer_size = 8M

innodb_log_file_size = 256M

innodb_log_files_in_group = 3


innodb_max_dirty_pages_pct = 90


innodb_lock_wait_timeout = 120

expire_logs_days = 10

[mysqldump]
quick

max_allowed_packet = 32M

[mysql]
no-auto-rehash


[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit = 8192

猜你喜欢

转载自stevenfeng.iteye.com/blog/2039510