MongoDB Monitoring
Introduction
A MongoDB monitor detects your database status, and automatically triggers traffic switching when the database is abnormal.
Monitoring Status |
Description |
---|---|
Green |
The monitoring is normal. |
Red |
The monitoring is abnormal. Traffic switchover is automatically triggered (if enabled) when the status changes from normal to failed. |
Yellow |
The monitor initialization failed. The initial detection fails when the monitor starts. In this case, confirm the configurations or contact O&M personnel. |
Light gray |
Monitor creation or configuration failed. |
Dark gray |
Invocation failed. The ETCD connection status is abnormal. |
Prerequisites
- A multi-active instance and the corresponding function module have been created.
- A database instance to be monitored has been created in the data center. The monitored database and connected database have been created.
- Monitored Database: two databases with the same name exist in both data centers. Use a monitored database that is different from your service database.
- Connected Database: two databases with the same name exist in both data centers.
Creating a MongoDB Monitor
- Log in to the MAS console. On the Multi-Active Instances page, click an instance whose namespace type is Intra-city multi-active.
- Click the Monitor List tab and click Create Monitor.
- Configure the basic information, then click Next: Data Centers.
Figure 1 Basic information configurations
Table 2 Basic information parameters Parameter
Description
Monitor
Select MongoDB Monitoring.
Application
Select an application.
Monitor Name
Customize the monitor name.
Exception Notification
By default, this option is disabled.
If it is enabled,
- monitor and database exceptions will be sent to you in a timely manner with the Huawei Cloud SMN service. Configure a secret key first.
- Cloud Eye is enabled by default. Ensure that the alarm rules for MAS have been created on the Cloud Eye console. For details, see Creating an Alarm Rule to Monitor an Event.
Subject
If Exception Notification is enabled, select a subject from the drop-down list or click Add to create a new one.
Monitoring
The default value is Yes. If No, database exceptions will not be monitored.
Automatic Switchover
The default value is Yes. If No, automatic switchover of the databases will not be triggered.
Username
Enter the username for logging in to the database.
Password
Enter the password for logging in to the database.
Confirm Password
Enter the password again.
- Configure the information, then click Next: Databases.
Figure 2 Data center configurations
Table 3 Data center parameters Parameter
Description
Cloud
The environment where the monitored MongoDB database is deployed
Region
The region where the monitored database is located
Connection Address
The IP address and port number for accessing the MongoDB database
- Configure the databases, then click Next: Advanced.
Figure 3 Database configurations
Table 4 Database parameters Parameter
Description
Monitored Database
Enter the monitored database name. It is used to detect availability and check whether the database instance connection is normal.
To prevent risks, it is recommended to use a monitored database that is different from your service database and has been granted only the read permissions.
Connected Database
Enter the connected database name. It is the database to which the application is actually connected. You can select different routing algorithms for them in the connection pool configuration.
- Configure the advanced settings, then click Next: Confirm.
Figure 4 Advanced configurations
Table 5 Advanced settings Parameter
Description
Retry Interval (ms)
The interval of reconnection attempts, in milliseconds. Default value (recommended): 3000
Value range: 1000 to 300000
Monitoring Timeout (ms)
The timeout duration before a monitor becomes abnormal.
Default value: 20000 (in milliseconds). Value range: 12000 to 1200000
NOTE:Ensure that the time you specify here is longer than the time required for data center 1 to synchronize data to data center 2. Otherwise, the data in data center 2 may be incomplete.
Database Access Timeout (ms)
The database access timeout duration, over which the database access is considered failed, in milliseconds. Default value (recommended): 3000
Value range: 3000 to 100000
- Confirm settings and click Create.
If the created monitor is not normal, that is, its indicator is not green, its configurations or databases may be abnormal. In this case, rectify the fault.
Connection pool parameters
- Log in to the MAS console. On the Multi-Active Instances page, click an instance to go to its console.
- Click the Monitor List tab and choose More > Configure Connection Pool in the row that contains the target monitor.
- Set the configurations and click OK.
Figure 5 Connection pool configurations
Table 6 Connection pool parameters Parameter
Description
Database Name
Enter the name of the connected MongoDB database.
Routing Algorithm
Options: Single read/write and Single write, local read
AZs
Set this parameter for data centers 1 and 2 based on the AZs where the MongoDB databases are deployed.
Data Source
Customize a name for the data source.
Database Address
Connection address of the MongoDB database.
Schema
Name of the schema to be connected.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot