Bug #75832 Add function to mysqld_safe for setting server-id automatically.
Submitted: 10 Feb 2015 3:53
Reporter: tsubasa tanaka (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.6.23, 5.5.42, 5.7.5-m15 OS:Any
Assigned to: CPU Architecture:Any
Tags: auto, mysqld_safe, server-id

[10 Feb 2015 3:53] tsubasa tanaka
Description:
This is feature request for adding new function to mysqld_safe.

mysqld_safe can set server-id automatically, for example, calculating from server IP address.
It is useful to make replication in virtual environment like Docker.

How to repeat:
Applying patch, then mysqld_safe will have --auto-server-id option.

bash-4.1# ip a
583: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
584: eth0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 02:42:ac:11:00:68 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.104/16 scope global eth0

bash-4.1# /etc/init.d/mysql start
Starting MySQL.. SUCCESS!

bash-4.1# ps auxww | grep mysqld
root        11  0.1  0.1  11304  1476 ?        S    12:37   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/e2b4ff75a2cb.pid
mysql      559  5.1 44.2 1290360 451748 ?      Sl   12:37   0:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --server-id=104 --report-host=e2b4ff75a2cb --user=mysql --log-error=/var/lib/mysql/error.log --pid-file=/var/lib/mysql/e2b4ff75a2cb.pid
root       588  0.0  0.0   6380   652 ?        S+   12:38   0:00 grep mysqld

--auto-server-id in mysqld_safe sets --server-id which is calculated from IP address and --report-host which is same as hostname.

Suggested fix:
This works fine but I don't recognize that can work except for Linux.

https://github.com/yoku0825/Docker_image_for_MySQL_Fabric_aware/blob/master/mysqld_safe.pa...