日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql rpl_MySQL管理工具MySQL Utilities — mysqlrplcheck(44)

發布時間:2025/3/11 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql rpl_MySQL管理工具MySQL Utilities — mysqlrplcheck(44) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

mysqlrplcheck ?工具是用來檢查復制的先決條件的。這些檢查的設計或者說是測試,是用來確保復制的健康。測試的內容有:

在主上是否啟用了二進制?

是否有排除某些二進制(如有*_do_db 或 *_ignore_db的設置)?如果有,顯示它們。

在主上是否有復制用戶以及權限是否正確?

SERVER_ID是否沖突?

從是否連接到主?如果沒有顯示主的主機和端口。

從上的master.info文件與主上的SHOW SLAVE STATUS顯示的值是否沖突?

InnoDB配置是否兼容(插件還是內嵌的)?

存儲引擎是否兼容(主從一樣)?

lower_case_tables_names設置是否兼容?如果有設置大小寫表名可能會導致問題產生警告。

從是否落后主?

該工具進行每個測試,如果發現任何一個發生錯誤將退出。連接服務器失敗也會退出的。

每個測試的狀態有:pass(滿足先決條件)、fail(滿足先決條件但是發生了一個或多個錯誤,或者例外)、warn(需要進一步研究配置,但是不是錯誤的。)

使用--verbose選項來獲取額外的信息,如server_id、lower_case_table_name設置和從上面的主信息文件內容。

為了查看到SHOW SLAVE STATUS語句的值,可以使用?--show-slave-status 選項。

選項

MySQL Utilities mysqlrplcheck version 1.5.3

License type: GPLv2

Usage: mysqlrplcheck --master=root@localhost:3306 --slave=root@localhost:3310

mysqlrplcheck - check replication

Options:

--version show program's version number and exit

--help display a help message and exit

--license display program's license and exit

--master=MASTER connection information for master server in the form:

[:]@[:][:] or

[:][:] or

path>[].

--slave=SLAVE connection information for slave server in the form:

[:]@[:][:] or

[:][:] or

path>[].

--master-info-file=MASTER_INFO

the name of the master information file on the slave.

Default = 'master.info' read from the data directory.

Note: this option requires that the utility run on the

slave with appropriate file read access to the data

directory.從上的master.info文件。要求在從上執行并有訪問該文件的權限。

-s, --show-slave-status

show slave status。在主上顯示SHOW SLAVE STATUS值。

--width=WIDTH display width。改變測試報告的顯示寬度。默認是75個字符。

--suppress suppress warning messages。取消警告消息。

--ssl-ca=SSL_CA The path to a file that contains a list of trusted SSL

CAs.

--ssl-cert=SSL_CERT The name of the SSL certificate file to use for

establishing a secure connection.

--ssl-key=SSL_KEY The name of the SSL key file to use for establishing a

secure connection.

-v, --verbose control how much information is displayed. e.g., -v =

verbose, -vv = more verbose, -vvv = debug

-q, --quiet turn off all messages for quiet execution.

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

MySQLUtilitiesmysqlrplcheckversion1.5.3

Licensetype:GPLv2

Usage:mysqlrplcheck--master=root@localhost:3306--slave=root@localhost:3310

mysqlrplcheck-checkreplication

Options:

--versionshowprogram's version number and exit

--help????????????????display a help message and exit

--license???????????? display program'slicenseandexit

--master=MASTERconnectioninformationformasterserverintheform:

[:]@[:][:]or

[:][:]or

path>[].

--slave=SLAVEconnectioninformationforslaveserverintheform:

[:]@[:][:]or

[:][:]or

path>[].

--master-info-file=MASTER_INFO

thenameofthemasterinformationfileontheslave.

Default='master.info'readfromthedatadirectory.

Note:thisoptionrequiresthattheutilityrunonthe

slavewithappropriatefilereadaccesstothedata

directory.從上的master.info文件。要求在從上執行并有訪問該文件的權限。

-s,--show-slave-status

showslavestatus。在主上顯示SHOWSLAVESTATUS值。

--width=WIDTHdisplaywidth。改變測試報告的顯示寬度。默認是75個字符。

--suppresssuppresswarningmessages。取消警告消息。

--ssl-ca=SSL_CAThepathtoafilethatcontainsalistoftrustedSSL

CAs.

--ssl-cert=SSL_CERTThenameoftheSSLcertificatefiletousefor

establishingasecureconnection.

--ssl-key=SSL_KEYThenameoftheSSLkeyfiletouseforestablishinga

secureconnection.

-v,--verbosecontrolhowmuchinformationisdisplayed.e.g.,-v=

verbose,-vv=moreverbose,-vvv=debug

-q,--quietturnoffallmessagesforquietexecution.

注意

用戶必須要有SHOW SLAVE STATUS, SHOW MASTER STATUS, SHOW VARIABLES的執行權限。

IP地址和主機名混合使用不推薦。涉及到反向解析的問題。

MySQL客戶端工具的路徑需要包含在PATH環境變量中,以便使用login-paths驗證機制。允許使用my_print_defaults 來從登陸配置文件(.mylogin.cnf)讀取login-path值。

實例

在設置主從復制之前,檢測主從的先決條件,命令如下:

shell> mysqlrplcheck --master=root@host1:3310 --slave=root@host2:3311

# master on host1: ... connected.

# slave on host2: ... connected.

Test Description Status

------------------------------------------------------------------------

Checking for binary logging on master [pass]

Are there binlog exceptions? [pass]

Replication user exists? [pass]

Checking server_id values [pass]

Is slave connected to master? [pass]

Check master information file [pass]

Checking InnoDB compatibility [pass]

Checking storage engines compatibility [pass]

Checking lower_case_table_names settings [pass]

Checking slave delay (seconds behind master) [pass]

# ...done.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

shell>mysqlrplcheck--master=root@host1:3310--slave=root@host2:3311

# master on host1: ... connected.

# slave on host2: ... connected.

TestDescriptionStatus

------------------------------------------------------------------------

Checkingforbinaryloggingonmaster[pass]

Aretherebinlogexceptions?[pass]

Replicationuserexists?[pass]

Checkingserver_idvalues[pass]

Isslaveconnectedtomaster?[pass]

Checkmasterinformationfile[pass]

CheckingInnoDBcompatibility[pass]

Checkingstorageenginescompatibility[pass]

Checkinglower_case_table_namessettings[pass]

Checkingslavedelay(secondsbehindmaster)[pass]

# ...done.

在這個例子中,必須要有登錄主從的有效的登錄信息。

執行相同的命令,并顯示從上的主信息文件的內容和?SHOW SLAVE STATUS 值以及額外的詳細信息,如下:

shell> mysqlrplcheck --master=root@host1:3310 --slave=root@host2:3311 \

--show-slave-status -vv

# master on host1: ... connected.

# slave on host2: ... connected.

Test Description Status

------------------------------------------------------------------------

Checking for binary logging on master [pass]

Are there binlog exceptions? [pass]

Replication user exists? [pass]

Checking server_id values [pass]

master id = 10

slave id = 11

Is slave connected to master? [pass]

Check master information file [pass]

#

# Master information file:

#

Master_Log_File : clone-bin.000001

Read_Master_Log_Pos : 482

Master_Host : host1

Master_User : rpl

Master_Password : XXXX

Master_Port : 3310

Connect_Retry : 60

Master_SSL_Allowed : 0

Master_SSL_CA_File :

Master_SSL_CA_Path :

Master_SSL_Cert :

Master_SSL_Cipher :

Master_SSL_Key :

Master_SSL_Verify_Server_Cert : 0

Checking InnoDB compatibility [pass]

Checking storage engines compatibility [pass]

Checking lower_case_table_names settings [pass]

Master lower_case_table_names: 2

Slave lower_case_table_names: 2

Checking slave delay (seconds behind master) [pass]

#

# Slave status:

#

Slave_IO_State : Waiting for master to send event

Master_Host : host1

Master_User : rpl

Master_Port : 3310

Connect_Retry : 60

Master_Log_File : clone-bin.000001

Read_Master_Log_Pos : 482

Relay_Log_File : clone-relay-bin.000006

Relay_Log_Pos : 251

Relay_Master_Log_File : clone-bin.000001

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 : 482

Relay_Log_Space : 551

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 :

# ...done.

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

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

shell>mysqlrplcheck--master=root@host1:3310--slave=root@host2:3311\

--show-slave-status-vv

# master on host1: ... connected.

# slave on host2: ... connected.

TestDescriptionStatus

------------------------------------------------------------------------

Checkingforbinaryloggingonmaster[pass]

Aretherebinlogexceptions?[pass]

Replicationuserexists?[pass]

Checkingserver_idvalues[pass]

masterid=10

slaveid=11

Isslaveconnectedtomaster?[pass]

Checkmasterinformationfile[pass]

#

# Master information file:

#

Master_Log_File:clone-bin.000001

Read_Master_Log_Pos:482

Master_Host:host1

Master_User:rpl

Master_Password:XXXX

Master_Port:3310

Connect_Retry:60

Master_SSL_Allowed:0

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Master_SSL_Verify_Server_Cert:0

CheckingInnoDBcompatibility[pass]

Checkingstorageenginescompatibility[pass]

Checkinglower_case_table_namessettings[pass]

Masterlower_case_table_names:2

Slavelower_case_table_names:2

Checkingslavedelay(secondsbehindmaster)[pass]

#

# Slave status:

#

Slave_IO_State:Waitingformastertosendevent

Master_Host:host1

Master_User:rpl

Master_Port:3310

Connect_Retry:60

Master_Log_File:clone-bin.000001

Read_Master_Log_Pos:482

Relay_Log_File:clone-relay-bin.000006

Relay_Log_Pos:251

Relay_Master_Log_File:clone-bin.000001

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:482

Relay_Log_Space:551

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:

# ...done.

權限

在主上需要對mysql數據庫具有SELECT 和 INSERT權限,同時還要有REPLICATION SLAVE, REPLICATION CLIENT 和 GRANT OPTION權限。

在從上需要有SUPER 權限。

此外,當使用GTIDs時,從用戶還必需要有對mysql數據庫的SELECT 權限。

總結

以上是生活随笔為你收集整理的mysql rpl_MySQL管理工具MySQL Utilities — mysqlrplcheck(44)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。