- What's New
- Function Overview
-
Product Bulletin
- Vulnerability Notice
-
Product Notices
- [Notice] Starting OBT for DDS Cluster 5.0 on Nov 5, 2024
- [Notice] Huawei Cloud DDS Replica Set 5.0 Will Be Released Commercially on Oct 11, 2024
- [Notice] Huawei Cloud DDS 3.4 Will Be Discontinued on Oct 11, 2024
- [Notice] Starting OBT for DDS 5.0 on July 24, 2024
- [Notice] Specifications with CPU-Memory Ratio of 1:8 Will Be Available for x86-Powered Enhanced II Replica Set Instances and Cluster Shards on February 15, 2023
- [Notice] DDS 4.4 OBT Invitation
- [Product Discontinuation Notice] Huawei Cloud Document Database Service (DDS) Single Node Instances Will Be Discontinued on July 15, 2023
- [Notice] Huawei Cloud DDS 4.4 Will Be Released Commercially on Oct 08, 2023
- Version Description
- Product Release Notes
-
Service Overview
- Infographics
- What Is DDS?
- Advantages
- Comparison Between DDS and On-Premises Databases
- Typical Application Scenarios
- Functions and Features
- System Architecture
- Instances
- Notes and Constraints
- Basic Concepts
- Compatibility
- Security
- Permissions
- Related Services
- Mapping Between DDS Versions and Community Versions
- Billing
- Getting Started
-
User Guide
- Buying an Instance
-
Connecting to a DB Instance
- Connecting to a Cluster Instance
- Connecting to a Replica Set Instance
- Connecting to a Single Node Instance
- Data Migration
- Performance Tuning
- Permissions Management
- Instance Lifecycle Management
-
Instance Modifications
- Changing an Instance Name
- Changing an Instance Description
- Modifying an Instance Tag
- Changing the Name of the Replica Set in the Connection Address
- Upgrading a Minor Engine Version
- Upgrading a Major Engine Version
- Scaling Up Storage Space
- Changing an Instance Class
- Changing Cluster Instance Nodes
- Changing Replica Set Instance Nodes
- Configuring the Maintenance Window
- Changing an AZ
- Updating the OS of a DB Instance
-
Data Backups
- Backup Principles and Solutions
- Configuring an Automated Backup Policy
- Configuring an Incremental Backup Policy
- Configuring the Cross-Region Backup Policy
- Setting Backup Method for a DB Instance
- Creating a Manual Backup
- Deleting a Manual Backup
- Deleting an Automated Backup
- Stopping a Backup
- Downloading a Backup File
-
Data Restorations
- Solutions
- Restoring Data to a New Instance
- Restoring Data to the Original Instance
- Restoring Data to a Point in Time
- Restoring Data to an On-Premises Database
- Restoring Data of Enhanced Edition
-
Parameter Template Management
- Overview
- Creating a Parameter Template
- Modifying DDS DB Instance Parameters
- 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
- DBA Assistant
- SQL Execution Control
- Cross-AZ Disaster Recovery
- Tags
- Quotas
- DDS Usage Suggestions
- Developer Guide
-
Best Practices
- Overview
- Security Best Practices
- Common Methods for Connecting to a DDS Instance
- From Other Cloud MongoDB to DDS
- From On-Premises MongoDB to DDS
- From ECS-hosted MongoDB to DDS
- 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 dds mongos Cache Problem?
- How Do I Solve the High CPU Usage Issue?
- How Do I Troubleshoot High Memory Usage of DDS DB Instances?
- What Can I Do If the Number of Connections of an Instance Reaches Its Maximum?
- Creating a User and Granting the Read-Only Permission to the User
- Proper Use of Data Definition Languages (DDL) Statements
- How Is a DDS Node Going to Be Disconnected and What Can I Do?
- 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
- Setting the Recycle Bin Policy
- Adding Nodes to a Replica Set Instance
- Adding a Read Replica to an Instance
- Upgrading the Database Patch
- Enabling or Disabling Monitoring by Seconds
- Querying Second-Level Monitoring Configurations
- Configuring the Maintenance Window
- Querying the Recycling Policy of a DB Instance
- Querying DB Instances in the Recycle Bin
- Checking for Weak Passwords
- Querying the Estimated Database Patch Upgrade Duration
- Querying Instance Disk Information
- Obtaining the SSL Certificate Download Address
- Querying the Name of the Replica Set in the Connection Address
- Changing the Name of the Replica Set in the Connection Address
- Deleting Instance Nodes
- Deleting a Read Replica of an Instance
- Querying Access Across CIDR Blocks for a Replica Set Instance
- Querying LTS Log Configurations
- Associating an Instance with an LTS Log Stream
- Disassociating an Instance from an LTS Log Stream
- Configuring an Autoscaling Policy for Storage Space
- Querying the Autoscaling Policy of Storage Space
- Upgrading the Minor Versions of DB Instances in Batches
- 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
- Stopping a Backup
- Deleting Manual Backups in Batches
-
Parameter Configuration
- Obtaining Parameter Templates
- Creating a Parameter Template
- Deleting a Parameter Template
- Obtaining Details About a Parameter Template
- Modifying a Parameter Template
- Applying a Parameter Template
- Obtaining Parameters of a Specified DB Instance
- Modifying Parameters of a Specified DB Instance
- Querying Available DB Instances
- Viewing Application Records of a Parameter Template
- Viewing Parameter Change History
- Comparing Parameter Templates
- Replicating a Parameter Template
- Resetting a Parameter Template
- Checking Whether a Parameter Template Name Is Unique
- Viewing Parameter Change History of an Instance
-
Log Information Queries
- Querying Database Slow Logs (New)
- Obtaining Links for Downloading Slow Query Logs
- Showing Original Slow Logs
- Querying Database Error Logs (New)
- Obtaining Links for Downloading Error Logs
- Configuring SQL Audit
- Querying SQL Audit Policy
- Obtaining the Audit Log List
- Obtaining Links for Downloading Audit Logs
- Querying the Switch of Show Original Log
- Deleting Audit Logs
- 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
- Querying Databases
- Quota Management
- Database O&M
- Task Management
- API V3 (Unavailable Soon)
- Examples
- Permissions Policies and Supported Actions
- Appendix
- SDK Reference
-
FAQs
-
Product Consulting
- What Is the Relationship Between DDS and MongoDB Community Edition?
- Q&A About Switching Storage Engine to RocksDB for DDS 4.2 and Later Versions
- What Are the Differences Between DDS and GeminiDB 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 Freezing, Release, Deletion, and Unsubscription
-
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
-
Product Consulting
-
Troubleshooting
- Overview
- 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
- Videos
- Glossary
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Introduction
- Logging In to the DDS Console
- Getting Started with Clusters
- Getting Started with Replica Sets
- Connection Management
- Migrating Data
- Account Management
-
Instance Management
- Changing a DB Instance Name
- Adding Cluster Instance Nodes
- Reverting Cluster Instance Nodes
- Scaling Up Storage Space
- Changing the CPU or Memory of a Cluster DB Instance
- Changing the CPU or Memory of a Replica Set DB Instance
- Manually Switching the Primary and Secondary Nodes of a Replica Set
- Exporting DB Instance Information
- Restarting a DB Instance or a Node
- Deleting a DB Instance
- Recycling a DB Instance
- Backup and Restore
- Parameter Group Settings
- Task Center
- Monitoring and Alarm Reporting
- Auditing
- Log Management
- Tag
-
FAQs
- Product Consulting
- Database Performance
- Creation and Deletion
-
Database Connection
- Can an External Server Access the DDS DB Instance?
- What Is the Number of DDS Database Connections?
- What Should I Do If an ECS Cannot Connect to a DDS DB Instance?
- What Should I Do If a Database Client Problem Causes a Connection Failure?
- What Should I Do If a DDS Server Problem Causes a Connection Failure?
- How Can My Applications Access a DDS DB Instance in a VPC?
- Do Applications Need to Support Automatic Reconnecting to the DDS Database?
- How Do I Create and Log In to an ECS?
- How Can I Install a MongoDB Client?
- How Do I Install Robo 3T?
- Database Usage
- Database Storage
- Database Parameter Modification
- Backup and Restoration
- Network Security
- Resource Monitoring
- Log Management
- Which Commands are Supported or Restricted by DDS?
- Change History
-
API Reference (ME-Abu Dhabi Region)
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
API Description
- Querying the API Version
- Querying Database Version Information
- Querying All DB Instance Specifications
-
DB Instance Management
- Creating a DB Instance
- Restarting a DB Instance
- Deleting a DB Instance
- Querying DB Instances
- 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 a Database Port
- Changing a Security Group
- Binding an EIP
- Unbinding an EIP
- Changing a Private IP Address
- Backup and Restoration
- Tag Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
-
User Guide (Paris Region)
- Introduction
- Logging In to the DDS Console
- Getting Started with Clusters
- Getting Started with Replica Sets
- Connection Management
- Migrating Data
- Account Management
-
Instance Management
- Changing a DB Instance Name
- Adding Cluster Instance Nodes
- Reverting Cluster Instance Nodes
- Scaling Up Storage Space
- Changing the CPU or Memory of a Cluster DB Instance
- Changing the CPU or Memory of a Replica Set DB Instance
- Manually Switching the Primary and Secondary Nodes of a Replica Set
- Exporting DB Instance Information
- Restarting a DB Instance or a Node
- Deleting a DB Instance
- Backup and Restore
- Parameter Group Settings
- Task Center
- Monitoring and Alarm Reporting
- Auditing
- Log Management
- Tag
-
FAQs
- Product Consulting
- Database Performance
- Creation and Deletion
-
Database Connection
- Can an External Server Access the DDS DB Instance?
- What Is the Number of DDS Database Connections?
- What Should I Do If an ECS Cannot Connect to a DDS DB Instance?
- What Should I Do If a Database Client Problem Causes a Connection Failure?
- What Should I Do If a DDS Server Problem Causes a Connection Failure?
- How Can My Applications Access a DDS DB Instance in a VPC?
- Do Applications Need to Support Automatic Reconnecting to the DDS Database?
- How Do I Create and Log In to an ECS?
- How Can I Install a MongoDB Client?
- How Do I Install Robo 3T?
- Database Usage
- Database Storage
- Database Parameter Modification
- Backup and Restoration
- Network Security
- Log Management
- Which Commands are Supported or Restricted by DDS?
- Change History
-
API Reference (Paris Region)
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
API Description
- Querying the API Version
- Querying Database Version Information
- Querying All DB Instance Specifications
-
DB Instance Management
- Creating a DB Instance
- Restarting a DB Instance
- Deleting a DB Instance
- Querying DB Instances
- 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 a Database Port
- Changing a Security Group
- Binding an EIP
- Unbinding an EIP
- Changing a Private IP Address
- Backup and Restoration
- Appendix
- Change History
-
User Guide (Kuala Lumpur Region)
- Introduction
- Logging In to the DDS Console
- Getting Started with Clusters
- Getting Started with Replica Sets
- Connection Management
- Migrating Data
- Account Management
-
Instance Management
- Changing a DB Instance Name
- Adding Cluster Instance Nodes
- Reverting Cluster Instance Nodes
- Scaling Up Storage Space
- Changing the CPU or Memory of a Cluster DB Instance
- Changing the CPU or Memory of a Replica Set DB Instance
- Manually Switching the Primary and Secondary Nodes of a Replica Set
- Exporting DB Instance Information
- Restarting a DB Instance or a Node
- Deleting a DB Instance
- Recycling a DB Instance
- Backup and Restore
- Parameter Group Settings
- Task Center
- Monitoring and Alarm Reporting
- Auditing
- Log Management
- Tag
-
FAQs
- Product Consulting
- Database Performance
- Creation and Deletion
-
Database Connection
- Can an External Server Access the DDS DB Instance?
- What Is the Number of DDS Database Connections?
- What Should I Do If an ECS Cannot Connect to a DDS DB Instance?
- What Should I Do If a Database Client Problem Causes a Connection Failure?
- What Should I Do If a DDS Server Problem Causes a Connection Failure?
- How Can My Applications Access a DDS DB Instance in a VPC?
- Do Applications Need to Support Automatic Reconnecting to the DDS Database?
- How Do I Create and Log In to an ECS?
- How Can I Install a MongoDB Client?
- How Do I Install Robo 3T?
- Database Usage
- Database Storage
- Database Parameter Modification
- Backup and Restoration
- Network Security
- Resource Monitoring
- Log Management
- Which Commands are Supported or Restricted by DDS?
- Change History
-
API Reference (Kuala Lumpur Region)
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
API Description
- Querying the API Version
- Querying Database Version Information
- Querying All DB Instance Specifications
-
DB Instance Management
- Creating a DB Instance
- Restarting a DB Instance
- Deleting a DB Instance
- Querying DB Instances
- 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
- Changing the Administrator Password
- Modifying a DB Instance Name
- Changing a Database Port
- Changing a Security Group
- Binding an EIP
- Unbinding an EIP
- Changing a Private IP Address
- Backup and Restoration
- Tag Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Copied.
Sharding
You can shard a large-size collection for a sharded cluster instance. Sharding distributes data across different machines to make full use of the storage space and compute capability of each shard.
Number of Shards
The following is an example using database mytable, collection mycoll, and the field name as the shard key.
- Log in to a sharded cluster instance using Mongo Shell.
- Check whether a collection has been sharded.
use <database> db.<collection>.getShardDistribution()
Example:
use mytable db.mycoll.getShardDistribution()
- Enable sharding for the databases that belong to the cluster instance.
- Method 1
sh.enableSharding("<database>")
Example:
sh.enableSharding("mytable")
- Method 2
use admin db.runCommand({enablesharding:"<database>"})
- Method 1
- Shard a collection.
- Method 1
sh.shardCollection("<database>.<collection>",{"<keyname>":<value> })
Example:
sh.shardCollection("mytable.mycoll",{"name":"hashed"},false,{numInitialChunks:5})
- Method 2
use admin db.runCommand({shardcollection:"<database>.<collection>",key:{"keyname":<value> }})
Table 1 Parameter description Parameter
Description
<database>
Database name
<collection>
Collection name.
<keyname>
Shard key.
Cluster instances are sharded based on the value of this parameter. Select a proper shard key for the collection based on your service requirements. For details, see Selecting a Shard Key.
<value>
The sort order based on the range of the shard key.- 1: Ascending indexes
- -1: Descending indexes
- hashed: indicates that hash sharding is used. Hashed sharding provides more even data distribution across the sharded cluster.
For details, see sh.shardCollection().
numInitialChunks
Optional. The minimum number of shards initially created is specified when an empty collection is sharded using a hashed shard key.
- Method 1
- Check the data storage status of the database on each shard.
sh.status()
Example:
Selecting a Shard Key
- Background
Each sharded cluster contains collections as its basic unit. Data in the collection is partitioned by the shard key. Shard key is a field in the collection. It distributes data evenly across shards. If you do not select a proper shard key, the cluster performance may deteriorate, and the sharding statement execution process may be blocked.
Once the shard key is determined it cannot be changed. If no shard key is suitable for sharding, you need to use a sharding policy and migrate data to a new collection for sharding.
- Characteristics of proper shard keys
- All inserts, updates, and deletes are evenly distributed to all shards in a cluster.
- The distribution of keys is sufficient.
- Rare scatter-gather queries.
If the selected shard key does not have all the preceding features, the read and write scalability of the cluster is affected. For example, If the workload of the find() operation is unevenly distributed in the shards, hot shards will be generated. Similarly, if your write load (inserts, updates, and deletes) is not uniformly distributed across your shards, then you could end up with a hot shard. Therefore, you need to adjust the shard keys based on service requirements, such as read/write status, frequently queried data, and written data.
After existing data is sharded, if the filter filed of the update request does not contain shard keys and upsert:true or multi:false, the update request will report an error and return message "An upsert on a sharded collection must contain the shard key and have the simple collation.".
- Judgment criteria
You can use the dimensions provided in Table 2 to determine whether the selected shard keys meet your service requirements:
Table 2 Reasonable shard keys Identification Criteria
Description
Cardinality
Cardinality refers to the capability of dividing chunks. For example, if you need to record the student information of a school and use the age as a shard key, data of students of the same age will be stored in only one data segment, which may affect the performance and manageability of your clusters. A much better shard key would be the student number because it is unique. If the student number is used as a shard key, the relatively large cardinality can ensure the even distribution of data.
Write distribution
If a large number of write operations are performed in the same period of time, you want your write load to be evenly distributed over the shards in the cluster. If the data distribution policy is ranged sharding, a monotonically increasing shard key will guarantee that all inserts go into a single shard.
Read distribution
Similarly, if a large number of read operations are performed in the same period, you want your read load to be evenly distributed over the shards in a cluster to fully utilize the computing performance of each shard.
Targeted read
The dds mongos query router can perform either a targeted query (query only one shard) or a scatter/gather query (query all of the shards). The only way for the dds mongos to be able to target a single shard is to have the shard key present in the query. Therefore, you need to pick a shard key that will be available for use in the common queries while the application is running. If you pick a synthetic shard key, and your application cannot use it during typical queries, all of your queries will become scatter/gather, thus limiting your ability to scale read load.
Choosing a Distribution Policy
A sharded cluster can store a collection's data on multiple shards. You can distribute data based on the shard keys of documents in the collection.
There are two data distribution policies: ranged sharding and hashed sharding. For details, see 4.
The following describes the advantages and disadvantages of the two methods.
- Ranged sharding
Ranged-based sharding involves dividing data into contiguous ranges determined by the shard key values. If you assume that a shard key is a line stretched out from positive infinity and negative infinity, each value of the shard key is the mark on the line. You can also assume small and separate segments of a line and that each chunk contains data of a shard key within a certain range.
Figure 1 Distribution of dataAs shown in the preceding figure, field x indicates the shard key of ranged sharding. The value range is [minKey,maxKey] and the value is an integer. The value range can be divided into multiple chunks, and each chunk (usually 64 MB) contains a small segment of data. For example, chunk 1 contains all documents in range [minKey, -75] and all data of each chunk is stored on the same shard. That means each shard containing multiple chunks. In addition, the data of each shard is stored on the config server and is evenly distributed by dds mongos based on the workload of each shard.
Ranged sharding can easily meet the requirements of query in a certain range. For example, if you need to query documents whose shard key is in range [-60,20], dds mongos only needs to forward the request to chunk 2.
However, if shard keys are in ascending or descending order, newly inserted documents are likely to be distributed to the same chunk, affecting the expansion of write capability. For example, if _id is used as a shard key, the high bits of _id automatically generated in the cluster are ascending.
- Hashed sharding
Hashed sharding computes the hash value (64-bit integer) of a single field as the index value; this value is used as your shard key to partition data across your shared cluster. Hashed sharding provides more even data distribution across the sharded cluster because documents with similar shard keys may not be stored in the same chunk.
Figure 2 Distribution of dataHashed sharding randomly distributes documents to each chunk, which fully expands the write capability and makes up for the deficiency of ranged sharding. However, queries in a certain range need to be distributed to all backend shards to obtain documents that meet conditions, resulting in low query efficiency.
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