Monitoring deployment

MatrixDB provides native Grafana-based graphic monitoring tools, and this document describes the steps to deploy monitoring components and manage usage. MatrixDB provides a default monitoring panel that monitors the following information. Users can also create new panels in Grafana based on the data collected by the system to customize the required monitoring items.

  • Cluster status, version, current connection number, startup time, Segment status
  • Disk space: Current disk usage status of Master and Segment servers
  • Database log: browser the logs on recent databases, and filter them by warning, error, serious, and critical levels.
  • You can view the recent load status of the database server, including: CPU, memory, disk IO, network IO, number of processes, etc.
    • All or part of the host can be selected for viewing
    • You can freely select time, date range and automatically refresh time

The deployed renderings are as follows: Default Monitoring Panel

1 Deployment

Monitoring-related components are included in the MatrixDB installation package. After MatrixDB is deployed, monitoring deployment is completed through two steps: metric collection activation and Grafana installation and configuration.

1.1 Activate indicator collection

The following operations can activate the acquisition of metrics for the use of MatrixDB and system resources, and store the collected data in the newly created database matrixmgr of MatrixDB.

Create matrixmgr database

createdb matrixmgr;

Connect to the matrixmgr database, create matrixts and matrixmgr extensions, and activate metric collection

psql -d matrixmgr

matrixmgr=# CREATE EXTENSION matrixts;
matrixmgr=# CREATE EXTENSION matrixmgr;

matrixmgr=# SELECT mxmgr_init_local();

After success, you can observe that a new pattern called "local" appears under the matrixmgr database. Tables and views in this mode contains cluster monitoring and configuration information. Do not change the definitions and contents of these tables and views by yourself.

1.2 Grafana installation and configuration

Prepare a host that can access Master and external network at the same time, which can be a Master or Standby Master node, or a separate machine (all systems such as Linux, MacOS, Windows, etc.).

Install Grafana software, it is recommended to install version 7.3 or higher. The official download and installation link is https://grafana.com/grafana/download.

The following commands describe the operation method using CentOS 7 as an example. For commands for other operating systems, please refer to the corresponding operating system usage guide.

Notes!
YMatrix supports offline installation of Grafana. For details, please see 6 Monitoring - Question 1

Download and install Grafana

wget https://dl.grafana.com/oss/release/grafana-7.3.6-1.x86_64.rpm
sudo yum install grafana-7.3.6-1.x86_64.rpm

Start Grafana

sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server

Note: 1) The grafana version provided by yum in Centos7 is usually older (version 6.x), so it is not recommended to directly sudo yum install grafana. 2) For the complete official installation and configuration process, please refer to the following link https://grafana.com/docs/grafana/latest/installation/rpm

After the installation is completed, use your browser to access the following URL and you can see the Grafana homepage. Here 3000 is the default access port of Grafana, which users can modify. Log in with the default username and password (admin/admin). To ensure security, please change your password yourself. After logging in, click the user avatar icon in the lower left corner to see the modification interface.

http://<安装节点的IP或者域名>:3000

Configure monitoring panel

After Grafana is ready to install, you need to add the matrixmgr database in MatrixDB as a data source and import the predefined monitoring panel.

The steps to add a data source are as follows: Add Data Source 1 Add Data Source 2 Add Data Source 3

The steps to import the monitoring panel are as follows: Add Data Source 1 Add Data Source 2 Add Data Source 3

2 Management

After cluster state acquisition is activated, each host will run the acquisition service and the relevant logs are saved in the /var/log/matrixdb directory.

If you restart MatrixDB, or restart the server and then start MatrixDB, the data collection service will also be automatically started without manual intervention.

If you need to terminate the data collection service, you can connect to the matrixmgr database and execute the mxmgr_remove_all command. After the termination, the collected data will continue to be retained:

psql -d matrixmgr

matrixmgr=# SELECT mxmgr_remove_all('local');

If you manually terminate the data acquisition service or reinstall MatrixDB, you need to activate data acquisition again. You can connect to the matrixmgr database and execute the mxmgr_deploy command:

matrixmgr=# SELECT mxmgr_deploy('local');