# Error establishing direct connection to mongo node at \[ip:port\]. Error output: no reachable servers

**URL:** <https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [August 25, 2021, 4:43am UTC](https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434 "2021-08-25T04:43:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![devopshulk](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@devopshulk](https://discuss.elastic.co/u/devopshulk)\
**Post date:** [August 25, 2021, 4:43am UTC](https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434/1 "2021-08-25T04:43:22Z")

</div>

Hi,

I am using MongoDB with a replica set. When I am trying to create a metricbeat MongoDB module am not sure How to give a URL. I don't understand how to solve it. when uncommenting the ssl.verification\_mode: 'none' then getting "no reachable servers error". if you comment the ssl.verification\_mode: 'none' then getting saslcontinue.mechanism error.

metricbeat version: 7.11.1  
mongodb: 5.0

#ssl.verification\_mode: 'none'  
mongodb/mongodb.go:98 Error establishing direct connection to mongo node at [ip:27017]. Error output: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.  
module/wrapper.go:259 Error fetching data for metricset mongodb.status: error creating new Session: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.

ssl.verification\_mode: 'none':

"error": {  
"message": "error creating new Session: no reachable servers"  
},

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [August 26, 2021, 11:51am UTC](https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434/2 "2021-08-26T11:51:54Z")

</div>

Can you post your config file, please?

Also, can you try with a previous version of Mongodb? I don´t discard that Beats doesn´t support 5.0 yet.

---

<div class="post-metadata">

**Author:** ![devopshulk](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@devopshulk](https://discuss.elastic.co/u/devopshulk)\
**Post date:** [August 26, 2021, 12:35pm UTC](https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434/3 "2021-08-26T12:35:04Z")

</div>

```auto
- module: mongodb
  metricsets:
    #- dbstats
    - status
    #- collstats
    - metrics
    - replstatus
  period: 10s

  # The hosts must be passed as MongoDB URLs in the format:
  # [mongodb://][user:pass@]host[:port].
  # The username and password can also be set using the respective configuration
  # options. The credentials in the URL take precedence over the username and
  # password configuration options.
  hosts: ["mongodb://ip:27017?authMechanism=SCRAM-SHA-256&authSource=admin"]

  # Optional SSL. By default is off.
  #ssl.enabled: true

  # Mode of verification of server certificate ('none' or 'full')
  #ssl.verification_mode: 'none'

  # List of root certificates for TLS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  #ssl.key: "/etc/pki/client/cert.key"

  # Username to use when connecting to MongoDB. Empty by default.
  username: beats

  # Password to use when connecting to MongoDB. Empty by default.
  password: xxxxxx

```

---

<div class="post-metadata">

**Author:** ![devopshulk](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@devopshulk](https://discuss.elastic.co/u/devopshulk)\
**Post date:** [September 1, 2021, 6:59am UTC](https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434/4 "2021-09-01T06:59:26Z")

</div>

@Mario_Castro ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 29, 2021, 8:59am UTC](https://discuss.elastic.co/t/error-establishing-direct-connection-to-mongo-node-at-ip-port-error-output-no-reachable-servers/282434/5 "2021-09-29T08:59:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
