mysql 5.5.20_mysql5.5.20复制配置

#从库grant all on *.* to'root'@'172.28.14.114'identified by '123456';

#修改my.cnf

[client]

#password       = your_password

port            = 3306

socket          = /data/mysql/data/mysql.sock

[mysqld]

server_id=2

federated

binlog_ignore_db=mysql,information_schema,performance_schema

datadir=/data/mysql/data

tmpdir=/data/mysql/tmp

skip-external-locking

key_buffer_size = 256M

myisam_sort_buffer_size = 64M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 24

back_log = 1024

max_connections = 1200

table_definition_cache=120000

table_open_cache =120000

max_connect_errors = 300

max_allowed_packet = 24M

read_rnd_buffer_size = 4M

read_buffer_size = 4M

join_buffer_size = 4M

sort_buffer_size = 2M

query_cache_limit = 2M

query_cache_size = 1024M

query_cache_min_res_unit=2k

thread_cache_size = 1200

thread_stack = 128K

tmp_table_size = 256M

max_tmp_tables = 256

bulk_insert_buffer_size = 4M

binlog_cache_size = 2M

max_binlog_size = 128M

max_binlog_cache_size= 512M

# log

log-error=/data/mysql/log/log

log-bin=/data/mysql/log/mysql-bin

slow-query-log

slow-query-log-file=/data/mysql/log/slow.log

long_query_time=1

log-queries-not-using-indexes

# innodb

innodb_buffer_pool_size = 18432M

innodb_data_home_dir = /data/mysql/data

innodb_data_file_path = ibdata1:10M:autoextend

innodb_file_per_table= 1

innodb_log_group_home_dir = /data/mysql/log

innodb_log_files_in_group=3

innodb_log_file_size = 512M

innodb_log_buffer_size = 16M

#innodb_file_io_threads = 4

innodb_thread_concurrency = 24

innodb_lock_wait_timeout = 100

innodb_flush_method = 'O_DIRECT'

innodb_max_dirty_pages_pct = 75

# innodb_flush_log_at_trx_commit=2

# replication

replicate_wild_ignore_table=mysql.%,information_schema.%,performance_schema.%

relay_log=/data/mysql/log/relay-bin

log_slave_updates

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

[myisamchk]

key_buffer_size = 128M

sort_buffer_size = 128M

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

#主库mysql>grant replication slave on *.* torep_user@172.28.14.115identified by 'repl_user';

###### INNODB

$ mysqldump -uroot -p123456 --quick --single-transaction --master-data=1 --default-character-set=utf8 zwf > zwf.sql

###### MyISAM

mysql>flush tables with read lock;

mysal>show master status;

$ mysqldump -uroot -p123456 --opt zwf | mysql zwf -uroot -p123456 -h 172.28.14.115

mysql>unlock tables;

# 从库 INNODB拷贝zwf.sql并找到change master对应的bin log和pos

# 从库 MyISAM根据show master status结果找到change master对应的bin log和posmysql>change master to master_host='172.28.14.114',master_user='rep_user',master_password='repl_user',master_log_file='mysql-bin.000001',master_log_pos=694;

mysql>start slave;

mysql>show slave status\G;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值