MongoDB


MongoDB


前提条件

CData IP をホワイトリストに登録

MongoDB への接続を確立するには、CData のIP 経由でMongoDB へのアクセスを許可する必要があります。MongoDB をファイアウォールの内側でホスティングする場合は、これらのIP アドレスをファイアウォールの許可リストに登録する必要があります。

  • 範囲:52.224.0.16052.224.0.175

  • CIDR 表記:52.224.0.160/28

MongoDB が一般にアクセス可能であることを確認

パブリックフェイシングIP / ドメインを指定して、このデータソースに接続します。次のプライベートIP の範囲は機能しません。

  • 10.0.0.0 to 10.255.255.255

  • 172.16.0.0 to 172.31.255.255

  • 192.168.0.0 to 192.168.255.255

  • 127.0.0.1 (aka ‘localhost’)

セットアップガイド

以下の手順で、MongoDB をCData Connect アカウントに接続します。

  1. CData Connect のダッシュボードからConnections ページを開きます。

  2. 右上の+ Add Connection をクリックします。

  3. 検索フィールドに MongoDB と入力し、データソース名をクリックします。

  4. 新しいコネクションのBasic Settings タブで、コネクション名を入力するかデフォルトの名前をそのまま使用します。

  5. Enter MongoDB サーバーのホスト名またはIP アドレス in the Server field.

  6. Specify MongoDB サーバーに接続するためのポート in the Port field. By default this is set to 27017.

  7. Enter the name of the MongoDB Database.

  8. Select the Auth Scheme you use to connect to MongoDB. Options are: MONGODB-CR, SCRAM-SHA-1, SCRAM-SHA-256, and X509.

  9. Enter 認証用のMongoDB ユーザー名 in the User field.

  10. In the Password field, enter ユーザーパスワード.

  11. (Optional) If the authentication database is different from the database to retreive data from, enter it into the Auth Database field.

  12. MongoDB で、CData Connect 静的IP アドレスを接続のホワイトリストに追加します。

  13. CData Connect Add MongoDB Connection ページ上部の、Save & Test をクリックします。

    • 接続テストに成功すると、接続が作成されたことを示すメッセージが表示されます。

    • 接続テストに失敗した場合は、入力したログイン情報に余分なスペースや文字がないかを確認してください。そして、もう一度試してください。

Connect to Replica Sets

  1. To connect to a replica set, click on Advanced Settings.

  2. Set Replica Set to a list of comma-separated list of secondary servers, specified by address and port.

  3. Set Slave OK to True.

  4. Set Read Preference to determine how the provider reads from the secondary servers.

    • primary executes all SELECT queries against the primary server.
    • primaryprefered executes SELECT queries from a secondary server when the primary is not available.
    • secondary executes SELECT queries on secondary servers only.
    • secondary prefered executes SELECT queries on the primary server in the event no secondaries are available.
    • nearest executes SELECT queries on whichever server has the least latency.

詳細について

CData Connect とMongoDB の連携の詳細動作については、こちらのページを参照してください。