使用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. [Python 从入门到放弃] 3. BIF(内建函数)

    BIF (built-in functions) Python中提供了70多个内建函数,具备大量的现成功能. BIF不需要专门导入,可以直接使用,拿来就用 1.print() # 在屏幕上打印输出 如 ...

  2. php实现请求分流

    一个请求,同时分发到多个服务器, 正常的是: A ============>  B 现在想实现的是: --------------> C A   ======>  B   ----- ...

  3. Inno Setup中多语言时,使用占位符填充

    如在: [CustomMessages] CreateDesktopIcon=Create a Desktop icon NameAndVersion=%1 version %2 普通的获取Custo ...

  4. Mybatis 的配置xml和properties放在jar包以外的一种方法

    1.问题 开发时候,将xml和properties放resources,直接可以访问到,然而打包后这两个文件也一同被打包到jar包里面,如果发布后想修改就会比较麻烦,所以希望将xml配置文件和prop ...

  5. 我进行jvm内存调优的一些记录

    jvm内存调优的一些记录 java内存调优的方法和过程 可以使用 jmap -heap pid号 查看,例如pid是9300,执行的结果可能是这样的. root@ubuntu:~# jmap -hea ...

  6. WCF 学习总结1 -- 简单实例

    从VS2005推出WCF以来,WCF逐步取代了Remoting, WebService成为.NET上分布式程序的主要技术.WCF统一的模型整合了以往的 WebService.Remoting.MSMQ ...

  7. Redis-发布与订阅

    发布与订阅(pub/sub)的特点是订阅者负责订阅频道发送者负责向频道发送二进制字符串消息.每当有消息发送至给定频道时,频道的所有订阅者都会收到消息 (发布和订阅命令) SUBSCRIBE : SUB ...

  8. 在iframe窗体内 获取父级的元素;;在父窗口中获取iframe中的元素

    在iframe中获取父窗口的元素 $(‘#父窗口中的元素ID’, parent.document).click(); 在父窗口中获取iframe中的元素 $(“#iframe的ID”).content ...

  9. order by与索引(转载)

    order by与索引   ORDER BY 通常会有两种实现方法,一个是利用有序索引自动实现,也就是说利用有序索引的有序性就不再另做排序操作了.另一个是把结果选好之后再排序. 用有序索引这种,当然是 ...

  10. 简单的SpringMVC经典案例

    主题:构建一个基于SpringMVC的HelloWord Web 项目 目的:快速体验什么是SpringMVC 方案: 1.创建工程,命名:SpringMVC 2.导包 3.在SRC下添加spring ...