Help Center/ Document Database Service/ Getting Started/ Getting Started with Common Practices
Updated on 2023-07-26 GMT+08:00

Getting Started with Common Practices

After purchasing and connecting to a DB instance, you can view common practices to better use DDS.

Table 1 Common practices

Practice

Document

Description

Data Backups

Configuring an Automated Backup Policy

DDS backs up data automatically based on the automated backup policy you set. Regularly backing up your database is recommended. If your database becomes faulty or data is corrupted, you can restore it from backups.

The automated backup policy for DDS is enabled by default.

Creating a Manual Backup

This practice describes how to create a manual backup. Creating a backup for a DB instance helps ensure data can be restored if needed, ensuring data reliability.

Data Restorations

Restoring Data to a New Instance

DDS allows you to restore an existing automated or manual backup to a new instance. The restored data is the same as the backup data.

When you restore an instance from a backup file, a full backup file is downloaded from OBS and then restored to the instance at an average speed of 40 MB/s.

Restoring Data to the Original Instance

DDS allows you to restore an existing automated or manual backup to an original instance. The restored data is the same as the backup data.

When you restore an instance from a backup file, a full backup file is downloaded from OBS and then restored to the instance at an average speed of 40 MB/s.

Restoring Data to a Point in Time

DDS allows you to restore cluster and replica set instances to a point in time.

When you enter the point in time that you want to restore the instance to, DDS downloads the most recent full backup file from OBS to the instance. Then, incremental backups are also restored to the specified point in time on the instance. Data is restored at an average speed of 30 MB/s.

Data Migration

Migrating Data Using mongoexport and mongoimport

mongoexport and mongoimport are backup and restoration tools provided by the MongoDB client. You can install a MongoDB client on the local device or ECS and use the mongoexport and mongoimport tools to migrate your on-premises MongoDB databases or other cloud MongoDB databases to DDS instances.

Before migrating data from a MongoDB database to DDS, transfer data to a .json file using the mongoexport tool. This practice describes how to import the data from the JSON files to DDS using the mongoimport tool on the ECS or from some other devices that can access DDS.

Migrating Data Using mongodump and mongorestore

mongodump and mongorestore are backup and restoration tools provided by the MongoDB client. You can install a MongoDB client on the local device or ECS and use the mongodump and mongorestore tools to migrate your on-premises MongoDB databases or other cloud MongoDB databases to DDS instances.

From Other Cloud MongoDB to DDS

DRS helps you migrate MongoDB databases from other cloud platforms to DDS instances on the current cloud. With DRS, you can perform real-time migration tasks with minimal downtime. Services and databases remain operational during a migration.

From On-Premises MongoDB to DDS

DRS helps you migrate data from on-premises MongoDB databases to DDS instances on the current cloud. With DRS, you can perform real-time migration tasks with minimal downtime. Services and databases remain operational during a migration.

From ECS-hosted MongoDB to DDS

DRS helps you migrate data from MongoDB databases on ECSs to DDS instances on the current cloud. With DRS, you can perform real-time migration tasks with minimal downtime. Services and databases remain operational during a migration.

From DDS to MongoDB

This practice describes how to migrate data from a DDS instance to an on-premises MongoDB database.

Instance Modifications

Changing an Instance Name

This practice describes how to change an instance name to identify different instances.

Changing an Instance Class

This practice describes how to change the class of a cluster, replica set, or single node instance.

Scaling Up Storage Space

This practice describes how to scale up the storage space of an instance. If you scale up the storage space of an instance, the backup space increases accordingly.

Data Security

Enabling or Disabling SSL

Secure Socket Layer (SSL) is an encryption-based Internet security protocol for establishing an encrypted link between a server and a client. It provides privacy, authentication, and integrity to Internet communications. SSL:

  • Authenticates users and servers, ensuring that data is sent to the correct clients and servers.
  • Encrypts data to prevent it from being intercepted during transfer.
  • Ensures data integrity during transmission.

After SSL is enabled, you can establish an encrypted connection between your client and the instance you want to access to improve data security.

Changing a Security Group

This practice describes how to change a security group for cluster and replica set instances.

Logs

Error Logs

DDS log management allows you to view database-level logs, including warning- and error-level logs generated during database running, which help you analyze system problems.

Slow Query Logs

Slow query logs record statements that exceed operationProfiling.slowOpThresholdMs (500 seconds by default). You can view log details and statistics to identify statements that are executing slowly and optimize the statements. You can also download slow query logs for service analysis.

Audit Logs

An audit log records operations performed on your databases and collections. The generated log files are stored in OBS. Auditing logs can enhance your database security and help you analyze the cause of failed operations.