Giter Club home page Giter Club logo

heartbeatone's Introduction

简体中文

HeartbeatOne

A MySql master-salve replication lag time checker tool implementation by PHP more like pt-heartbeat.

ScreenShot

(command line sample)
image

(log file sample)
image

Istall&Usage

Install

Download this project zip file and deploy on your any one php machine which can access MySql server.

Setting

Change the setting.php according to your actual situation.

<?php

/**
 * Default setting sample
 * 
 */

return [
    'mysqlMasterHost' => '', // Write server host

    'mysqlMasterUser' => '',

    'mysqlMasterPwd' => '',

    'mysqlSlaveHosts' => [], // Slaves host of the master

    'mysqlSlaveUser' => '', // Read server username

    'mysqlSlavePwd' => '',

    'interval' => 1, // Frequency for update monitor time in seconds

    'averages' => [1, 5, 30], // Latest period slave lagging average time in seconds, can be more than three and even more, su as [1, 5, 30, 60 ...]

    'logFilePath' => '/val/logs/',

    'logFileName' => 'HeartbeatOne-Monitor',

    'mysqlDriver' => 'mysqli', // Only support `mysqlli` or `PDO` driver
];

Create Monitor Table

Import heartbeat.sql to your MySQl master server which you want tracing.

Running

Just run following command in cli, you can see dealy time report and wirte to log in the meanwhile if everything is ok.

php heartbeat.php

For the production suggest run in background then only wirte delay data to log file.

nohup php heartbeat.php > /dev/null &

Details

  • Notice! The monitor log content will be clear every 24hours

heartbeatone's People

Contributors

lijiebin avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.