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
|
vim
/
etc
/
my.cnf
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port
=
3306
socket
=
/
usr
/
local
/
mysql
/
tmp
/
mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port
=
3306
socket
=
/
usr
/
local
/
mysql
/
tmp
/
mysql.sock
skip
-
external
-
locking
key_buffer_size
=
384M
max_allowed_packet
=
1M
table_open_cache
=
512
sort_buffer_size
=
2M
read_buffer_size
=
2M
read_rnd_buffer_size
=
8M
myisam_sort_buffer_size
=
64M
thread_cache_size
=
8
query_cache_size
=
32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency
=
8
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log
-
bin
=
mysql
-
bin
log
-
slave
-
updates
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server
-
id
=
1
|
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
|
vim
/
etc
/
my.cnf
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port
=
3306
socket
=
/
usr
/
local
/
mysql
/
tmp
/
mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port
=
3306
socket
=
/
usr
/
local
/
mysql
/
tmp
/
mysql.sock
skip
-
external
-
locking
key_buffer_size
=
384M
max_allowed_packet
=
1M
table_open_cache
=
512
sort_buffer_size
=
2M
read_buffer_size
=
2M
read_rnd_buffer_size
=
8M
myisam_sort_buffer_size
=
64M
thread_cache_size
=
8
query_cache_size
=
32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency
=
8
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log
-
bin
=
mysql
-
bin
log
-
slave
-
updates
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server
-
id
=
10
# Replication Slave (comment out master section to use this)
|
1
2
3
4
5
6
7
8
|
mysql> show master status;
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
|
File
| Position | Binlog_Do_DB | Binlog_Ignore_DB |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| mysql
-
bin
.
000016
|
615
| | |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
1
row
in
set
(
0.00
sec)
mysql>
|
1
2
3
|
mysql>grant all on *.* to duyunlong@
'192.168.1.%'
identified by
'123456'
;
Query OK,
0
rows affected (
0.01
sec)
mysql>change master to master_host=
'192.168.1.232'
,master_user=
'duyunlong'
,master_password=
'123456'
,master_log_file=
'mysql-bin.000016'
,master_log_pos=
615
;
|
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
|
mysql> show slave status \G;
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
1.
row
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Slave_IO_State: Waiting
for
master to send event
Master_Host:
192.168
.
1.232
Master_User: duyunlong
Master_Port:
3306
Connect_Retry:
60
Master_Log_File: mysql
-
bin
.
000016
Read_Master_Log_Pos:
615
Relay_Log_File: HA1
-
relay
-
bin
.
000002
Relay_Log_Pos:
346
Relay_Master_Log_File: mysql
-
bin
.
000016
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
0
Last_Error:
Skip_Counter:
0
Exec_Master_Log_Pos:
615
Relay_Log_Space:
500
Until_Condition:
None
Until_Log_File:
Until_Log_Pos:
0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master:
0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
0
Last_IO_Error:
Last_SQL_Errno:
0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
10
1
row
in
set
(
0.00
sec)
ERROR:
No query specified
|
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
|
mysql> show slave status \G;
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
1.
row
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Slave_IO_State: Waiting
for
master to send event
Master_Host:
192.168
.
1.231
Master_User: duyunlong
Master_Port:
3306
Connect_Retry:
60
Master_Log_File: mysql
-
bin
.
000018
Read_Master_Log_Pos:
552
Relay_Log_File: HA2
-
relay
-
bin
.
000002
Relay_Log_Pos:
441
Relay_Master_Log_File: mysql
-
bin
.
000018
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
0
Last_Error:
Skip_Counter:
0
Exec_Master_Log_Pos:
552
Relay_Log_Space:
595
Until_Condition:
None
Until_Log_File:
Until_Log_Pos:
0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master:
0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
0
Last_IO_Error:
Last_SQL_Errno:
0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
1
1
row
in
set
(
0.00
sec)
ERROR:
No query specified
|
1
2
3
4
5
6
7
8
9
10
11
|
[root@HA1 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.231 -e 'show databases;'
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| Database |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| information_schema |
| mysql |
| performance_schema |
| test |
| wanghaipeng |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
[root@HA1 ~]
#
|
1
2
3
4
5
6
7
8
9
10
11
|
[root@HA2 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.232 -e 'show databases;'
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| Database |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| information_schema |
| mysql |
| performance_schema |
| test |
| wanghaipeng |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
[root@HA2 ~]
#
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@HA1 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.231 -e 'create database a;'
[root@HA1 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.231 -e 'show databases;'
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| Database |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| information_schema |
| a |
| mysql |
| performance_schema |
| test |
| wanghaipeng |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
[root@HA1 ~]
#
|
1
2
3
4
5
6
7
8
9
10
11
|
[root@HA2 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.232 -e 'show databases;'
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| Database |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| information_schema |
| a |
| mysql |
| performance_schema |
| test |
| wanghaipeng |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@HA2 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.232 -e 'create database b;'
[root@HA2 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.232 -e 'show databases;'
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| Database |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| information_schema |
| a |
| b |
| mysql |
| performance_schema |
| test |
| wanghaipeng |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
[root@HA2 ~]
#
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@HA1 ~]
# mysql mysql -uduyunlong -p123456 -h192.168.1.231 -e 'show databases;'
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| Database |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
| information_schema |
| a |
| b |
| mysql |
| performance_schema |
| test |
| wanghaipeng |
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
[root@HA1 ~]
#
|