Bug #3310 Absence of "master-socket" parameter confuses
Submitted: 27 Mar 2004 2:23 Modified: 15 Jan 2009 11:49
Reporter: David Galoyan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:4.0.18, 4.1, 5.0, 5.1, 6.0 OS:Linux (FreeBSD, Any)
Assigned to: Assigned Account CPU Architecture:Any

[27 Mar 2004 2:23] David Galoyan
Description:
I tryed to configure replication of two mysqld-servers on the same host and found out that if I write for the first server:
  master-host=localhost
  master-port=3307
replicator connects to /tmp/mysql.sock, that is not the second server, that listens on 3307 port and /tmp/mysql2.sock. It is evidently error and I needed to write master-host=127.0.0.1 to pass the problem.
So I can't use unix domain sockets (that are faster) for the replication, except of connecting to the first server.

How to repeat:
[mysqld1]
port           = 3306
socket         = /tmp/mysql.sock
....
log-bin
server-id      = 1
binlog-do-db   = test
master-host       = localhost      #fix - 127.0.0.1
master-port       = 3307
master-user       = replicator
replicate-do-db   = test

[mysqld2]
port           = 3307
socket         = /tmp/mysql2.sock
...
log-bin
server-id      = 2
binlog-do-db   = test
master-host       = localhost
master-port       = 3306
master-user       = replicator
replicate-do-db   = test

Suggested fix:
Realize "master-socket" parameter.
[27 Mar 2004 5:56] Guilhem Bichot
Hello,
It's true replication was not designed with the objective of two MySQL servers on the same machine, as such configuration brings neither redundancy nor load balancing, the two key goals of replication.
Yes, when you tell MySQL to connect to "localhost" it will always ignore the port you specified, because "localhost" means MySQL will use Unix sockets (that's mentioned in many places in the manual, just grep for "localhost"), whereas "port" is a TCP notion. Note that this is mentioned in the section of CHANGE MASTER TO:
"MASTER_HOST and MASTER_PORT are the hostname or IP adress of the master host and its TCP port. Note that if MASTER_HOST is equal to localhost, then, like in other parts of MySQL, the port may be ignored (if Unix socket files can be used for example)."
And as you said, the workaround is to use 127.0.0.1.
We will consider adding --master-socket to replication, but this is put at the end of our TODO list, as replication on one single machine is not a widely spread setup.
And... Thank you for using MySQL !!

Guilhem
[15 Jan 2009 11:49] Susanne Ebrecht
MASTER_SOCKET still is not an option in MySQL 5.1 nor 6.0.