Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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]?

share|improve this question
    
Can you explain your second question ("Is it basically possible to setup more than one master-slave configuration in my.cnf"?) more as all the servers running will be using the different my.cnf –  Abdul Manaf May 29 '12 at 11:07
    
Ok basically my.cnf has a section like this: master-user = mysqlslave server-id = 100 report-host = myslave_1...my slave get id101 .... can I move this section as option for DB1 and create a new master settings for db2? –  Holger Jensen May 29 '12 at 11:14
add comment

1 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.

share|improve this answer
    
Tanks Rolando.... the first steps are successfull but where in my.cnf can I set the unique server_id? –  Holger Jensen May 30 '12 at 7:48
    
BIG THX Rolando ..... It works. I add the server id entry to the mysld2 section and it works. it was very easy. sorry for my stupid questions. Have a nice day.... –  Holger Jensen May 30 '12 at 9:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.