---
title: MongoDB Replicaset
slug: homologacao-atmosphere/mongodb-replicaset
description: Learn how to initialize a MongoDB replica set in a new deployment with this comprehensive document. Discover the essential parameters and advanced configuration options for replica set members, including validating the replica set name and setting timeout
createdAt: 2021-09-24T19:45:59.000Z
---

## Resumo

- Inicialize um conjunto de réplicas do MongoDB em uma nova implantação.
- Valida o nome do replicaset para implantações existentes.
- É possível a configuração avançada de membros do replicaset (consulte os exemplos).

## Parâmetros

| Parâmetro                                                                                                                                                            | Tipo    | Escolhas \| Valores padrão                       | Comentários                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| arbiter\_at\_index [](https://docs.ansible.com/ansible/latest/collections/community/mongodb/mongodb_replicaset_module.html#parameter-arbiter_at_index)               | integer |                                                  | Identifies the position of the member in the array that is an arbiter.                                                                                                                                                                                                                                                                                 |
| chaining\_allowed [](https://docs.ansible.com/ansible/latest/collections/community/mongodb/mongodb_replicaset_module.html#parameter-chaining_allowed)                | boolean | Escolhas: <br />- no<br />- yes (padrão)         | When *settings.chaining\_allowed=true*, the replicaset allows secondary members to replicate from other secondary members.When *settings.chaining\_allowed=false*, secondaries can replicate only from the primary.                                                                                                                                    |
| election\_timeout\_millis [](https://docs.ansible.com/ansible/latest/collections/community/mongodb/mongodb_replicaset_module.html#parameter-election_timeout_millis) | integer | Padrão:<br />10000                               | The time limit in milliseconds for detecting when a replicaset's primary is unreachable.                                                                                                                                                                                                                                                               |
| heartbeat\_timeout\_secs [](https://docs.ansible.com/ansible/latest/collections/community/mongodb/mongodb_replicaset_module.html#parameter-heartbeat_timeout_secs)   | integer | Padrão:<br />10                                  | Number of seconds that the replicaset members wait for a successful heartbeat from each other.If a member does not respond in time, other members mark the delinquent member as inaccessible.The setting only applies when using *protocol\_version=0*. When using *protocol\_version=1* the relevant setting is *settings.election\_timeout\_millis*. |
| members                                                                                                                                                              | list    |                                                  | Yaml list consisting of the replicaset members.Csv string will also be accepted i.e. mongodb1:27017,mongodb2:27017,mongodb3:27017.A dictionary can also be used to specify advanced replicaset member options.If a port number is not provided then 27017 is assumed.                                                                                  |
| protocol\_version                                                                                                                                                    | integer | Escolhas: <br />- 0<br />- 1<br />Padrão:<br />1 | Version of the replicaset election protocol.                                                                                                                                                                                                                                                                                                           |
| replica\_set                                                                                                                                                         | string  | Padrão:<br />"rs0"                               | Replicaset name.                                                                                                                                                                                                                                                                                                                                       |
| validate                                                                                                                                                             | boolean | Escolhas: <br />- no<br />- yes (padrão)         | Performs some basic validation on the provided replicaset config.                                                                                                                                                                                                                                                                                      |

