Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql collector: slave_status charts per replication channel #6597

Merged
merged 3 commits into from
Aug 6, 2019

Conversation

ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Aug 5, 2019

Summary

Fixes: #6353

Ref: https://dev.mysql.com/doc/refman/8.0/en/replication-channels.html

To provide compatibility with previous versions, the MySQL server automatically creates on startup a default channel whose name is the empty string (""). This channel is always present; it cannot be created or destroyed by the user. If no other channels (having nonempty names) have been created, replication statements act on the default channel only, so that all replication statements from older slaves function as expected

SHOW SLAVE STATUS reports the status for all channels, except the group_replication_applier channel.


As we can see in #6353 (comment)

SHOW SLAVE STATUS returns several rows, one row per replication channel.

Before this PR:

  • slave status charts only for the first channel.

After this PR:

  • slave status charts for every channel.
Component Name

/collectors/python.d.plugin/mysql

Additional Information

Tests:

  • i tested PR with 1 replication channel, works ok
  • i didnt test the PR with n replication channels (@vpapas will do i hope)

@vpapas could you test the PR?


SHOW SLAVE STATUS reports the status for all channels, except the group_replication_applier channel.

From what i understand the only way to monitor replication metrics if instance in replication group is to execute SHOW SLAVE STATUS CHANNEL <NAME> for every channel. SHOW SLAVE STATUS returns nothing in that case.

@netdata netdata deleted a comment Aug 5, 2019
@netdatabot netdatabot added area/collectors Everything related to data collection area/external/python labels Aug 5, 2019
@ilyam8
Copy link
Member Author

ilyam8 commented Aug 6, 2019

ok, i tested the PR, it works ok if show slave status returns several rows and there is Channel_Name in the row.

show slave status
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: xxxxxxxxxxx
Master_User: user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File:
Read_Master_Log_Pos: 4
Relay_Log_File: xxxxx@[email protected]
Relay_Log_Pos: 4
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: No
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: 0
Relay_Log_Space: 154
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: NULL
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: 0
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 64485c6f-334c-11e8-b1d8-0050569d2e3c:1-19159184
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name: channel01
Master_TLS_Version:
*************************** 2. row ***************************
Slave_IO_State:
Master_Host: xxxxxxxxxxx
Master_User: user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File:
Read_Master_Log_Pos: 4
Relay_Log_File: xxxx@[email protected]
Relay_Log_Pos: 4
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: No
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: 0
Relay_Log_Space: 154
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: NULL
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: 0
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 64485c6f-334c-11e8-b1d8-0050569d2e3c:1-19159184
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name: channel02
Master_TLS_Version:
2 rows in set (0.00 sec)

@ilyam8 ilyam8 merged commit a22b7e9 into netdata:master Aug 6, 2019
@ilyam8 ilyam8 deleted the mysql_replication_channels branch August 6, 2019 13:48
jacekkolasa pushed a commit to jacekkolasa/netdata that referenced this pull request Aug 6, 2019
jackyhuang85 pushed a commit to jackyhuang85/netdata that referenced this pull request Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/collectors Everything related to data collection
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mysql slave status for channels
3 participants