Replica state
Job details
Name: |
Replica state |
Platform: |
Mysql |
Category: |
Cluster and Replication |
Description: |
NDB data node status |
Long description: |
|
Version: |
1.2 |
Default schedule: |
60s |
Requires engine install: |
No |
Compatibility tag: |
./instance[databasetype=‘mysql’] |
Parameters
Name |
Default value |
Description |
return_status |
1 |
Return status value (ALARM – 2, WARNING – 1, or OK – 0) when replica changes occurs. |
keep_status |
10 |
For how long (in minutes) the jobs status will be kept when replica changes occurs. |
Job Summary
- Purpose: The purpose of this job is to monitor and track if replica changes occur in MySQL database instances. It observes if an instance becomes a replica or if an instance ceases to be a replica.
- Why: Monitoring replica state is essential in a database context, as it helps in keeping track of the replica status of each MySQL database instance. It aids in identifying shifts in database roles and maintaining a balanced distribution of the load.
- Manual checking: This job cannot be manually checked as it entails complex scripting and continuous monitoring only possible through this dbWatch Control Center job.
Key Features of the Job
- The job, titled “Replica state”, is version 1.2, developed by the dbwatch.no company.
- It belongs to the group com.dbwatch.job and holds the artifact id mysql_replica_state.
- It records keys such as status, details, last_replicas_state, last_replicas_state_time, and last_replicas_state_time_count.
- This job falls under the category of “Cluster and Replication”.
- Its default scheduling frequency is every 60 seconds.
Functionality
The JavaScript engine behind this job performs the following functions:
- It sets initial values for variables including status, pos, msg, replicas_stat, time_sec, change_val, sec_after_last_change, change_count_val.
- It retrieves the master/slave status.
- It checks if replica changes have occurred and updates values of ‘last_replicas_state_time’ and ‘last_replicas_state_time_count’ and ‘status’ accordingly.
- It checks if the instance is running as a slave (replica) or master (source) host, and provides the time of the last change in each case.
- It maintains status and updates messages if a change from MASTER to REPLICA or REPLICA to MASTER is detected.
- It catches and reports exceptions during execution.
Report Template
- The report template contains a version of 2, with the title “Replica state” and description “Master/Slave change.”
- A default scheduling of “0 * * *” is set.
- The chapter presentation consist of a table presentation with column name “Details”.
- It displays the status between the replication SQL (applier) thread and the replication I/O (receiver) thread.