Skip to content

Instantly share code, notes, and snippets.

@michaeljoy
Last active November 18, 2019 14:24
Show Gist options
  • Save michaeljoy/ac94cb9543237e8b9d7d5720fbd88600 to your computer and use it in GitHub Desktop.
Save michaeljoy/ac94cb9543237e8b9d7d5720fbd88600 to your computer and use it in GitHub Desktop.

Revisions

  1. michaeljoy revised this gist Nov 17, 2019. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions pt-heartbeat-databasenamehere.service
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,19 @@
    #
    # pt-heartbeat-databasenamehere systemd service file
    # pt-heartbeat systemd service file for databasenamehere
    #
    [Unit]
    Description="pt-heartbeat-databasenamehere"
    After=syslog.target mysql.service
    Requires=mysql.service
    Description="pt-heartbeat"
    After=network-online.target syslog.target
    Wants=network-online.target

    [Install]
    WantedBy=multi-user.target

    [Service]
    Type=simple
    Type=forking
    PIDFile=/var/run/pt-heartbeat-databasenamehere.pid
    ExecStart=/usr/bin/pt-heartbeat "--config=/etc/percona-toolkit/pt-heartbeat-databasenamehere.conf" "--defaults-file=/etc/percona-toolkit/my.cnf" "--update"
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=pt-heartbeat-databasenamehere
    SyslogIdentifier=pt-heartbeat
    Restart=on-abort
  2. Michael Joy renamed this gist Jul 6, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. Michael Joy renamed this gist Jul 6, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. Michael Joy created this gist Jul 6, 2017.
    7 changes: 7 additions & 0 deletions my.cnf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    [mysql]
    host=localhost
    socket=/var/run/mysqld/mysqld.sock

    [client]
    host=localhost
    socket=/var/run/mysqld/mysqld.sock
    10 changes: 10 additions & 0 deletions pt-heartbeat-databasenamehere.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    utc
    replace
    daemonize
    pid=/var/run/pt-heartbeat-databasenamehere.pid
    socket=/var/run/mysqld/mysqld.sock
    database=databasenamehere
    table=heartbeat
    interval=0.01
    user=insert_low_privilege_mysql_user_here
    password=insert_low_privilege_mysql_user_password_here
    19 changes: 19 additions & 0 deletions pt-heartbeat-databasenamehere.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #
    # pt-heartbeat-databasenamehere systemd service file
    #
    [Unit]
    Description="pt-heartbeat-databasenamehere"
    After=syslog.target mysql.service
    Requires=mysql.service

    [Install]
    WantedBy=multi-user.target

    [Service]
    Type=simple
    PIDFile=/var/run/pt-heartbeat-databasenamehere.pid
    ExecStart=/usr/bin/pt-heartbeat "--config=/etc/percona-toolkit/pt-heartbeat-databasenamehere.conf" "--defaults-file=/etc/percona-toolkit/my.cnf" "--update"
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=pt-heartbeat-databasenamehere
    Restart=on-abort
    15 changes: 15 additions & 0 deletions pt_heartbeat_user_grants.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    -- Grants for 'pt_heartbeat'@'10.%'
    CREATE USER IF NOT EXISTS 'pt_heartbeat'@'10.%';
    ALTER USER 'pt_heartbeat'@'10.%' IDENTIFIED WITH 'mysql_native_password' AS 'INSERTREALLYSECUREPASSWORDHERE' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
    GRANT DELETE, INSERT, SELECT, UPDATE ON `databasenamehere`.`heartbeat` TO 'pt_heartbeat'@'10.%';
    GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'pt_heartbeat'@'10.%';
    -- Grants for 'pt_heartbeat'@'127.0.0.1'
    CREATE USER IF NOT EXISTS 'pt_heartbeat'@'127.0.0.1';
    ALTER USER 'pt_heartbeat'@'127.0.0.1' IDENTIFIED WITH 'mysql_native_password' AS 'INSERTREALLYSECUREPASSWORDHERE' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
    GRANT DELETE, INSERT, SELECT, UPDATE ON `databasenamehere`.`heartbeat` TO 'pt_heartbeat'@'127.0.0.1';
    GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'pt_heartbeat'@'127.0.0.1';
    -- Grants for 'pt_heartbeat'@'localhost'
    CREATE USER IF NOT EXISTS 'pt_heartbeat'@'localhost';
    ALTER USER 'pt_heartbeat'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS 'INSERTREALLYSECUREPASSWORDHERE' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
    GRANT DELETE, INSERT, SELECT, UPDATE ON `databasenamehere`.`heartbeat` TO 'pt_heartbeat'@'localhost';
    GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'pt_heartbeat'@'localhost';