/
mysqld_safe.patch
53 lines (48 loc) · 1.72 KB
/
mysqld_safe.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
*** /usr/mysql/5.6.23/bin/mysqld_safe.orig 2015-02-03 16:49:45.000000000 +0900
--- /usr/mysql/5.6.23/bin/mysqld_safe 2015-02-10 11:27:55.964355062 +0900
***************
*** 82,87 ****
--- 82,88 ----
--syslog Log messages to syslog with 'logger'
--skip-syslog Log messages to error log (default)
--syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'
+ --auto-server-id Make server_id variable from IP Address 3rd and 4th byte.
All other options are passed to the mysqld program.
***************
*** 210,215 ****
--- 211,217 ----
--ledir=*) ledir="$val" ;;
--malloc-lib=*) set_malloc_lib "$val" ;;
--mysqld=*) MYSQLD="$val" ;;
+ --auto-server-id) AUTO_SERVER_ID="1" ;;
--mysqld-version=*)
if test -n "$val"
then
***************
*** 625,630 ****
--- 627,637 ----
MYSQLD=mysqld
fi
+ ### Added by yoku0825.
+ if test "$AUTO_SERVER_ID" = "1" ; then
+ SERVER_ID="--server-id=$(getent hosts $(uname -n) | awk '{print $1}' | awk -F. '{id=$3 * 256 + $4; print id}')"
+ fi
+
if test ! -x "$ledir/$MYSQLD"
then
log_error "The file $ledir/$MYSQLD
***************
*** 760,766 ****
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
! "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
do
cmd="$cmd "`shell_quote_string "$i"`
done
--- 767,773 ----
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
! "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$SERVER_ID" "--report-host=$(uname -n)" "$USER_OPTION"
do
cmd="$cmd "`shell_quote_string "$i"`
done