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

Collect InnoDB cluster status #393

Open
fredgate opened this issue Jun 7, 2019 · 0 comments
Open

Collect InnoDB cluster status #393

fredgate opened this issue Jun 7, 2019 · 0 comments

Comments

@fredgate
Copy link

fredgate commented Jun 7, 2019

Feature suggestion : in order to be able to monitor InnoDB cluster with the exporter, it will be nice to know the status of each of the members in the cluster.
The above query allow to get topology of the cluster and state of each node :

SELECT
  REGEXP_SUBSTR(i.instance_name, '.+?(?=:)'),c.cluster_name as CLUSTER_NAME,
  i.*,
  rgm.*,
  IFNULL(rgm.MEMBER_STATE, 'OFFLINE') MEMBER_STATE_UPDATE,
  case rgm.MEMBER_STATE when 'ONLINE' then 0 when 'RECOVERING' then 1 else 2 end STATUS, case rgm.MEMBER_ROLE when 'PRIMARY' then 0 else 1 end ROLE
FROM
  mysql_innodb_cluster_metadata.clusters c
  INNER JOIN mysql_innodb_cluster_metadata.instances i ON c.default_replicaset = i.replicaset_id
  LEFT JOIN performance_schema.replication_group_members rgm ON i.mysql_server_uuid = rgm.MEMBER_ID
WHERE
  @@hostname = (SELECT MEMBER_HOST FROM performance_schema.replication_group_members WHERE MEMBER_ROLE = 'PRIMARY')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant