Para agentes de IA: hay un índice de documentación disponible en https://www.mongodb.com/es/docs/llms.txt — versiones en markdown de todas las páginas están disponibles agregando .md a cualquier ruta URL.
Docs Menu

rs.remove() (método mongosh)

rs.remove(hostname)

Elimina el nodo descrito por el parámetro hostname del actual set de réplicas. Esta función desconectará el shell brevemente y forzará una reconexión mientras el set de réplicas vuelve a negociar qué nodo será primario. Como resultado, la shell mostrará un error incluso si este comando se ejecuta correctamente.

The rs.remove() method has the following parameter:

Parameter
Tipo
Descripción

hostname

string

El nombre de host de un sistema en el set de réplicas.

Nota

Before running the rs.remove() operation, it is good practice to shut down the replica set member that you are removing.

Este método está disponible en implementaciones alojadas en los siguientes entornos:

  • MongoDB Enterprise: La versión basada en suscripción y autogestionada de MongoDB

  • MongoDB Community: La versión de MongoDB con código fuente disponible, de uso gratuito y autogestionada.

Removing a member changes the number of voting members in the replica set, which can change the implicit default write concern.

You must explicitly set the global default write concern before attempting to reconfigure a replica set with a configuration that would change the implicit default write concern. To set the global default write concern, use the setDefaultRWConcern command.

rs.remove() runs the replSetReconfig command with a configuration that omits the removed member. The method waits until a majority of voting replica set members install the new replica configuration before it returns success. A voting member is any replica set member where members[n].votes is 1, including arbiters. To learn how replica set members install a new configuration, see Reconfiguration Waits Until a Majority of Members Install the Replica Configuration.

rs.remove() does not accept a maxTimeMS limit. If a majority of voting members never install the new configuration, the operation waits indefinitely.

Por defecto, los nodos del set de réplicas esperan 5 minutos antes de cerrar las conexiones al nodo eliminado. En sets de réplicas particionados, se puede modificar este tiempo de espera mediante el parámetro del servidor ShardingTaskExecutorPoolHostTimeoutMS.

Para descartar inmediatamente todas las conexiones salientes del set de réplicas al nodo eliminado, ejecutar el comando administrativo dropConnections en cada nodo restante del set de réplicas:

db.adminCommand(
{
"dropConnections" : 1,
"hostAndPort" : [
"<hostname>:<port>"
]
}
)

Reemplaza <hostname> con el nombre de host del nodo eliminado y <port> con el puerto en el que escuchaba el mongod.

Califique esta página