<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:37 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-2211] Connect to ReplicaSet through SSH tunneling</title>
                <link>https://jira.mongodb.org/browse/JAVA-2211</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I&apos;ve a remote ReplicaSet and I&apos;m trying to connect through an SSH tunnel, but after the discovery of the cluster, since the localhost is not mapped, it&apos;s going to remove itself and fail the connection to the server.&lt;/p&gt;

&lt;p&gt;Should I map something in the hosts file?&lt;/p&gt;

&lt;p&gt;Some logs that will probably explain the situation:&lt;/p&gt;

&lt;p&gt;INFO  org.mongodb.driver.connection - Opened connection [connectionId&lt;/p&gt;
{localValue:1, serverValue:606}
&lt;p&gt;] to localhost:28888&lt;br/&gt;
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&lt;/p&gt;
{versionList=[3, 2, 3]}
&lt;p&gt;, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=30898970, setName=&apos;datalyticsReplSet&apos;, canonicalAddress=mongo1.example.com:27017, hosts=&lt;span class=&quot;error&quot;&gt;&amp;#91;mongo1.example.com:27017, mongo3.example.com:27017, mongo2.example.com:27017&amp;#93;&lt;/span&gt;, passives=[], arbiters=[], primary=&apos;mongo1.example.com:27017&apos;, tagSet=TagSet&lt;/p&gt;
{[]}
&lt;p&gt;, electionId=7fffffff000000000000000f, setVersion=8}&lt;br/&gt;
INFO  org.mongodb.driver.cluster - Discovered cluster type of REPLICA_SET&lt;br/&gt;
INFO  org.mongodb.driver.cluster - Adding discovered server mongo1.example.com:27017 to client view of cluster&lt;br/&gt;
INFO  org.mongodb.driver.cluster - Adding discovered server mongo3.example.com:27017 to client view of cluster&lt;br/&gt;
INFO  org.mongodb.driver.cluster - Adding discovered server mongo2.example.com:27017 to client view of cluster&lt;br/&gt;
INFO  org.mongodb.driver.cluster - Server localhost:28888 is no longer a member of the replica set.  Removing from client view of cluster.&lt;br/&gt;
INFO  org.mongodb.driver.cluster - Canonical address mongo1.example.com:27017 does not match server address.  Removing localhost:28888 from client view of cluster&lt;/p&gt;</description>
                <environment></environment>
        <key id="292339">JAVA-2211</key>
            <summary>Connect to ReplicaSet through SSH tunneling</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="Enrichman">Enrico Candino [X]</reporter>
                        <labels>
                    </labels>
                <created>Wed, 8 Jun 2016 11:03:29 +0000</created>
                <updated>Wed, 11 Sep 2019 19:13:13 +0000</updated>
                            <resolved>Tue, 20 Sep 2016 17:19:24 +0000</resolved>
                                                                    <component>Connection Management</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1288624" author="jeff.yemin" created="Wed, 8 Jun 2016 21:49:27 +0000"  >&lt;p&gt;Hi Enrico, &lt;/p&gt;

&lt;p&gt;I&apos;ve never tried this, but you might be able to do this if you put each replica set member on a different port, e.g., in your replica set configuration, use:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo1.example.com:27017&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo2.example.com:27018&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo3.example.com:20719&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;and in /etc/hosts:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo1.example.com 127.0.0.1&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo2.example.com 127.0.0.1&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo3.example.com 127.0.0.1&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;and then set up port forwarding to mongo1.example.com:27017 on 127.0.0.1:27017, mongo2.example.com:27018 on 127.0.0.1:27018, and mongo3.example.com:27019 on 127.0.0.1:27019.&lt;/p&gt;

&lt;p&gt;Also, if you are willing to connect directly to a single known member of the set, you can do this by using one of the MongoClient constructors that takes a single ServerAddress instead of a List&amp;lt;ServerAddress&amp;gt;.  These constructors make direct connections to servers and don&apos;t attempt any discovery of the other replica set members, which is what&apos;s getting you into trouble.&lt;/p&gt;

&lt;p&gt;Another option, of course, is to set up a VPN, but I assume that&apos;s not an option for you.&lt;/p&gt;
</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsm99j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>