MongoDB Cluster as a Service with Automatic Replication, Load Balancing and Scaling

Allows you to create reliable replica sets for your database in one click.

Enterprise MongoDB Cluster Stack For Your Cloud Application

Dewacloud allows you to create a set of reliable replicas for your MongoDB in one click. An implemented solution provides a set of advantages, including: Repetition and Availability, Scalability and Auto Discovery, Automatic Failover.

Repetition and Availability

Data At a Time Copies of multiple data on different database servers offer a high degree of fault tolerance against data loss.

Scalability and Auto Discovery

New nodes added during the horizontal scaling process will be automatically connected to the cluster along with all necessary adjustments.

Automatic Failover

Database nodes that are temporarily unavailable or have high latencies will automatically be removed from the cluster and will be added back when the connection is restored.

Enable Automatic Clustering for Databases

The entire process of creating a MongoDB auto-cluster can be done in a few clicks.

Open the topology wizard with the New Environment button at the top-left corner of the dashboard, choose MongoDB database, and activate Auto-Clustering via the appropriate switcher.

Tip: Some of the topology specifics of the MongoDB cluster are listed below:

  • Auto-clustering is supported since the 4.x.x version
  • 4 GiB of RAM (32 cloudlets) are recommended for a proper work of the replica set nodes. By default, these number of cloudlets are added as a dynamic scaling limit, so you won’t be charged unless resources are actually consumed.
  • The minimum number of nodes required for the MongoDB auto-cluster is 3

Configure other parameters up to your needs (Public IPs, Region, etc.) and click Create

Wait a minute for the platform to configure the cluster for you.

After successful installation, you’ll receive an email about successful replica set configuration:

You can use these credentials to access the admin panel or to establish connections from your applications to the primary node of the replica set.

Tip: As it is mentioned, any secondary node may become primary in case one fails. Another election will happen if cluster will be restarted and consequently it is quite possible that new primary node will arise.

So, the application connection string becomes invalid. To avoid any of these issues the connection string should contain all of the replica set member hostnames, replica set name and read preferences if necessary to unload the primary node to handle the reads or to ensure cluster high availability and failover.

Here is the connection string example in case of node.js application:

client = new MongoClient(“mongodb://admin:L3tdH8bT64@node254967-mongo-cluster.jelastic.com:27017,node254968-mongo-cluster.jelastic.com:27017,node254969-mongo-cluster.jelastic.com:27017/admin”, {useUnifiedTopology: true, readPreference:’primaryPreferred’,replicaSet:’rs0′});

Where:

  • useUnifiedTopology: true
    Forces mongodb to use the new Server Discover and Monitoring engine

  • readPreference:’primaryPreferred’ – Mostly, operations read from the primary but if it is unavailable, operations read from secondary members.

  • replicaSet:’rs0′ – by default the replica set name is rs0 in Jelastic. You may observe the replica set name at any cluster node in mongod.conf file or in mongo shell prompt.

The outlined above application connection is considered to be established within one hosting platform. But if required, you can make an external application connection to the replica set through SLB. In this case you have to maintain connection to the primary node only for read/writes via Dewacloud Endpoints. 

If you need to read from the secondaries you have to customize your application code to perform reading from secondaries in a separate thread as you do it for primary. Anyway, for such cases, you have to remove replicaSet parameter from the connection string so it can look according to email above:
client = new MongoClient( “mongodb://admin:L3tdH8bT64@node254967-mongo-cluster.jelastic.com:11035/admin”, { useUnifiedTopology: true });

By default, the auto-cluster utilizes the Mongo Express administration panel that provides support for the replica sets.

Also, you can connect to your database via the mongo shell directly in your terminal (for example, using the built-in Web SSH option).

mongo -u {user} -p {password} {DB_name}

Where:

  • {user} – administrator username (sent to your email, admin by default)
  • {password} – password for the corresponding DB user (can be found within the same email)
  • {DB_name} – name of the database you would like to access (we’ll use the default admin one)
     

You can check the replica set status with the appropriate command:
rs.status()

You can check the replica set status with the appropriate command:
rs.status()

Install MongoDB in One Click!

Buyucloud provides MySQL/MariaDB which can be installed quickly and easily. Free for 14 days, after that the cost of hosting the WordPress cloud application is calculated hourly based on resource usage.