Wednesday, 26 August 2015

Mysql Multi or how to run multiple mysql instance on the same server master with multiple slave

Mysql Multi or how to run multiple mysql instance on the same server master with multiple slave

Here is a  sample (highly customized) file  you can tune setting as per your requirement use mysql_multi daemon stop and start instances accordingly
Master Host=x.x.x.15
Slave Host=x.x.x.12
Slave Host=x.x.x.13

vi /etc/my.cnf

[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user       = root
password   = xxxxx
log        = /var/log/mysql_multi.log

###############################################


[mysqld12]
datadir=/data/mysqldata12
socket=/data/mysqldata12/mysql.sock
pid-file=/var/run/mysqld/mysqld12.pid
bind-address=x.x.x.12
innodb_file_per_table
port=3306
user=mysql
server-id               = 2
read-only
master-host=x.x.x.15
master-port=3306
master-user=repl
master-password=yyyyyyy
master-connect-retry = 60
relay-log               = /var/log/mysql/mysql-relay-bin.log
log_bin                 = /var/log/mysql/mysql-bin.log

old_passwords=1

# To start MySql w/o Replication Thread
skip-name-resolve
max_connections=1500
key_buffer_size=1024M
join_buffer_size=4M
read_buffer_size=16M
sort_buffer_size=192M
myisam_sort_buffer_size=32M
table_cache=2048
thread_cache_size=400
interactive_timeout=1800
wait_timeout=2700
connect_timeout=10
max_allowed_packet=64M
flush_time=1800
tmp_table_size=512M
ft_min_word_len = 3
tmpdir = /tmp/
long_query_time  = 3
log-slow-admin-statements
slow_query_log  = /var/log/mysql_slow_query_12.log
log-error         = /var/log/mysql_error_12.log

###############################################
[mysqld13]
datadir=/data/mysqldata13
socket=/data/mysqldata13/mysql.sock
pid-file=/var/run/mysqld/mysqld13.pid
bind-address=x.x.x.13
port=3306
user=mysql
server-id               = 3
master-host=x.x.x.15
master-port=3306
master-user=repl
master-password=yyyyyyy
relay-log               = /var/log/mysql/mysql-relay-bin.log
log_bin                 = /var/log/mysql/mysql-bin.log


old_passwords=1

skip-name-resolve
max_connections=1500
key_buffer_size=1024M
join_buffer_size=4M
read_buffer_size=16M
sort_buffer_size=192M
myisam_sort_buffer_size=32M
table_cache=2048
thread_cache_size=400
interactive_timeout=1800
wait_timeout=2700
connect_timeout=10
max_allowed_packet=64M
flush_time=1800
tmp_table_size=512M
ft_min_word_len = 3
skip-innodb
tmpdir = /tmp/
long_query_time  = 3
log-slow-admin-statements
slow_query_log  = /var/log/mysql_slow_query_13.log
log-error         = /var/log/mysql_error_13.log

#############################################

[mysqld15]
datadir=/data/mysqldata15
socket=/data/mysqldata15/mysql.sock
pid-file=/var/run/mysqld/mysqld15.pid
bind-address=x.x.x.15
port=3306
user=mysql
server-id               = 1
log-bin = mysql-bin
binlog-ignore-db = "mysql"
old_passwords=1
skip-name-resolve
max_connections=1500
key_buffer_size=1024M
join_buffer_size=4M
read_buffer_size=16M
sort_buffer_size=192M
myisam_sort_buffer_size=32M
table_cache=2048
thread_cache_size=400
interactive_timeout=1800
wait_timeout=2700
connect_timeout=10
max_allowed_packet=256M
flush_time=1800
tmp_table_size=512M
ft_min_word_len = 3
skip-innodb

long_query_time  = 10
log-slow-admin-statements
slow_query_log  = /var/log/mysql_slow_query_15.log
log-error         = /var/log/mysql_error_15.log



#######################################################

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

No comments:

Post a Comment