Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25434

mariadb container to have HEALTHCHECK

Details

    Attachments

      Issue Links

        Activity

          A fairly obvious generic minimal healthcheck for a MariaDB server could be mysqladmin status call.
          It creates a short status line which doesn't require too much expertise to inspect and can be easily compared to the previous results, and it fails when the server is unreachable.

          $ bin/mysqladmin status --protocol=tcp -uc
          Uptime: 895  Threads: 6  Questions: 40  Slow queries: 0  Opens: 20  Flush tables: 1  Open tables: 13  Queries per second avg: 0.044
          

          It does require an existing user account, but it's unprivileged account, just USAGE is enough, which makes it an easier option than some other status-related queries.

          elenst Elena Stepanova added a comment - A fairly obvious generic minimal healthcheck for a MariaDB server could be mysqladmin status call. It creates a short status line which doesn't require too much expertise to inspect and can be easily compared to the previous results, and it fails when the server is unreachable. $ bin/mysqladmin status --protocol=tcp -uc Uptime: 895 Threads: 6 Questions: 40 Slow queries: 0 Opens: 20 Flush tables: 1 Open tables: 13 Queries per second avg: 0.044 It does require an existing user account, but it's unprivileged account, just USAGE is enough, which makes it an easier option than some other status-related queries.
          danblack Daniel Black added a comment - created https://github.com/MariaDB/mariadb-docker/pull/408 , in review with faust
          danblack Daniel Black added a comment -

          Found some odd behaviour with mysqladmin in MDEV-27731 and because I hadn't implemented a --user arg, it would have hit users quickly. Might add it later. mysqladmin ping also there an less output.

          $ git diff
          diff --git a/healthcheck.sh b/healthcheck.sh
          index 32dfec9..3e77781 100755
          --- a/healthcheck.sh
          +++ b/healthcheck.sh
          @@ -69,6 +69,18 @@ connect()
                  return 0
           }
           
          +# PING
          +#
          +# Ping using a tcp
          +ping()
          +{
          +       mysqladmin ${nodefaults:+--no-defaults} \
          +               ${def['file']:+--defaults-file=${def['file']}} \
          +               ${def['extra_file']:+--defaults-extra-file=${def['extra_file']}}  \
          +               ${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}}  \
          +               --protocol tcp ping
          +}
          +
           # INNODB_BUFFER_POOL_LOADED
           #
           # Tests the load of the innodb buffer pool as been complete
          

          danblack Daniel Black added a comment - Found some odd behaviour with mysqladmin in MDEV-27731 and because I hadn't implemented a --user arg, it would have hit users quickly. Might add it later. mysqladmin ping also there an less output. $ git diff diff --git a/healthcheck.sh b/healthcheck.sh index 32dfec9..3e77781 100755 --- a/healthcheck.sh +++ b/healthcheck.sh @@ -69,6 +69,18 @@ connect() return 0 } +# PING +# +# Ping using a tcp +ping() +{ + mysqladmin ${nodefaults:+--no-defaults} \ + ${def['file']:+--defaults-file=${def['file']}} \ + ${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \ + ${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \ + --protocol tcp ping +} + # INNODB_BUFFER_POOL_LOADED # # Tests the load of the innodb buffer pool as been complete

          When it comes to InnoDB, I think that it might make sense to implement a systemd watchdog (MDEV-24669), a dead man’s switch that would be actuated every now and then, and would be blocked if dict_sys.mutex or dict_sys.latch cannot be acquired for a long time.

          The InnoDB health might also be computed from some performance metrics, but I do not have specific ideas. The checkpoint age (log bytes written since the latest checkpoint) or the number of dirty pages in the buffer pool may not be reasonable measures if idle page flushing (MDEV-24949) is not enabled.

          Perhaps there could be a ‘health formula’ that could be re(de)fined by the DBA to match the deployment? Something like a user-defined function that would return a single number?

          marko Marko Mäkelä added a comment - When it comes to InnoDB, I think that it might make sense to implement a systemd watchdog ( MDEV-24669 ), a dead man’s switch that would be actuated every now and then, and would be blocked if dict_sys.mutex or dict_sys.latch cannot be acquired for a long time. The InnoDB health might also be computed from some performance metrics, but I do not have specific ideas. The checkpoint age (log bytes written since the latest checkpoint) or the number of dirty pages in the buffer pool may not be reasonable measures if idle page flushing ( MDEV-24949 ) is not enabled. Perhaps there could be a ‘health formula’ that could be re(de)fined by the DBA to match the deployment? Something like a user-defined function that would return a single number?
          danblack Daniel Black added a comment -

          Noted. There's some talk of partial integration of systemd features into container runtimes, but its still fairly conceptual only at the moment.

          I was considering a generic query as an argument to the script to leave it to any function the DBA wants. User's aren't currently tied to using the healthcheck script provided.

          danblack Daniel Black added a comment - Noted. There's some talk of partial integration of systemd features into container runtimes, but its still fairly conceptual only at the moment. I was considering a generic query as an argument to the script to leave it to any function the DBA wants. User's aren't currently tied to using the healthcheck script provided.

          People

            danblack Daniel Black
            danblack Daniel Black
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.