mysql主从配置 my.cnf 文件_mysql 主从文件配置,my.cnf

本文详细介绍了MySQL主从配置中my.cnf文件的关键参数设置,包括主库和从库的配置差异,如log-bin、server-id等,以实现数据同步和高可用性。
摘要由CSDN通过智能技术生成

[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

my.zip (7.9 KB)

下载次数: 3

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2014-04-01 15:49

浏览 2306

分类:数据库

评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值