forked from docs/doc-exports
Reviewed-by: Wagner, Fabian <fabian.wagner@t-systems.com> Co-authored-by: Ru, Li Yi <liyiru7@huawei.com> Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
85 lines
28 KiB
HTML
85 lines
28 KiB
HTML
<a name="dds_02_0048"></a><a name="dds_02_0048"></a>
|
|
|
|
<h1 class="topictitle1">Connecting to a Single Node Instance Over Public Networks</h1>
|
|
<div id="body1568881417594"><div class="section" id="dds_02_0048__en-us_topic_0085335422_section46429645141251"><h4 class="sectiontitle"><strong id="dds_02_0048__b44681658414">Scenarios</strong></h4><p id="dds_02_0048__p2055118186348">This section describes how to connect to a single-node instance using the MongoDB client and Robo 3T over public networks.DDS is compatible with MongoDB.</p>
|
|
<p id="dds_02_0048__p2551818153416">The MongoDB client and Robo 3T can connect to a DB instance with an unencrypted connection or an encrypted connection (SSL). To improve data transmission security, you are advised to connect to DB instances using the SSL connection.</p>
|
|
<p id="dds_02_0048__p12551118173416"><strong id="dds_02_0048__b18177165483515">Different OS scenarios</strong>: Examples include Linux and Windows clients.</p>
|
|
|
|
</div>
|
|
<div class="section" id="dds_02_0048__section135810251275"><h4 class="sectiontitle"><strong id="dds_02_0048__b13463758115116">Prerequisites</strong></h4><ol id="dds_02_0048__ol3246193120481"><li id="dds_02_0048__li157944426489"><a href="dds_02_0026.html">Bind an EIP</a> to the Single node instance and <a href="dds_02_0080.html">set security group rules</a> to ensure that the <span id="dds_02_0048__text105559702912"></span><span id="dds_02_0048__text1972491092913">EIP</span> can be accessed with the DB client application.</li><li id="dds_02_0048__li1166891112506">Install the MongoDB client or Robo 3T.<p id="dds_02_0048__p117191137520"><a name="dds_02_0048__li1166891112506"></a><a name="li1166891112506"></a><strong id="dds_02_0048__b152491417538">MongoDB client</strong></p>
|
|
<ol type="a" id="dds_02_0048__ol135814209524"><li id="dds_02_0048__li467172923518">For details on how to create and log in to an ECS, see "Creating and Logging In to a Windows ECS" or "Creating and Logging In to a Linux ECS" in the <em id="dds_02_0048__i662423125313">Elastic Cloud Server User Guide</em>.</li><li id="dds_02_0048__li1369583718523">Install the MongoDB client on the <span id="dds_02_0048__text20431740182915">ECS</span><span id="dds_02_0048__text1243154015291"></span>.<p id="dds_02_0048__p1760103735017">For details on how to install a MongoDB client, see <a href="dds_faq_0018.html">How Can I Install a MongoDB Client?</a></p>
|
|
</li></ol>
|
|
<p id="dds_02_0048__p1334835714533"><strong id="dds_02_0048__b16903350125418">Robo 3T</strong></p>
|
|
<p id="dds_02_0048__p114019183527">For details on how to install Robo 3T, see <a href="dds_faq_0039.html">How Do I Install Robo 3T?</a></p>
|
|
</li><li id="dds_02_0048__li4213151922914">If SSL is enabled, download the SSL certificate on the DDS console.<ol type="a" id="dds_02_0048__ol122491412162415"><li id="dds_02_0048__li885613240">On the <strong id="dds_02_0048__b1317261211563">Instance Management</strong> page, click the target DB instance.</li><li id="dds_02_0048__li17853172410">In the navigation pane on the left, choose <span class="uicontrol" id="dds_02_0048__uicontrol1628916159568"><b>Connections</b></span>.</li><li id="dds_02_0048__li0861616247">In the <strong id="dds_02_0048__b147371817115617">Basic Information</strong> area, click <span><img id="dds_02_0048__image1586141132414" src="en-us_image_0000001096133902.png"></span> next to the <strong id="dds_02_0048__b117391117135611">SSL</strong> field.</li></ol>
|
|
<div class="note" id="dds_02_0048__note13665233152813"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dds_02_0048__p82811359286">The certificate can also be downloaded from the Node Information area on the Basic Information page.</p>
|
|
</div></div>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="dds_02_0048__section137404459523"><h4 class="sectiontitle">Connecting to a DB Instance Using Robo 3T (SSL)</h4><div class="notice" id="dds_02_0048__note156751999513"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="dds_02_0048__p43820110157">If you connect to a DB instance using this method, enable the SSL connection. For details, see section <a href="dds_03_0074.html#dds_03_0074__en-us_topic_0049044698_section45421719172826">Enabling SSL</a>.</p>
|
|
</div></div>
|
|
<ol id="dds_02_0048__ol274012458521"><li id="dds_02_0048__li67401245145220"><span>Run the installed Robo 3T. On the displayed dialog box, click <strong id="dds_02_0048__b25101130145617">Create</strong>.</span><p><div class="fignone" id="dds_02_0048__fig187400455526"><span class="figcap"><b>Figure 1 </b>Connections</span><br><span><img id="dds_02_0048__image874011452522" src="en-us_image_0000001096133894.png"></span></div>
|
|
</p></li><li id="dds_02_0048__li2740154518521"><span>In the <strong id="dds_02_0048__b0350835205611">Connection Settings</strong> dialog box, set the parameters of the new connection.</span><p><ol type="a" id="dds_02_0048__ol47401345125210"><li id="dds_02_0048__li7740144525211">On the <strong id="dds_02_0048__b13244637195612">Connection</strong> tab, enter the name of the new connection in the <strong id="dds_02_0048__b1824573785617">Name</strong> text box and enter the EIP and database port that are bound to the single-node instance in the <strong id="dds_02_0048__b1124793705612">Address</strong> text box.<div class="fignone" id="dds_02_0048__fig87408452525"><span class="figcap"><b>Figure 2 </b>Connection</span><br><span><img id="dds_02_0048__image374014454529" src="en-us_image_0000001142893889.png"></span></div>
|
|
</li><li id="dds_02_0048__li12740045165212">On the <strong id="dds_02_0048__b189661851125614">Authentication</strong> tab, set <strong id="dds_02_0048__b096713513561">Database</strong> to <strong id="dds_02_0048__b1096812514564">admin</strong>, <strong id="dds_02_0048__b17968951105616">User Name</strong> to <strong id="dds_02_0048__b1697045155615">rwuser</strong>, and <strong id="dds_02_0048__b1970135145612">Password</strong> to the administrator password you set during the creation of the single-node instance.<div class="fignone" id="dds_02_0048__fig14740445175212"><span class="figcap"><b>Figure 3 </b>Authentication</span><br><span><img id="dds_02_0048__image1374104518522" src="en-us_image_0000001096133896.png"></span></div>
|
|
</li><li id="dds_02_0048__li1648133312283">On the <strong id="dds_02_0048__b196461750572">SSL</strong> tab, upload the SSL certificate and select <strong id="dds_02_0048__b146464520570">Allowed</strong> for <strong id="dds_02_0048__b12647050578">Invalid Hostnames</strong>.<div class="fignone" id="dds_02_0048__fig14399846163217"><span class="figcap"><b>Figure 4 </b>SSL</span><br><span><img id="dds_02_0048__image3401646143216" src="en-us_image_0000001143133835.png"></span></div>
|
|
</li><li id="dds_02_0048__li874194517523">Click <strong id="dds_02_0048__b25951617205716">Save</strong>.</li></ol>
|
|
</p></li><li id="dds_02_0048__li127416452521"><span>On the <strong id="dds_02_0048__b14997918205714">MongoDB Connections</strong> page, click <strong id="dds_02_0048__b10999151811575">Connect</strong> to connect to the single-node instance.</span><p><div class="fignone" id="dds_02_0048__fig074117456529"><span class="figcap"><b>Figure 5 </b>Connections</span><br><span><img id="dds_02_0048__image1474114454528" src="en-us_image_0000001143053839.png"></span></div>
|
|
</p></li><li id="dds_02_0048__li474154525214"><span>If the single-node instance is successfully connected, the page shown in <a href="#dds_02_0048__fig167418454527">Figure 6</a> is displayed.</span><p><div class="fignone" id="dds_02_0048__fig167418454527"><a name="dds_02_0048__fig167418454527"></a><a name="fig167418454527"></a><span class="figcap"><b>Figure 6 </b>Connection succeeded</span><br><span><img id="dds_02_0048__image11741144519521" src="en-us_image_0000001142773935.png"></span></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="dds_02_0048__section238792617370"><h4 class="sectiontitle">Connecting to a DB Instance Using Robo 3T (Non-SSL)</h4><div class="notice" id="dds_02_0048__note44843514537"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="dds_02_0048__p8755899182235">If you connect to a DB instance using this method, disable the SSL connection. For details, see section <a href="dds_03_0074.html#dds_03_0074__section4225593518277">Disabling SSL</a>.</p>
|
|
</div></div>
|
|
<ol id="dds_02_0048__ol0891837112610"><li id="dds_02_0048__li18891123792617"><span>Run the installed Robo 3T. On the displayed dialog box, click <strong id="dds_02_0048__b843215595716">Create</strong>.</span><p><div class="fignone" id="dds_02_0048__fig8324212122213"><span class="figcap"><b>Figure 7 </b>Connections</span><br><span><img id="dds_02_0048__image1132521202215" src="en-us_image_0000001096293880.png"></span></div>
|
|
</p></li><li id="dds_02_0048__li1189173715261"><span>In the <strong id="dds_02_0048__b467217115812">Connection Settings</strong> dialog box, set the parameters of the new connection.</span><p><ol type="a" id="dds_02_0048__ol12321221151517"><li id="dds_02_0048__li20443123311916">On the <strong id="dds_02_0048__b261903115810">Connection</strong> tab, enter the name of the new connection in the <strong id="dds_02_0048__b14620336582">Name</strong> text box and enter the EIP and database port that are bound to the single-node instance in the <strong id="dds_02_0048__b146204335813">Address</strong> text box.<div class="fignone" id="dds_02_0048__fig45982550220"><span class="figcap"><b>Figure 8 </b>Connection</span><br><span><img id="dds_02_0048__image153616411218" src="en-us_image_0000001143133839.png"></span></div>
|
|
</li><li id="dds_02_0048__li1444383310912">On the <strong id="dds_02_0048__b497108583">Authentication</strong> tab, set <strong id="dds_02_0048__b10911045811">Database</strong> to <strong id="dds_02_0048__b911910195814">admin</strong>, <strong id="dds_02_0048__b112171011582">User Name</strong> to <strong id="dds_02_0048__b181312101581">rwuser</strong>, and <strong id="dds_02_0048__b1114111010580">Password</strong> to the administrator password you set during the creation of the single-node instance.<div class="fignone" id="dds_02_0048__fig19511154611251"><span class="figcap"><b>Figure 9 </b>Authentication</span><br><span><img id="dds_02_0048__image12446154213315" src="en-us_image_0000001143133833.png"></span></div>
|
|
</li><li id="dds_02_0048__li34439331693">Click <strong id="dds_02_0048__b1093931419582">Save</strong>.</li></ol>
|
|
</p></li><li id="dds_02_0048__li38913377264"><span>On the <strong id="dds_02_0048__b2094851645818">MongoDB Connections</strong> page, click <strong id="dds_02_0048__b149491216125819">Connect</strong> to connect to the single-node instance.</span><p><div class="fignone" id="dds_02_0048__fig13943185811558"><span class="figcap"><b>Figure 10 </b>Connections</span><br><span><img id="dds_02_0048__image10559624405" src="en-us_image_0000001096453876.png"></span></div>
|
|
</p></li><li id="dds_02_0048__li182324215276"><span>If the single-node instance is successfully connected, the page shown in <a href="#dds_02_0048__fig17236526175520">Figure 11</a> is displayed.</span><p><div class="fignone" id="dds_02_0048__fig17236526175520"><a name="dds_02_0048__fig17236526175520"></a><a name="fig17236526175520"></a><span class="figcap"><b>Figure 11 </b>Connection succeeded</span><br><span><img id="dds_02_0048__image7236142685514" src="en-us_image_0000001096453878.png"></span></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="dds_02_0048__section17675112516136"><h4 class="sectiontitle">Connecting to a DB Instance Using the MongoDB Client (SSL)</h4><div class="notice" id="dds_02_0048__note135358135314"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="dds_02_0048__p9535713203113">If you connect to a DB instance using this method, enable the SSL connection. For details, see section <a href="dds_03_0074.html#dds_03_0074__en-us_topic_0049044698_section45421719172826">Enabling SSL</a>.</p>
|
|
</div></div>
|
|
<ol id="dds_02_0048__ol9332173415137"><li id="dds_02_0048__li102171219141112"><span>On the <strong id="dds_02_0048__b77396316587">Instance Management</strong> page, click the target DB instance.</span></li><li id="dds_02_0048__li115474615474"><span>In the navigation pane on the left, choose <span class="uicontrol" id="dds_02_0048__uicontrol134726334589"><b>Connections</b></span>.</span></li><li id="dds_02_0048__li6501114181414"><span>In the <strong id="dds_02_0048__b14793103415589">Basic Information</strong> area, click <span><img id="dds_02_0048__image18459281105" src="en-us_image_0000001143133837.png"></span> next to the <strong id="dds_02_0048__b197961034185818">SSL</strong> field.</span></li><li id="dds_02_0048__li1433333418132"><span>Upload the root certificate to the <span id="dds_02_0048__text1284553211308">ECS</span><span id="dds_02_0048__text17845143253017"></span> to be connected to the DB instance.</span><p><p id="dds_02_0048__p1933617718381">The following describes how to upload the certificate to a Linux and Window ECS:</p>
|
|
<ul id="dds_02_0048__ul1977195483815"><li id="dds_02_0048__li87711754113820">In Linux, run the following command:<div class="p" id="dds_02_0048__p333313461319"><a name="dds_02_0048__li87711754113820"></a><a name="li87711754113820"></a><strong id="dds_02_0048__b1733319342138">scp</strong> <em id="dds_02_0048__i3333034161319"><IDENTITY_FILE></em> <em id="dds_02_0048__i8333173416130"><REMOTE_USER></em><strong id="dds_02_0048__b93331334191317">@</strong><em id="dds_02_0048__i03331349135"><REMOTE_ADDRESS></em><strong id="dds_02_0048__b5333103413136">:</strong><em id="dds_02_0048__i1933319340131"><REMOTE_DIR></em><div class="note" id="dds_02_0048__note9333183415136"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="dds_02_0048__ul633473411138"><li id="dds_02_0048__li15334153461310"><strong id="dds_02_0048__b8348113062620">IDENTITY_FILE</strong> indicates the directory where the root certificate resides. The file access permission is 600.</li><li id="dds_02_0048__li3334734141318"><strong id="dds_02_0048__b136181910105517">REMOTE_USER</strong> indicates the <span id="dds_02_0048__text111711542193011">ECS</span><span id="dds_02_0048__text12171164219308"></span> OS user.</li><li id="dds_02_0048__li23345341134"><strong id="dds_02_0048__b525421418552">REMOTE_ADDRESS</strong> indicates the <span id="dds_02_0048__text9377147133014">ECS</span><span id="dds_02_0048__text10377144753016"></span> address.</li><li id="dds_02_0048__li13340345135"><strong id="dds_02_0048__b545331555519">REMOTE_DIR</strong> indicates the directory of the <span id="dds_02_0048__text744610532303">ECS</span><span id="dds_02_0048__text1544625333016"></span> to which the root certificate is uploaded.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="dds_02_0048__ul16741818193920"><li id="dds_02_0048__li067514182397">In Windows, upload the root certificate using the remote connection tool.</li></ul>
|
|
</p></li><li id="dds_02_0048__li13341346136"><span>Connect to the DB instance in the directory where the MongoDB client is located.</span><p><ul id="dds_02_0048__ul16334634151317"><li id="dds_02_0048__li5334103421319">Method 1: Using standard parameters<p id="dds_02_0048__p2334734121318"><a name="dds_02_0048__li5334103421319"></a><a name="li5334103421319"></a><strong id="dds_02_0048__b33351034111319">mongo --host</strong> <<em id="dds_02_0048__i93351934161311">DB_HOST</em>> <strong id="dds_02_0048__b6335203491317">--port</strong> <<em id="dds_02_0048__i19335193412136">DB_PORT</em>> <strong id="dds_02_0048__b16335193431315">-u</strong> <<em id="dds_02_0048__i2335153491311">DB_USER</em>> <strong id="dds_02_0048__b33351034111311">-p</strong> <strong id="dds_02_0048__b1733519349132">--authenticationDatabase</strong><strong id="dds_02_0048__b5335183451315"> admin </strong><strong id="dds_02_0048__b333514342138">--ssl --sslCAFile</strong> <<em id="dds_02_0048__i933553419136">FILE_PATH</em>> <strong id="dds_02_0048__b12335173416132">--sslAllowInvalidHostnames</strong></p>
|
|
<p id="dds_02_0048__p1133683414132">Enter the database account password when prompted:</p>
|
|
<pre class="screen" id="dds_02_0048__screen133619348139">Enter password:</pre>
|
|
</li><li id="dds_02_0048__li16336143431315">Method 2: Using standard URI format<p id="dds_02_0048__p10336103413131"><a name="dds_02_0048__li16336143431315"></a><a name="li16336143431315"></a><strong id="dds_02_0048__b2336173411318">mongo</strong> <strong id="dds_02_0048__b833693471310">mongodb://rwuser:</strong><password><strong id="dds_02_0048__b1336133418138">@</strong><em id="dds_02_0048__i12336163431310"><</em><em id="dds_02_0048__i16336133416138">DB_HOST</em><em id="dds_02_0048__i183363345135">></em><strong id="dds_02_0048__b1933673416135">:</strong><em id="dds_02_0048__i5336034151317"><</em><em id="dds_02_0048__i133361634171319">DB_PORT</em><em id="dds_02_0048__i83367347138">></em><strong id="dds_02_0048__b8336934161319">/test?authSource=admin</strong> <strong id="dds_02_0048__b1133653481315">--ssl --sslCAFile</strong> <<em id="dds_02_0048__i18336113491310">FILE_PATH</em>> <strong id="dds_02_0048__b1133613420135">--sslAllowInvalidHostnames</strong></p>
|
|
<p id="dds_02_0048__p3446121775715">To obtain the public connection address, click the instance name and choose <strong id="dds_02_0048__b1586019101900">Connections</strong>. The address is displayed in <strong id="dds_02_0048__b12860111010015">Public Network Connection Address</strong> field on the <strong id="dds_02_0048__b208601910509">Public Connection</strong> tab.</p>
|
|
</li></ul>
|
|
<div class="note" id="dds_02_0048__note1733615346138"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="dds_02_0048__ul83371634141320"><li id="dds_02_0048__li1433710341139">A single node instance uses the management IP address to generate SSL certificate. <strong id="dds_02_0048__b125556321008">--sslAllowInvalidHostnames</strong> is needed for the SSL connection through a public network.</li><li id="dds_02_0048__li19337193415138"><strong id="dds_02_0048__b4421173914012">DB_HOST</strong> indicates the IP address of the remotely connected DB instance. Obtain the value from the <span class="uicontrol" id="dds_02_0048__uicontrol4337123416134"><b>EIP</b></span> column in the node list on the <span class="uicontrol" id="dds_02_0048__uicontrol8423639201"><b>Connections</b></span> page.</li><li id="dds_02_0048__li1933793411132"><strong id="dds_02_0048__b1593515018117">DB_PORT</strong> indicates the port number. Obtain the value from <span class="uicontrol" id="dds_02_0048__uicontrol1793614018113"><b>Database Port</b></span> in the <span class="uicontrol" id="dds_02_0048__uicontrol59371001914"><b>Basic Information</b></span> area on the <strong id="dds_02_0048__b11938180315">Connections</strong> page.</li><li id="dds_02_0048__li67784212329"><strong id="dds_02_0048__b677084410321">DB_HOST</strong> and <strong id="dds_02_0048__b616150153315">DB_PORT</strong> can also be obtained from the Node Information area on the Basic Information page.</li><li id="dds_02_0048__li13338153441318"><strong id="dds_02_0048__b10984104515">DB_USER</strong> indicates the database account name. The default value is <strong id="dds_02_0048__b9985104119">rwuser</strong>.</li><li id="dds_02_0048__li1580132493115"><strong id="dds_02_0048__b8802112413117"><em id="dds_02_0048__i1880222414310"><password> </em></strong>indicates the password of the database account. If the password contains at signs (@),exclamation marks (!), or percent signs (%), replace them with hexadecimal URL codes %40, %21, and %25 respectively.</li><li id="dds_02_0048__li122761750202211">If user inputs this command then the password will be stored in logfiles and can be found in linux history, and in process list. So please note that plaintext passwords are risky.</li><li id="dds_02_0048__li1733810349130"><strong id="dds_02_0048__b96311831611">FILE_PATH</strong> indicates the path where the root certificate is stored.</li></ul>
|
|
</div></div>
|
|
<ul id="dds_02_0048__ul233816341135"><li id="dds_02_0048__li6338113411137">Connect to the instance using standard parameters. The following is an example command:<p id="dds_02_0048__p153386346132"><a name="dds_02_0048__li6338113411137"></a><a name="li6338113411137"></a><strong id="dds_02_0048__b133384348133">mongo --host 192.168.1.6 --port 8635 -u rwuser -p --authenticationDatabase admin --ssl --sslCAFile /tmp/ca.crt</strong> <strong id="dds_02_0048__b103381234111314">--sslAllowInvalidHostnames</strong></p>
|
|
</li><li id="dds_02_0048__li1433815346138">Connect to the DB instance using standard URI format. The following is an example command:<p id="dds_02_0048__p23391634101316"><a name="dds_02_0048__li1433815346138"></a><a name="li1433815346138"></a><strong id="dds_02_0048__b183396347139">mongo</strong> <strong id="dds_02_0048__b1333919341135">mongodb://rwuser:<password>@</strong><strong id="dds_02_0048__b1339734181317">192.168.1.80</strong><strong id="dds_02_0048__b16339183461310">:</strong><strong id="dds_02_0048__b333943431312">8635</strong><strong id="dds_02_0048__b6339103413136">/test?authSource=admin</strong><strong id="dds_02_0048__b1333903415130"> -</strong><strong id="dds_02_0048__b63391534181317">-ssl --sslCAFile</strong> <strong id="dds_02_0048__b9339113451319">/tmp/ca.crt</strong> <strong id="dds_02_0048__b033973410135">--sslAllowInvalidHostnames</strong></p>
|
|
</li></ul>
|
|
</p></li><li id="dds_02_0048__li833993451320"><span>Check the connection result. If the following information is displayed, the connection is successful.</span><p><pre class="screen" id="dds_02_0048__screen143397345133">replica:PRIMARY></pre>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="dds_02_0048__section278014466539"><h4 class="sectiontitle">Connecting to a DB Instance Using the MongoDB Client (Non-SSL)</h4><div class="notice" id="dds_02_0048__en-us_topic_0085335422_note45712120182235"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="dds_02_0048__p20154316527">If you connect to a DB instance using this method, disable the SSL connection. For details, see section <a href="dds_03_0074.html#dds_03_0074__section4225593518277">Disabling SSL</a>.</p>
|
|
</div></div>
|
|
<ol id="dds_02_0048__en-us_topic_0085335422_o12386b3d9147482881ddfdfd9a3f787c"><li id="dds_02_0048__en-us_topic_0085335422_lf50bb4c0b07747cfac89f74cc2b28b4a"><span>Connect to a <span class="keyword" id="dds_02_0048__keyword2078120035">DDS DB instance</span>.</span><p><ul id="dds_02_0048__ul7567173152111"><li id="dds_02_0048__li856712311210">Method 1: Using standard parameters<p id="dds_02_0048__p1546173416213"><a name="dds_02_0048__li856712311210"></a><a name="li856712311210"></a><strong id="dds_02_0048__b1567143119217">mongo --host</strong> <<em id="dds_02_0048__i456717314219">DB_HOST</em>> <strong id="dds_02_0048__b256763113211">--port</strong> <<em id="dds_02_0048__i3567631142114">DB_PORT</em>> <strong id="dds_02_0048__b16567731192119">-u</strong> <<em id="dds_02_0048__i65672318217">DB_USER</em>> <strong id="dds_02_0048__b637789133717">-p</strong> <strong id="dds_02_0048__b1156711315219">--authenticationDatabase</strong> <strong id="dds_02_0048__b2033119156376">admin</strong></p>
|
|
<p id="dds_02_0048__p3759945202019">Enter the database account password when prompted:</p>
|
|
<pre class="screen" id="dds_02_0048__screen6759145122016">Enter password:</pre>
|
|
</li><li id="dds_02_0048__li956719313217">Method 2: Using standard URI format<p id="dds_02_0048__p18264365212"><a name="dds_02_0048__li956719313217"></a><a name="li956719313217"></a><strong id="dds_02_0048__b1851992173718">mongo</strong> <strong id="dds_02_0048__b165200219378">mongodb://rwuser:</strong><password><strong id="dds_02_0048__b1692415451252">@</strong><em id="dds_02_0048__i15671331162116"><</em><em id="dds_02_0048__i956773112112">DB_HOST</em><em id="dds_02_0048__i20567173113218">></em><strong id="dds_02_0048__b656763118210">:</strong><em id="dds_02_0048__i9567143122110"><</em><em id="dds_02_0048__i1156723132117">DB_PORT</em><em id="dds_02_0048__i75674315214">></em><strong id="dds_02_0048__b4981817583">/test?authSource=admin</strong></p>
|
|
<p id="dds_02_0048__p318624972916">To obtain the public connection address, click the instance name and choose <strong id="dds_02_0048__b534517285310">Connections</strong>. The address is displayed in <strong id="dds_02_0048__b1334532833111">Public Network Connection Address</strong> field on the <strong id="dds_02_0048__b11347142823118">Public Connection</strong> tab.</p>
|
|
</li></ul>
|
|
<div class="note" id="dds_02_0048__note839816116261"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="dds_02_0048__ul83946567225"><li id="dds_02_0048__li146091023142317"><strong id="dds_02_0048__b142912221031">DB_HOST</strong> indicates the IP address of the remotely connected DB instance. Obtain the value from the <span class="uicontrol" id="dds_02_0048__uicontrol5304228313"><b>EIP</b></span> column in the node list on the <span class="uicontrol" id="dds_02_0048__uicontrol19311220315"><b>Connections</b></span> page.</li><li id="dds_02_0048__li2508131610233"><strong id="dds_02_0048__b105259251235">DB_PORT</strong> indicates the port number. Obtain the value from <span class="uicontrol" id="dds_02_0048__uicontrol10525112517316"><b>Database Port</b></span> in the <span class="uicontrol" id="dds_02_0048__uicontrol2052720252314"><b>Basic Information</b></span> area on the <strong id="dds_02_0048__b1652712259319">Connections</strong> page.</li><li id="dds_02_0048__li4353171443514"><strong id="dds_02_0048__b135351419352">DB_HOST</strong> and <strong id="dds_02_0048__b17353121413357">DB_PORT</strong> can also be obtained from the <strong id="dds_02_0048__b3573345201017">Node Information</strong> area on the <strong id="dds_02_0048__b18783184915101">Basic Information</strong> page.</li><li id="dds_02_0048__li2512016202314"><strong id="dds_02_0048__b64721271838">DB_USER</strong> indicates the database account name. The default value is <strong id="dds_02_0048__b164731027734">rwuser</strong>.</li><li id="dds_02_0048__li1937943683118"><strong id="dds_02_0048__b1937912365315"><em id="dds_02_0048__i1837915364315"><password></em></strong> indicates the password of the database account. If the password contains at signs (@),exclamation marks (!), or percent signs (%), replace them with hexadecimal URL codes %40, %21, and %25 respectively.</li><li id="dds_02_0048__li5466638153119">If user inputs this command then the password will be stored in logfiles and can be found in linux history, and in process list. So please note that plaintext passwords are risky.</li></ul>
|
|
</div></div>
|
|
<ul id="dds_02_0048__ul106082418273"><li id="dds_02_0048__li45912247273">Connect to the instance using standard parameters. The following is an example command:<p id="dds_02_0048__p1138102682712"><a name="dds_02_0048__li45912247273"></a><a name="li45912247273"></a><strong id="dds_02_0048__b85912412716">mongo --host 192.168.1.6 --port 8635 -u rwuser -p --authenticationDatabase admin</strong></p>
|
|
</li><li id="dds_02_0048__li35911241274">Connect to the DB instance using standard URI format. The following is an example command:<p id="dds_02_0048__p43699277273"><a name="dds_02_0048__li35911241274"></a><a name="li35911241274"></a><strong id="dds_02_0048__b6128732153717">mongo</strong> <strong id="dds_02_0048__b012812320375">mongodb://rwuser:<password>@</strong><strong id="dds_02_0048__b145952420279">192.168.1.80:8635</strong><strong id="dds_02_0048__b95942410270">/test?authSource=admin</strong></p>
|
|
</li></ul>
|
|
</p></li><li id="dds_02_0048__en-us_topic_0085335422_li2356085813016"><span>Check the connection result. If the following information is displayed, the connection is successful.</span><p><pre class="screen" id="dds_02_0048__en-us_topic_0085335422_screen141854665519">replica:PRIMARY></pre>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dds_02_0077.html">Connecting to a Single Node Instance Over Public Networks</a></div>
|
|
</div>
|
|
</div>
|
|
|