Thesqld-multi with first DB as Slave and second DB as Master

MySQLmysql-5.5mysqld-multireplication

Yesterday, I setup mysqld-multi in my.cnf. It works fantastic, but there is still a further Problem.

The first DB on socket 1 running as Slave from a other server. The second one from socket 2 should run as Master for a further Slave. The replication for DB 1 running successful.

My question is it possible to setup the master-slave environment for every socket?
Is it basically possible to setup more than one master-slave configuration in my.cnf?

I couldn't found helpful hints in google or I doesn't have the correct search words.

I'm happy for any helpful hints.

My system is Debian 6 with mysql 5 and php.

[mysqld1] read-only # comment out only on the productive 
dbmaster port = 3306 
datadir = /var/lib/mysql 
pid-file = /var/lib/mysql/mysqld.pid 
socket = /var/lib/mysql/mysql.sock 
user = mysql 
log-error=/var/log/mysql1.log 
innodb_data_home_dir = /var/lib/mysql 
innodb_log_group_home_dir = /var/lib/mysqlinnolog 
relay-log = /var/log/mysql/master-relay-bin 
relay-log-index = /var/log/mysql/master-relay-bin.index 
log-bin = /var/log/mysql/relaylog/master-bin

[mysqld2] 
port = 3307 
datadir = /var/lib/mysql-data2/mysqld2 
pid-file = /var/lib/mysql-data2/mysqld2/mysql.pid 
socket = /var/lib/mysql-data2/mysqld2/mysql.sock 
user = mysql 
log-error=/var/log/mysqld2.log 
log-bin = /var/log/data2/mysql-bin

Both instance have a specific port and a separate Datadir. Is it possible to give each section in the snippet a unique ID? Can I put the Slave ID in section [mysqld1] and the master ID in [mysqld2]?

Best Answer

I address something like this back on May 31, 2011 : MySQL connection doesn't work anymore

Essentailly, you must make sure each mysql instance has a unique socket file, datadir, slow log, error log, and its fair share of memory.

You could look into setting up a separate mysqld service for a specific port : Running multiple instances on the same host

You should make sure db2 has a unique server_id. Furthermore, if the Slave is to be a Master also, make sure you have log-slave-updates in my.cnf for this Slave.