注意
MongoDB Atlas
MongoDB Atlas is a hosted MongoDB service option in the cloud which requires no installation overhead and offers a free cluster to get started.
Overview
このチュートリアルを使用して、MongoDB 7.0を手動でインストールします MongoDB Community EditionSUSELinuxダウンロードした.tgz tarball を使用して、 Enterprise Server(SLES)上の 。
MongoDB バージョン
このチュートリアルでは、MongoDB 7.0 Community Edition をインストールします。別のバージョンの MongoDB Community をインストールするには、このページの左上にあるバージョンのドロップダウンメニューを使用して、該当バージョンのドキュメントを選択します。
インストール方法
このドキュメントで説明されているように、ダウンロードした .tgz tarball を使用してMongoDB を手動でインストールできますが、可能であれば、システム上で zypperパッケージマネージャーを使用することをお勧めします。パッケージマネージャーを使用すると、必要な依存関係が自動でインストールされ、例mongod.confファイルが提供されます。また、将来のアップグレードやメンテナンス タスクが簡素化します。
➤ 手順について詳しくは、「 zyper パッケージ マネージャーを使用して MongoDB をインストールする」を参照してください。
Considerations
MongoDB Shell、 mongosh
.tgz パッケージを使用してサーバーをインストールする場合は、mongosh のインストール手順に従って、mongosh を個別にダウンロードしてインストールする必要があります。
プラットフォーム サポート
MongoDB7.0MongoDB Community Edition は、 SUSELinuxx86_64 アーキテクチャ上の次の 64 ビット Enterprise Server(SLES)リリースをサポートしています。
SLES 15
SLES 12
MongoDB はこれらのプラットフォームの 64 ビット版のみをサポートしています。
詳しくは、「プラットフォーム サポート」を参照してください。
プロダクション ノート
MongoDB を本番環境に導入する前に、パフォーマンスに関する考慮事項と構成の推奨事項について、自己管理型配置のプロダクションドキュメントを参照してください。
MongoDB Community Edition のインストール
前提条件
MongoDB Community .tgz tarball に必要な依存関係をインストールするには、次のコマンドを使用します。
sudo zypper install libcurl4 libopenssl1_1
sudo zypper install libcurl4 libopenssl1_0_0 liblzma5
手順
.tgz から MongoDB コミュニティ エディション を手動でインストールするには、次の手順に従ってください。
(任意) PATH にバイナリを確認します。
MongoDB バイナリは tarball のbin/ディレクトリにあります。次のいずれかを実行できます。
PATH変数にリストされている/usr/local/binなどのディレクトリにバイナリをコピーします(必要に応じてインストール ディレクトリで/path/to/the/mongodb-directory/を更新)sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/ PATH変数にリストされている/usr/local/binなどのディレクトリからバイナリへのシンボリック リンクを作成します(必要に応じてインストール ディレクトリで/path/to/the/mongodb-directory/を更新)sudo ln -s /path/to/the/mongodb-directory/bin/* /usr/local/bin/
(任意)MongoDB Shell(mongosh)をインストールします。
インストール mongosh 後、MongoDB Shell を使用してデプロイに接続します。
Download the package for the version of mongosh you need from the MongoDB Download Center and uncompress the package.
MongoDB コミュニティ エディションの実行
MongoDB コミュニティ エディション を実行するには、次の手順で行います。これらの手順は、デフォルト設定を使用していることを前提としています。
データ ディレクトリおよびログ ディレクトリを作成します。
MongoDB インスタンスのデータを保存するためにディレクトリを作成します。以下は、その例です。
sudo mkdir -p /var/lib/mongo
MongoDB インスタンスのログを保存するためにディレクトリを作成します。以下は、その例です。
sudo mkdir -p /var/log/mongodb
MongoDB プロセスを開始するには、これらのディレクトリに対する読み取りと書込み(write)権限が必要です。たとえば、自身のアカウントで MongoDB を実行するには、次のようにします。
sudo chown `whoami` /var/lib/mongo # Or substitute another user sudo chown `whoami` /var/log/mongodb # Or substitute another user
MongoDB の使用を開始します。
Start a mongosh session on the same host machine as the mongod. You can run mongosh without any command-line options to connect to a mongod that is running on your localhost with default port 27017.
mongosh
For more information on connecting using mongosh, such as to connect to a mongod instance running on a different host and/or port, see the mongosh documentation.
To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. For the driver documentation, see Start Developing with MongoDB.
詳細情報
デフォルトの Localhost バインディング
By default, MongoDB launches with bindIp set to 127.0.0.1, which binds to the localhost network interface. This means that the mongod can only accept connections from clients that are running on the same machine. Remote clients will not be able to connect to the mongod, and the mongod will not be able to initialize a replica set unless this value is set to a valid network interface which is accessible from the remote clients.
この値は、次のいずれかに設定できます。
警告
インスタンスをパブリックにアクセス可能な IP アドレスにバインドする前に、クラスターを不正アクセスから保護する必要があります。 セキュリティ推奨事項の完全なリストについては、「自己管理型配置のセキュリティ チェックリスト」を参照してください。 最低限、認証を有効化し、ネットワーク インフラストラクチャの強化 を検討してください。
bindIpの構成の詳細については、「自己管理型配置の IP バインディング 」を参照してください。