Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2211

Connect to ReplicaSet through SSH tunneling

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Connection Management
    • None

      I've a remote ReplicaSet and I'm trying to connect through an SSH tunnel, but after the discovery of the cluster, since the localhost is not mapped, it's going to remove itself and fail the connection to the server.

      Should I map something in the hosts file?

      Some logs that will probably explain the situation:

      INFO org.mongodb.driver.connection - Opened connection [connectionId

      {localValue:1, serverValue:606}

      ] to localhost:28888
      INFO org.mongodb.driver.cluster - Monitor thread successfully connected to server with description ServerDescription{address=localhost:28888, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion

      {versionList=[3, 2, 3]}

      , minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=30898970, setName='datalyticsReplSet', canonicalAddress=mongo1.example.com:27017, hosts=[mongo1.example.com:27017, mongo3.example.com:27017, mongo2.example.com:27017], passives=[], arbiters=[], primary='mongo1.example.com:27017', tagSet=TagSet

      {[]}

      , electionId=7fffffff000000000000000f, setVersion=8}
      INFO org.mongodb.driver.cluster - Discovered cluster type of REPLICA_SET
      INFO org.mongodb.driver.cluster - Adding discovered server mongo1.example.com:27017 to client view of cluster
      INFO org.mongodb.driver.cluster - Adding discovered server mongo3.example.com:27017 to client view of cluster
      INFO org.mongodb.driver.cluster - Adding discovered server mongo2.example.com:27017 to client view of cluster
      INFO org.mongodb.driver.cluster - Server localhost:28888 is no longer a member of the replica set. Removing from client view of cluster.
      INFO org.mongodb.driver.cluster - Canonical address mongo1.example.com:27017 does not match server address. Removing localhost:28888 from client view of cluster

            Assignee:
            Unassigned Unassigned
            Reporter:
            Enrichman Enrico Candino [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: