使用pt-heartbeat帮助测试MySQL从库delay时长-

第一次运行测试成功,运行顺畅。

过几天再次用--update测试时,发现pt-heartbeat只update一次就自己退出了,--daemonize参数似乎不起作用。

而且程序退出的exitcode还是0.

排查半天未发现问题。

后在从库上测试,发现出现同样问题,但这次注意到--stop的时候有提示:

[root@localhost mysql3306]# /usr/bin/pt-heartbeat --stop --database=pt --defaults-file=/data/mysql/mysql3306/conf/my3306.cnf --socket=/data/mysql/mysql3306/3306.sock --ask-pass
Successfully created file /tmp/pt-heartbeat-sentinel

查看pt-heartbeat代码发现该文件存在pt-heartbeat就会自动退出。

删除掉该文件后,主库上终于可以运行pt了。

重新仔细阅读pt-heartbeat的man手册才发现,手册里早已经进行了说明。

       --sentinel
           type: string; default: /tmp/pt-heartbeat-sentinel
           Exit if this file exists.
       --stop
           Stop running instances by creating the sentinel file.
           This should have the effect of stopping all running instances which are watching the same sentinel file.  If none of "--update", "--monitor" or "--check" is specified, "pt-heartbeat" will exit
           after creating the file.  If one of these is specified, "pt-heartbeat" will wait the interval given by "--interval", then remove the file and continue working.
           You might find this handy to stop cron jobs gracefully if necessary, or to replace one running instance with another.  For example, if you want to stop and restart "pt-heartbeat" every hour
           (just to make sure that it is restarted every hour, in case of a server crash or some other problem), you could use a "crontab" line like this:
            0 * * * * pt-heartbeat --update -D test --stop \
              --sentinel /tmp/pt-heartbeat-hourly
           The non-default "--sentinel" will make sure the hourly "cron" job stops only instances previously started with the same options (that is, from the same "cron" job).
           See also "--sentinel".
[root@localhost mysql3306]# cat /tmp/pt-heartbeat-sentinel
Remove this file to permit pt-heartbeat to run
 
 

pt-heartbeat --update --daemonize 只执行一次秒退的问题的更多相关文章

  1. update语句的执行步骤及commit语句的执行顺序

    update语句的执行步骤和其他DML语句的执行步骤是一样的包含insert .delete语句等,执行步骤如下: 一.如果数据和回滚数据不在数据库高速缓存区中,则oracle服务器进程将把他们从数据 ...

  2. 利用闭包实现多次ajax请求只执行最后一次

    点一个按钮,则向服务器请求资源,不作处理时,多次点击后会有很多个请求在等待.我们知道一般我们用ajax是异步请求,那么我们快速重复点击一个按钮得到的结果其实我们并不知道是哪次点击的结果可能是第一次可能 ...

  3. ffmpeg在shell循环中只执行一次问题

    最近写了一个shell脚本,发现 ffmpeg 命令只执行了一次就停了,最后找到原因: ffmpeg有时会读取标准输入流,导致命令出错,解决办法是在ffmpeg命令之后添加 #xxx ffmpeg x ...

  4. iOS只执行一次的方法

    IOS开发(64)之GCD任务最多只执行一次 1 前言 使用 dispatch_once 函数 在 APP 的生命周期内来保证你想确保每段代码只执行一次,即使它在代码的不同地方多次调用(比如单例的初始 ...

  5. ajax多次请求,只执行最后一次的方法

    ajax多次请求,只执行最后一次的方法 有时候点击按钮进行异步请求数据的时候可能网络差,用户会点击很多次,或者页面有很多相同的按钮,参数不同,但是调用的ajax相同,只想得到最后一次结果 我的思路是用 ...

  6. 友盟分享到微信 监听不执行 监听只执行onStart,(onResult,onError,onCancel 不执行)

    最近在做一个项目 有一个需求是要分享项目中的一个商品 这对于我来说简直是 so easy (项目是三个人一起写的) 正好看到之前有同事写完了  我就拿过来用吧  一顿复制粘贴  大功告成   这个是监 ...

  7. node编写定时任务,for循环只执行一遍的解决办法

    在用node编写定时任务时候,发现for循环只执行i=0这一次,就不接着循环执行了,下面贴上代码: exports.task = async function(ctx){ let { app } = ...

  8. js多次触发事件,在一定延迟内只执行一次 (事件累加)

    js多次触发事件,在一定延迟内只执行一次的案例: <!DOCTYPE html> <html> <head> <meta charset="UTF- ...

  9. Hibernate的hql语句save,update方法不执行

    Hibernate的hql语句save,update方法不执行 可能出现的原因问题: 未进行事务管理 需要进行xml事务配置或者注解方式的事务配置

随机推荐

  1. 使用Hexo & Github,搭建属于自己的博客

    经过在网上各种找资料,踩过各种坑,终于搭建好了hexo,直接与gitbub一起使用,搭建起自己的免费的博客. 关于Hexo Hexo是一款基于Node.js的静态博客框架. Hexo特性 风一般的速度 ...

  2. bootstrap 通过js代码创建和关闭插件

    插件的创建机制 默认情况下,boostrap.js文件被页面加载执行完成后,boostrap会自动根据html元素的data-toggle属性和相关class创建插件对象.有时候,我们不希望boost ...

  3. Ubuntu 配置Tomcat环境(转载)

    Ubuntu 配置Tomcat环境   1.下载Tomcat http://tomcat.apache.org/,下载Tomcat 8(由于目前最新eclipse不支持tomcat 9) 将下载的ap ...

  4. 基于多层感知机的手写数字识别(Tensorflow实现)

    import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_dat ...

  5. 分布式理论(二)——Base 理论

    前言 在前文 分布式理论(一) -- CAP 定理 中,我们说,CAP 不可能同时满足,而分区容错是对于分布式系统而言,是必须的.最后,我们说,如果系统能够同时实现 CAP 是再好不过的了,所以出现了 ...

  6. .net开源项目整理

    整理一些平时收藏和应用的开源代码,方便自己学习和查阅 1.应用 nopcommerce,开源电商网站,开发环境asp.net mvc(未支持.net core),使用技术(autofac,ef,页面插 ...

  7. 实现泛型数组的冒泡排序算法 C#

    public static class BubbleSortTool { public static void BubbleSort<T>(this T[] array, Ascendin ...

  8. NIO学习笔记七:Pipe

    Java NIO 管道是2个线程之间的单向数据连接.Pipe有一个source通道和一个sink通道.数据会被写到sink通道,从source通道读取. 这里是Pipe原理的图示: 示例代码 Pipe ...

  9. ESB企业服务总线

    ESB是企业服务总线(Enterprise Service Bus)的缩写,是中间件技术与Web Service等技术结合的产物,也是SOA系统中的核心基础设施.ESB就是一个服务的中介,形成服务使用 ...

  10. HDU3829(KB10-J 二分图最大独立集)

    Cat VS Dog Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total ...