MongoDB - Configurer un nœud Analytics (EN)

Configure a dedicated Analytics node in your Public Cloud Databases for MongoDB to support analytics workloads

Last updated 19th September 2022

Objective

This guide shows how to configure a node in your cluster dedicated to analytics-type queries in a Public Cloud Databases for MongoDB cluster. This allows you to run such queries, or BI (Business Intelligence) tools - including MongoDB BI Connector in a way that doesn't degrade the operational performance of the cluster.

Requirements

What purpose does an Analytics node serve?

Let's imagine you're operating a popular recipes website. You might use a MongoDB database to store recipes, some kind of API/backend layer to offer access to that data, and a frontend presentation layer - a website or an app - in order to display those recipes attractively to your end-users.

Now, when an end-user wants to search for and display a recipe, the API/backend layer needs to be able to find and fetch the right document quite quickly, because your end-user is already hungry and we all know a snappy user experience is nicer. And then, since that recipes website is quite popular, you need to be able to serve a large number of end-users at the same time, thus lots of similar queries at the same time. In other words, operational queries often need to meet low latency requirements, tend to be scoped to a small subset of the database as a whole and you might end up running a lot of smaller queries.

On the other hand, as the operator of that popular site, you want to understand the usage patterns as a whole. In order to do that, you might need to query your database in order to gain insights on your system state, e.g. Who are the top users? Where are they located? What time of day is your site most active? Those analytical queries have different requirements than the former set: they tend to access a larger set of the database, they are less latency-critical, and you don't want those to disrupt the end-user experience.

Simply put, an analytics node in your Public Cloud Databases for MongoDB cluster allows you to run those analytical queries while ensuring your operational queries don't suffer, by directing those to a specific node in the cluster.

Instructions

Make your cluster offer an Analytics node

How to create a cluster sporting an Analytics node?

Using the API, you can create a new cluster with:

Using the nodeList parameter, you can define the nodes for the cluster. The role attribute can take the value STANDARD or ANALYTICS depending on the role you want for the given node.

How to add an Analytics node to an existing cluster?

In case you already have an existing cluster, you can add a new node using the API endpoint:

Specifying the role attribute, STANDARD or ANALYTICS, allows to request the role you want for the given node.

How to turn a non-Analytics node into an Analytics node?

You can change the role of a given node using:

Once again the role attribute (STANDARD / ANALYTICS) allows to make a node fulfill the requested role.

Direct analytical queries towards the Analytics node

The cluster can now be reached through two different connection strings:

  • Use mongodb+srv://<username>:<password>@<cluster hostname>/admin?replicaSet=replicaset&tls=true for the operational connections, e.g. in the application configuration.
  • Use mongodb+srv://<username>:<password>@<cluster hostname>/admin?replicaSet=replicaset&tls=true&readPreference=secondary&readPreferenceTags=nodeType:ANALYTICS for the analytics workload, e.g. in your BI tools.

Notice the extra query parameters readPreference=secondary and readPreferenceTags=nodeType:ANALYTICS: they direct the queries towards the Analytics node we configured.

Constraints & limitations

  • No matter what, your cluster needs at least 3 non-Analytics nodes. That means the smallest cluster with an Analytics node is a 4-node cluster.
  • A cluster can have at most one Analytics node.
  • If one of the first three nodes of a cluster is an Analytics node, then you won't be able to scale down the cluster from 4 nodes to 3 nodes with the following API call, using the nodeNumber parameter:

You can either use the delete node endpoint to remove the Analytics node, or turn that Analytics node into a standard one before scaling down the cluster.

Go further

MongoDB capabilities

Join our community of users on https://community.ovh.com/en/.

We want your feedback!

We would love to help answer questions and appreciate any feedback you may have. Are you on Discord? Connect to our channel at https://discord.gg/PwPqWUpN8G and interact directly with the team that builds our databases service!


Cette documentation vous a-t-elle été utile ?

N’hésitez pas à nous proposer des suggestions d’amélioration afin de faire évoluer cette documentation.

Images, contenu, structure… N’hésitez pas à nous dire pourquoi afin de la faire évoluer ensemble !

Vos demandes d’assistance ne seront pas traitées par ce formulaire. Pour cela, utilisez le formulaire "Créer un ticket" .

Merci beaucoup pour votre aide ! Vos retours seront étudiés au plus vite par nos équipes..


Ces guides pourraient également vous intéresser...

OVHcloud Community

Accedez à votre espace communautaire. Posez des questions, recherchez des informations, publiez du contenu et interagissez avec d’autres membres d'OVHcloud Community.

Echanger sur OVHcloud Community

Conformément à la Directive 2006/112/CE modifiée, à partir du 01/01/2015, les prix TTC sont susceptibles de varier selon le pays de résidence du client
(par défaut les prix TTC affichés incluent la TVA française en vigueur).