Friday, August 12, 2011

mysql: replication

# in master db's my.cnf
[mysqld]
port=3306
socket=/var/lib/mysql/mysql.sock
datadir=/data1/mysqldata
 
set-variable = key_buffer_size=1500M
set-variable = max_allowed_packet=1M
set-variable = max_connections=1200
set-variable = max_connect_errors=999999
set-variable = max_user_connections=1200
set-variable = table_cache=512
set-variable = sort_buffer=128M
set-variable = ft_min_word_len=2
 
local-infile=1
server-id=1
log-bin
 
[mysqldump]
quick


# in slave db's my.cnf
[client]
port=3306
socket=/var/lib/mysql/mysql.sock
 
[mysqld]
port=3306
socket=/var/lib/mysql/mysql.sock
datadir=/data1/mysqldata
set-variable = key_buffer_size=512M
set-variable = max_allowed_packet=1M
set-variable = max_connections=1200
set-variable = max_connect_errors=999999
set-variable = max_user_connections=1200
set-variable = table_cache=512
set-variable = sort_buffer=128M
set-variable = max_binlog_size=512M
 
slave-skip-errors=1062,1114,1050,1051,1146
 
local-infile=1
server-id=2
master-host=223.223.223.35
master-user=repl
master-password=replMaster
master-port=3306
 
[mysqldump]
quick


# grant access for slave db to master db
GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '<slave_password>';


# dont forget to flush privileges
FLUSH PRIVILEGES;

No comments:

Post a Comment

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...