Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.
- What's New
- Function Overview
- Service Overview
-
Getting Started
- Overview
- Getting Started with Clusters
- Getting Started with Replica Sets
- Getting Started with Single Nodes
- Logging In to the DDS Console
- Example: Buying and Connecting to a DDS Instance
- Change History (Getting Started) Europe Site
-
User Guide
- Migrating Data
- Performance Tuning
- Permissions Management
- Instance Lifecycle Management
- Instance Modifications
- Data Backups
- Data Restorations
-
Parameter Template Management
- Overview
- Creating a Parameter Template
- Modifying a Parameter Template
- Viewing Parameter Change History
- Exporting a Parameter Template
- Comparing Parameter Templates
- Replicating a Parameter Template
- Resetting a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Connection Management
- Database Usage
- Data Security
- Monitoring and Alarm Reporting
- Auditing
- Logs
- Task Center
- Billing
- Tags
- Quotas
- DDS Usage Suggestions
- Change History
- Developer Guide
-
Best Practices
- Overview
- Common Methods for Connecting to a DDS Instance
- How Do Replica Sets Achieve High Availability and Read/Write Splitting?
- Sharding
- How Do I Improve DDS Performance by Optimizing SQL Statements?
- How Do I Prevent the Mongos Cache Problem?
- How Do I Solve the High CPU Usage Issue?
- Creating a User and Granting the Read-Only Permission to the User
- Security White Paper
- Performance White Paper
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
APIs V3.0 (Recommended)
- Querying the API Version
- Querying Database Version Information
- Querying Database Specifications
- Querying the Database Disk Type
-
DB Instance Management
- Creating a DB Instance
- Restarting a DB Instance
- Deleting a DB Instance
- Querying Instances and Details
- Scaling Up Storage Space
- Adding Nodes for a Cluster Instance
- Modifying DB Instance Specifications
- Performing a Primary/Secondary Switchover in a Replica Set Instance
- Enabling or Disabling SSL
- Modifying a DB Instance Name
- Changing an Instance Description
- Changing a Database Port
- Changing a Security Group
- Binding an EIP
- Unbinding an EIP
- Changing a Private IP Address
- Creating Shard or Config IP Addresses of a Cluster Instance
- Configuring Cross-CIDR Access for a Replica Set
- Querying AZs to Which an Instance Can Be Migrated
- Migrating a DB Instance to Another AZ
- Adding Nodes to a Replica Set Instance
- Adding a Read Replica to an Instance
- Connection Management
-
Backup and Restoration
- Creating a Manual Backup
- Deleting a Manual Backup
- Querying the Backup List
- Querying an Automated Backup Policy
- Setting an Automated Backup Policy
- Restoring Data to a New DB Instance
- Obtaining the Link for Downloading a Backup File
- Querying the Restoration Time Ranges
- Obtaining the List of Databases That Can Be Restored
- Obtaining the List of Database Collections That Can Be Restored
- Restoring Data to the Original DB Instance
- Restoring Databases and Tables to a Point in Time
- Parameter Configuration
- Log Information Queries
- Tag Management
-
Managing Databases and Users
- Creating a Database User
- Creating a Database Role
- Querying Details About Database Users
- Querying the Database Role List
- Changing the Password of a Database User
- Checking the Password for Logging In to a Database
- Querying Cluster Balancing Settings
- Enabling or Disabling Cluster Balancing
- Setting the Activity Time Window for Cluster Balancing
- Deleting a Database User
- Deleting a Database Role
- Quota Management
- Task Management
- API V3 (Unavailable Soon)
- Examples
- Permissions Policies and Supported Actions
- Appendix
- Change History (European Sites)
- SDK Reference
-
FAQs
-
Product Consulting
- What Is the Relationship Between DDS and MongoDB Community Edition?
- What Are the Differences Between DDS and GaussDB(for Mongo)?
- What Precautions Should Be Taken When Using DDS?
- What Is the Availability of DDS DB Instances?
- Will My DDS DB Instances Be Affected by Other Users' DDS DB Instances?
- Does DDS Support Multi-AZ Deployment?
- Can I Change the VPC for a Created Instance?
- Can I Change the Region for a Created Instance?
- What Is Hidden Node?
- Database Versions
-
Resource and Disk Management
- Which Items Occupy the Storage Space of DDS Instances?
- Which Types of Logs and Files Occupy DDS DB Instance Storage Space?
- Why Is the Storage Space Usage Displayed on the GUI Smaller Than the Actual Usage?
- Why Does Available Disk Space Not Increase After Data Is Deleted?
- Why Is the Resident Memory of a 4 vCPUs/8 GB Memory Replica Set Instance Only 4 GB?
- Capacity Expansion and Specification Changes
-
Database Performance
- When Will a Primary/Standby Switchover Be Triggered for a Cluster or Replica Set?
- High Storage Usage
- What Is the Time Delay for Primary/Secondary Synchronization in a Replica Set?
- How Is Data Transferred Between the Primary and Secondary Nodes of a Replica Set?
- How Do I Clear an Alarm Saying the Shard Memory Usage Exceeds 90%?
- What Can I Do If a Query Error Is Reported After Data Is Written Into the DDS Cluster?
- Database Permissions
-
Creation and Deletion
- How Do I Select Instance Specifications and Nodes?
- Why Is an Instance Not Displayed on the Console After It Is Created?
- Can I Use a Template to Create DDS DB Instances?
- Why Is Data Missing from My Database?
- Will My Backups Be Deleted If I Delete My Cloud Account?
- What Are the Differences Between Instance Deletion and Unsubscription?
-
Database Connection
- What Should I Do If I Fail to Connect to a DDS Instance?
- What Can I Do If the Number of Connections of an Instance Reaches Its Maximum?
- How Do I Query and Limit the Number of Connections?
- What Should I Do If the ECS and DDS Are Deployed in Different VPCs and They Cannot Communicate with Each Other?
- Do Applications Need to Support Automatic Reconnecting to the DDS Database?
- How Do I Create and Log In to an ECS?
- Installing a Client
- Database Usage
- Database Migration
- Database Storage
- Database Parameters
- Backup and Restoration
- Network Security
- Monitoring and Alarm
- Change History (FAQs) Europe Site
-
Product Consulting
-
Troubleshooting
- DDS Instance Node Fault Handling Mechanism
- Connection Failure Message: network error while attempting to run command 'isMaster'
- Connection Failure Messages: No route to host and connection attempt failed
- Connection Failure Message: Authentication failed
- Connection Failure Message: couldn't connect to server
- Connection Failure Message: cannot list multiple servers in URL without 'replicaSet' option
- Connection Failure Message: Timeout while receiving message
- Connection Failure Message: exception: login failed and U_STRINGPREP_PROHIBITED_ERROR
- Change History (Troubleshooting) European Sites
- Videos
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 section 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.
Precautions
- The mongoexport and mongoimport tools support only full migration. To ensure data consistency, stop services on the source database and stop writing data to the source database before the migration.
- You are advised to perform the migration during off-peak hours to avoid impacting services.
- The admin and local system databases cannot be migrated.
- Make sure that no service set has been created in the system databases admin and local in the source database. If there is already a service set, migrate them out of the system databases admin and local before migration.
- Before importing data, ensure that the necessary indexes are there on the source database. Delete any unnecessary indexes and create any necessary indexes before migration.
- If you choose to migrate a sharded cluster, you must create a set of shards in the destination database and configure sharding. In addition, indexes must be created before migration.
Prerequisites
- An ECS or a device that can access DDS is ready for use.
- To bind an EIP to a DB instance:
- Bind an EIP to a node in the instance. For details about how to bind an EIP to a node, see "Binding an EIP" in Getting Started with Document Database Service.
- Ensure that your local device can access the EIP that has been bound to the DB instance.
- To bind an EIP to a DB instance:
- A migration tool has been installed on the prepared ECS.
For details on how to install the migration tool, see How Can I Install a MongoDB Client?
NOTE:
The MongoDB client provides the mongoexport and mongoimport tools.
Exporting Data
- Log in to the ECS or the device that can access DDS.
- Use the mongoexport tool to transfer data from the source database to a .json file.
The SSL connection is used as an example. If you select a common connection, delete --ssl --sslAllowInvalidCertificates from the following command.
./mongoexport --host <DB_ADDRESS> --port <DB_PORT> --ssl --sslAllowInvalidCertificates --type json --authenticationDatabase <AUTH_DB> -u <DB_USER> --db <DB_NAME> --collection <DB_COLLECTION> --out <DB_PATH>
- DB_ADDRESS is the database address.
- DB_PORT is the database port.
- AUTH_DB is the database for storing DB_USER information. Generally, this value is admin.
- DB_USER is the database user.
- DB_NAME is the name of the database from which data will be exported.
- DB_COLLECTION is the collection of the database from which data will be exported.
- DB_PATH is the path where the .json file is located.
Enter the database administrator password when prompted:
Enter password:
The following is an example. After the command is executed, the exportfile.json file will be generated:
./mongoexport --host 192.168.1.21 --port 8635 --ssl --sslAllowInvalidCertificates --type json --authenticationDatabase admin -u rwuser --db test02 --collection Test --out /tmp/mongodb/export/exportfile.json
- View the results
If information similar to the following is displayed, the data has been successfully exported. x is the number of exported data records.
exported x records
- Compress the exported .json file.
gzip exportfile.json
Compressing the file helps reduce the time needed to transmit the data. The compressed file is exportfile.json.gz.
Importing Data
- Log in to the ECS or whichever device you will be using to access DDS.
- Upload the data to be imported to the ECS or the device.
Select an uploading method based on the OS you are using.
- In Linux, for example, you can use secure copy protocol (SCP):
scp <IDENTITY_FILE> <REMOTE_USER>@<REMOTE_ADDRESS>:<REMOTE_DIR>
- IDENTITY_FILE is the directory where the exportfile.json.gz file is located. The file access permission is 600.
- REMOTE_USER is the ECS OS user.
- REMOTE_ADDRESS is the ECS address.
- REMOTE_DIR is the directory of the ECS to which the exportfile.json.gz file is uploaded.
- In Windows, upload exportfile.json.gz to the ECS using file transfer tools.
- In Linux, for example, you can use secure copy protocol (SCP):
- Decompress the package.
gzip -d exportfile.json.gz
- Import the JSON file to the DDS database.
The SSL connection is used as an example. If you select a common connection, delete --ssl --sslAllowInvalidCertificates from the following command.
./mongoimport --host <DB_ADDRESS> --port <DB_PORT> --ssl --sslAllowInvalidCertificates --type json --authenticationDatabase <AUTH_DB> -u <DB_USER> --db <DB_NAME> --collection <DB_COLLECTION> --file <DB_PATH>
- DB_ADDRESS indicates the DB instance IP address.
- DB_PORT indicates the database port.
- AUTH_DB indicates the database that authenticates DB_USER. Generally, this value is admin.
- DB_USER indicates the account name of the database administrator.
- DB_NAME indicates the name of the database to which data will be imported.
- DB_COLLECTION indicates the collection of the database to which data will be imported.
- DB_PATH indicates the path where the .json file is located.
Enter the database administrator password when prompted:
Enter password:
The following is an example:
./mongoimport --host 192.168.1.21 --port 8635 --ssl --sslAllowInvalidCertificates --type json --authenticationDatabase admin -u rwuser --db test02 --collection Test --file /tmp/mongodb/export/exportfile.json
- View the results.
If information similar to the following is displayed, the data has been successfully imported. x is the number of imported data records.
imported x records
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.