Create a Sharded Database Cluster
This section shows you how to create a MongoDB sharded cluster using the IONOS API. This feature is available only for enterprise clusters.
For information about prerequisites to retrieve the data center UUID, query database status, connect to the cluster, and prepare the network, see Create a Cluster.
Create the cluster
This request creates a MongoDB version 6.0 sharded database cluster of two shards with three replicas each. The size of each node is specified in the request.
Note: The use of shards
in the request identifies the number of shards, while type
defines the cluster as a sharded cluster.
Note: Only contract administrators and owners can create and change database clusters. In contrast, the running database cluster can be accessed from all servers in the specified LAN.
Resource consumption
In total, six database nodes are created, and consequently, the number of billed resources is 24 cores, 12 GB memory, and 120 GB storage.
Note: In addition, a set of three config servers is created with two cores, 4 GB memory, and 40 GB storage each. These are excluded from the billed resources.
Request
Response
Note: We will use 498ae72f-411f-11eb-9d07-046c59cc737e as example for the cluster ID in following examples.
At this point, you have created your first MongoDB sharded cluster. The deployment of the database takes several minutes. For more information about determining if your cluster is ready, see Querying database status.
When the cluster is ready, add the role enableSharding
to a user in order to allow shard management capabilities. For managing user roles, see Changing the roles. Only users with enableSharding
role can shard a collection. For more information, see shardCollection.
Last updated