Parameter | Description |
<username>
| The name of the database account used to log on to the database. Default value: root. |
<password>
| The password of the database account. |
<host>
| The domain name used to connect to the primary, secondary, or read-only node. |
<port>
| The port used to connect to the primary, secondary, or read-only node. |
<database>
| The name of the database to which you want to connect. Default value: admin. |
replicaSet=<replicaSet_value>
| Specifies that read requests are sent to all nodes of the instance. <replicaSet_value> indicates the unique ID of the HA endpoint of the instance. |
authSource=<authenticationDatabase> (optional)
| The database to which the specified database account belongs. <authenticationDatabase> indicates the name of the database used for authentication. If you do not specify the authentication database, the database specified by <database> is used as the authentication database. |
readPreference=[primary|primaryPreferred|secondary | secondaryPreferred] (optional)
| Specifies that write requests are sent to the primary node and read requests are sent to nodes specified by the parameter. This parameter ensures read/write splitting and load balancing. Valid values: readPreference=primary : Read requests are sent only to the primary nodes.
readPreference=primaryPreferred : Read requests are preferentially sent to the primary node. If the primary node fails, read requests are sent to secondary and read-only nodes.
readPreference=secondary : Read requests are sent only to secondary and read-only nodes. If the secondary and read-only nodes fail, read requests fail and are not sent to the primary node.
readPreference=secondaryPreferred : Read requests are preferentially sent to secondary and read-only nodes. If secondary and read-only nodes fail, read requests are sent to the primary node.
Note If read requests are sent to secondary and read-only nodes, uneven loads may occur. To further specify nodes that receive the read requests, configure the readPreferenceTags parameter. |
readPreferenceTags=<readonly_Tags> (optional)
| Specifies that read requests are preferentially sent to the node corresponding to the specified tag. In most cases, the parameter is specified together with the readPreference parameter and is incompatible with the primary mode. <readonly_Tags> indicates the tag keys and tag values of the read-only node and contains the role:electable and role:readonly options. Valid values: |