MongoDB Community EditionにMongoDB SearchとMongoDBベクトル検索プロセスmongotをインストールできます。.tgz拡張子を持つターボールとして、Red Hat、Ubuntu、Debian、SUSE、Amazon LinuxなどのすべてのLinuxディストリビューションでmongotプロセスを配置できます。
注意
実験用の配置でより迅速にオンボードするには、自己管理型配置の次のチュートリアルを参照してください。
始める前に
自己管理型配置に mongot をインストールするには、次の前提条件が必要です。
MongoDB Community Edition v8.3 以降。
See Install MongoDB Community Edition for installation tutorials.
注意
You must have MongoDB 8.3 or later to run MongoDB Search and MongoDB Vector Search process, whether you use a standalone self-managed deployment or deploy with the MongoDB Controllers for Kubernetes Operator. For more information, see Compatibility and Requirements for
mongot.キーファイル アクセス制御を使用して開始されたレプリカセット。
手順
Download the mongot tarball.
Download the latest Search in Community tarball for your system architecture from the MongoDB Search in Community Download Center.
To download a specific version from the command line, replace {VERSION_NUMBER} with the version of mongot that you want and run the command for your system architecture:
wget https://downloads.mongodb.org/mongodb-search-community/{VERSION_NUMBER}/mongot_community_{VERSION_NUMBER}_linux_aarch64.tgz
wget https://downloads.mongodb.org/mongodb-search-community/{VERSION_NUMBER}/mongot_community_{VERSION_NUMBER}_linux_x86_64.tgz
(任意).tarball パッケージの整合性を検証します。
詳細については、「mongot パッケージの整合性の検証」を参照してください。
Extract the mongot tarball.
Replace {VERSION_NUMBER} with the version of mongot that you downloaded and run the command for your system architecture to extract the tarball:
tar -zxvf mongot_community_{VERSION_NUMBER}_linux_aarch64.tgz
tar -zxvf mongot_community_{VERSION_NUMBER}_linux_x86_64.tgz
注意
ウェブ ブラウザがダウンロード後にファイルを自動的に解凍する場合、ファイル拡張子は .tar です。
tarball には、サンプル構成ファイル、mongot ランサー スクリプト、MongoDB Search およびベクトル検索のライセンス情報が含まれています。
Configure mongod to communicate with mongot.
使用する既存のレプリカセットがある場合は、次の mongod パラメータを設定して、検索クエリとMongoDB ベクトル検索クエリをルーティングしてインデックスを管理します。
Parameter | 説明 |
|---|---|
|
|
|
|
| 検索インデックス管理サーバーの認証を有効にするかどうかを指定します |
| MongoDB Search で CRPC が有効かどうかを指定します |
例、mongod 構成ファイルに次の行を追加して、mongod を再起動します。
setParameter: searchIndexManagementHostAndPort: localhost:27028 mongotHost: localhost:27028 skipAuthenticationToSearchIndexManagementServer: false useGrpcForSearch: true
See MongoDB Server Parameters for a Self-Managed Deployment for more information on setting mongod parameters. For detailed information about search-specific setParameter options, see MongoDB Search Options.
注意
The mongotHost, searchIndexManagementHostAndPort, and useGrpcForSearch parameters are set only at startup. You can't change them at runtime with setParameter. To point mongod at a different mongot instance, update these parameters in the mongod configuration file and restart mongod.
If you want to deploy a new replica set with keyfile authentication, follow the steps in Deploy Self-Managed Replica Set With Keyfile Authentication.
Create a user for the mongot process on your MongoDB deployment.
mongot must be able to connect to your MongoDB deployment through a user with the searchCoordinator role.
管理者ユーザーとして
mongoshに接続します。mongosh --port 27017 -u <your_admin_username> -p <your_admin_password> adminデータベースに接続します。次のコマンドを実行して、
adminデータベースに接続します。use admin mongotユーザーを作成します。searchCoordinatorロールを持つユーザーを作成するには:<mongot-username>をmongotユーザーのユーザー名に置き換え<mongot-password>を、次のステップのpasswordFileで指定したパスワードに置き換えます次のコマンドを実行します:
db.createUser( { user: <mongot-username>, pwd: <mongot-password>, roles: [ "searchCoordinator"] } )
パスワードファイルを作成します。
mongod に接続するための mongot 用のパスワードファイルを作成します。
例、オペレーティング システムを選択し、<mongot-password> をパスワードに置き換えます。次に、次のコマンドを実行して passwordFile というファイルを作成します。
echo -n "<mongot-password>" > passwordFile chmod 400 passwordFile
注意
-n フラグは末尾の改行を防止します。
echo|set /p="mongotPassword" > passwordFile
[System.IO.File]::WriteAllText("passwordFile", "mongotPassword")
mongot の構成オプションを指定します。
You can configure mongot with a YAML configuration file. Use the included sample configuration file named config.default.yml or a new configuration file to define the configuration. For more information on mongot configuration options, see mongot Options.
tarball には、デフォルトのmongot 設定を持つ次のサンプル構成ファイルconfig.default.yml が含まれています。配置の設定を変更できます。
警告
システムトポロジーによっては、mongot クエリサーバーを MongoDB クラスターからアクセス可能なインターフェースにバインドする必要がある場合があります。0.0.0.0 IP アドレスへのバインディングは許可されていますが、サーバーがすべてのパブリック ネットワークに公開され、不正アクセスのリスクがあります。
セキュリティを強化するには、localhost やその他の信頼できる内部アドレスなど、ネットワークレイヤーで制御および保護されている特定のインターフェースに server.grpc.address を制限することを検討してください。
syncSource: replicaSet: hostAndPort: "localhost:27017" # Replace with the mongod host and port. scramAuth: username: mongotUser # Replace with mongod username enabled with "searchCoordinator" role. authSource: admin # Replace with the database to authenticate the user against. passwordFile: "/etc/mongot/secrets/passwordFile" # Replace with path to password file for the above user. tls: enabled: false storage: dataPath: "/var/lib/mongot" # Replace with the path where you want mongot to store search data. server: grpc: address: "localhost:27028" # Replace with the address and port for mongot listen server tls: mode: "disabled" metrics: enabled: true address: "localhost:9946" healthCheck: address: "localhost:8080" logging: verbosity: INFO
注意
構成ファイル内の dataPath ディレクトリは、mongot を実行するユーザーが書き込み可能である必要があります。
The sample configuration uses SCRAM authentication with the scramAuth block. You must configure exactly one authentication mechanism for the sync source: either SCRAM or X.509. To authenticate with a TLS client certificate instead of a username and password, use the x509 block. For both mechanisms, including the sharded-cluster syncSource.router configuration, see Configure Authentication and Authorization for mongot.
This sample runs mongot and mongod on the same host, so it binds server.grpc.address to localhost and disables TLS. If you run mongot and mongod on separate hosts, complete the following steps instead:
Bind
server.grpc.addressto a network interface thatmongodcan reach, rather thanlocalhost.Set the
mongodmongotHostandsearchIndexManagementHostAndPortparameters to that address.Enable TLS for the sync source and gRPC connections. Running without TLS is only appropriate when
mongotandmongodrun on the same host. To configure TLS, see Configure TLS Encryption formongot.
logging.logPathを使用して、mongotが書き込むログファイルのパスを指定します。ログファイルのパスを指定しない場合、mongotは標準出力にログを出力します。
Verify the health of the mongot process.
To verify, send a request by using a HTTP client or curl to the /health endpoint. For example, send a curl request similar to the following sample request:
curl localhost:8080/health
エンドポイントは、応答として次のいずれかを返します。
SERVING,mongotプロセスが実行中の場合mongotインデックスのステータスをチェックしないため、クエリを処理できない可能性があります。クエリを処理するには、インデックスがReady状態である必要があります。NOT_SERVING,mongotプロセスが実行されていない場合
詳細については、mongot 接続を確認するを参照してください。
MongoDB Search とMongoDB ベクトル検索をアンインストールする
MongoDB Search と MongoDB ベクトル検索をシステムから削除するには、mongot、構成ファイル、データとログを含むすべてのディレクトリを削除する必要があります。次のセクションで必要な手順をご案内します。
Drop the mongotUser user
mongotUser ユーザーを削除するには、次のコマンドを実行します。
use admin db.dropUser("mongotUser")
For details, see db.dropUser().
ログとログディレクトリをすべて削除します。 mongot
mongot のログとログディレクトリを削除するには、logging.logPath で指定したログディレクトリへのフルパスを使用して次のコマンドを実行します。
rm -rf /path/to/mongot-logs
次のステップ
Create MongoDB Search indexes