Monitor MySQL

    This tutorial demonstrates how to monitor and visualize MySQL metrics.

    • You need to enable the App Store. MySQL and MySQL Exporter are available in the App Store.
    • You need to create a workspace, a project, and a user () for this tutorial. The user needs to be invited to the project with the operator role. For more information, see .

    To begin with, you need to deploy MySQL from the App Store.

    1. Click MySQL to go to its details page and click Install on the App Information tab.

      Note

      MySQL is a built-in app in the KubeSphere App Store, which means it can be deployed and used directly once the App Store is enabled.

    2. Under Basic Information, set a Name and select a Version. Select the project where the app is deployed under Location and click Next.

    3. Wait until MySQL is up and running.

    You need to deploy MySQL Exporter in the same project on the same cluster. MySQL Exporter is responsible for querying the status of MySQL and reports the data in Prometheus format.

    1. Go to App Store and click MySQL Exporter.

    2. On the details page, click Install.

    3. Make sure serviceMonitor.enabled is set to true. The built-in MySQL Exporter sets it to by default, so you don’t need to manually change the value of serviceMonitor.enabled.

      Warning

    4. Modify MySQL connection parameters. MySQL Exporter needs to connect to the target MySQL. In this tutorial, MySQL is installed with the service name mysql-dh3ily. Navigate to mysql in the configuration file, and set host to , pass to testing, and user to root. Note that your MySQL service may be created with a different name. After you finish editing the file, click Install.

    5. Wait until MySQL Exporter is up and running.

    You can create a monitoring dashboard for MySQL and visualize real-time metrics.

    1. In the same project, go to Custom Monitoring under Monitoring & Alerting in the sidebar and click Create.

    2. In the displayed dialog box, set a name for the dashboard (for example, ) and select the MySQL template. Click Next to continue.

    3. Save the template by clicking Save Template in the upper-right corner. A newly-created dashboard is displayed on the Custom Monitoring Dashboards page.

      Note

      • For more information about dashboard properties, see .