Install mongot¶
Before deploying Percona Search for MongoDB, ensure that you have:
- Percona Server for MongoDB 8.3 or later, installed as an initiated replica set.
- Administrative privileges to install and configure
mongot. - The
mongotbinary installed on the host. - Write access to the search data and log directories for the user that runs
mongot. - Network connectivity from the
mongothost to the replica set.
Note
The examples in this section use a single-node test environment with mongod listening on port 27017 and mongot listening on port 27028. Replace the host names, ports, paths, and credentials with values that are applicable for your deployment.
Additional requirements depend on the installation method:
-
Tarballs - An initiated replica set with keyfile access control or sharded deployment.
mongoshinstalled on the host. -
Docker - Docker engine with Compose v2 installed on the host.
For more information, see Vector Search compatibility.
Procedure¶
Install mongot from tarballs¶
Follow these steps to install mongot from a tarball:
-
Download the
mongottarball.Download the ARM64 tarball .
Download the AMD64 tarball .
-
Extract the tarball.
tar -zxvf percona-search-mongodb-1.70.3-linux_aarch64.tar.gztar -zxvf percona-search-mongodb-1.70.3-linux_x86_64.tar.gzThe extracted archive contains the
mongotbinary, the sample configuration file, themongotlauncher script, and the Percona Search for MongoDB license files. -
Configure
mongodto communicate withmongot.Configure the following
mongodstartup parameters.Parameter Description searchIndexManagementHostAndPortSpecifies the host and port of the mongotservice used for search index management operations.mongotHostSpecifies the host and port of the mongotservice used to process search queries. This value must matchsearchIndexManagementHostAndPort.skipAuthenticationToSearchIndexManagementServerEnables or disables authentication between mongodandmongotfor search index management operations.useGrpcForSearchEnables or disables gRPC communication between mongodandmongot.Example:
mongodconfigurationsetParameter: searchIndexManagementHostAndPort: localhost:27028 mongotHost: localhost:27028 skipAuthenticationToSearchIndexManagementServer: false useGrpcForSearch: trueThese are startup parameters. Restart
mongodfor the changes to take effect.sudo systemctl restart mongod -
Create a user for the
mongotprocess.mongotconnects to your Percona Server for MongoDB deployment by using a user with thesearchCoordinatorrole.-
Connect to
mongoshas an administrator.mongosh --port 27017 -u <admin-username> -p <admin-password> -
Switch to the
admindatabase.use admin -
Create the
mongotuser.Replace:
<mongot-username>with the username for themongotuser.<mongot-password>with the password that you save in the password file in the next step.
Then run:
db.createUser({ user: "<mongot-username>", pwd: "<mongot-password>", roles: ["searchCoordinator"] })
-
-
Create the password file.
sudo mkdir -p /etc/mongot echo -n "<mongot-password>" | sudo tee /etc/mongot/mongot.passwd > /dev/null sudo chmod 600 /etc/mongot/mongot.passwd sudo chown mongod:mongod /etc/mongot/mongot.passwd -
Prepare the required directories.
sudo mkdir -p /var/lib/mongot /etc/mongot /opt/mongot sudo chown -R mongod:mongod /var/lib/mongot /etc/mongot /opt/mongot sudo chmod 750 /etc/mongot -
Create the
mongotconfiguration file.The tarball includes a sample configuration file named
config.default.yml. Modify it as needed for your deployment.Example:
config.default.ymlsyncSource: replicaSet: hostAndPort: localhost:27017 username: <mongot-username> passwordFile: /etc/mongot/mongot.passwd tls: false storage: dataPath: /var/lib/mongot server: grpc: address: localhost:27028 tls: mode: disabled metrics: enabled: true address: localhost:9946 healthCheck: address: localhost:8080 logging: verbosity: INFONote
The user running
mongotmust have write access to the directory specified bystorage.dataPath.For the complete list of configuration options, see the upstream mongot configuration options documentation.
-
Copy the extracted files to the installation directory.
sudo cp -a percona-search-mongodb/* /opt/mongot/ sudo chown -R mongod:mongod /opt/mongot -
Create the
systemdservice.Create the following file:
/etc/systemd/system/mongot.service[Unit] Description=MongoDB Search (mongot) Documentation=https://www.mongodb.com/docs/manual/reference/configuration-options/#std-label-mongot-configuration-options After=network.target [Service] User=mongod Group=mongod Type=simple ExecStart=/opt/mongot/mongot --config /etc/mongot/config.yml Restart=on-failure RestartSec=5 LimitNOFILE=64000 TimeoutStartSec=30 TimeoutStopSec=30 SuccessExitStatus=143 [Install] WantedBy=multi-user.target -
Set the required file permissions and SELinux contexts.
sudo chown mongod:mongod /etc/mongot/config.yml sudo chmod 600 /etc/mongot/config.yml sudo restorecon -Rv /opt/mongot -
Enable and start
mongot.sudo systemctl daemon-reload sudo systemctl enable mongot sudo systemctl start mongot -
Verify that
mongotis running.curl localhost:8080/healthExample output:
{"status":"SERVING"}
Install Vector Search with Docker¶
Important
mongotsynchronizes data frommongodand requires a PSMDB replica set. Standalone deployments are not supported.
Follow these steps to install and configure mongot using Docker:
-
Pull the
mongodDocker image.docker pull percona/percona-server-mongodb:<TAG> -
Pull the
mongotDocker image.docker pull percona/percona-server-mongodb-mongot:<TAG> -
Verify the downloaded images.
docker image ls | grep percona-server-mongodb -
Create a Docker network.
The
mongodandmongotcontainers must run on the same Docker network so that they can communicate using their container names. Use the same<network-name>value when you start both containers.Replacedocker network create <network-name><network-name>with a name for the network, for examplepsmdb-search. -
Create the password file for the
mongotuser.mongotreads the password for its database user from a file. Create the file and restrict its permissions. The-noption prevents a trailing newline from being written to the file, which would otherwise become part of the password:echo -n "<mongot-password>" > mongot-password.txt chmod 400 mongot-password.txtReplace
<mongot-password>with a password of your choice. You use the same password when you create themongotdatabase user in step 9. -
Create the
mongodconfiguration file.Save the following configuration as
mongod.conf.net: port: 27017 bindIpAll: true replication: replSetName: rs0 setParameter: searchIndexManagementHostAndPort: mongot:27028 mongotHost: mongot:27028 skipAuthenticationToSearchIndexManagementServer: false useGrpcForSearch: true searchTLSMode: disabledThe
mongot:27028address consists of the Docker container name and the gRPC port exposed by themongotcontainer. Specify the same value for bothsearchIndexManagementHostAndPortandmongotHost. -
Start
mongod.Replace:
<path-to-data-db>with the path to the MongoDB data directory.<path-to-mongod-conf>with the path to themongod.conffile.<network-name>with the Docker network created in step 4.
docker run --rm \ --name mongod \ -v <path-to-mongod-conf>:/etc/mongod.conf:ro \ -v <path-to-data-db>:/data/db \ -p 27017:27017 \ --network <network-name> \ percona/percona-server-mongodb:<TAG> \ --config /etc/mongod.confThe container name
mongodbecomes the hostname used bymongotto connect to the database. If you change the container name, update thesyncSource.replicaSet.hostAndPortvalue in themongotconfiguration file.To view the server logs:
docker logs -f mongod -
Initiate the replica set.
Connect to the running container:
docker exec -it mongod mongosh --port 27017Initialize the replica set:
rs.initiate()Wait until the node becomes the primary replica set member before continuing.
-
Create the
mongotuser.mongotrequires a database user with thesearchCoordinatorrole.The
searchCoordinatorrole grantsreadAnyDatabaseprivileges and write access to the internal__mdb_internal_searchdatabase, whichmongotuses to store search index metadata.-
Switch to the
admindatabase.use admin -
Create the user.
Replace:
<mongot-username>with the username for themongotuser.<mongot-password>with the password stored inmongot-password.txt.
db.createUser({ user: "<mongot-username>", pwd: "<mongot-password>", roles: ["searchCoordinator"] })
-
-
Create the
mongotconfiguration file.Important
Set
syncSource.replicaSet.scramAuth.usernameto the user created in the previous step, andsyncSource.replicaSet.scramAuth.passwordFileto the password file created in step 5.For more information about the available configuration options, see the upstream documentation for mongot configuration options .
Example:
mongot.confsyncSource: replicaSet: hostAndPort: "mongod:27017" scramAuth: username: "mongotUser" passwordFile: "/passwordFile" authSource: "admin" tls: enabled: false replicationReader: readPreference: "secondaryPreferred" storage: dataPath: "/data/mongot" server: grpc: address: "mongot:27028" tls: mode: "disabled" metrics: enabled: true address: "mongot:9946" healthCheck: address: "mongot:8080" logging: verbosity: INFOSave the configuration file as
mongot.conf.The
mongodandmongotcontainers must run on the same Docker network.Ensure that:
scramAuth.usernamematches the user created in step 9.passwordFilepoints to the password file created in step 5.
The
mongotcontainer reads its configuration from/mongot-community/config.default.yml, which is mounted in the next step. -
Start the
mongotcontainer.Replace:
<path-to-data-mongot>with the directory used to store search index data.<path-to-mongot-conf>with the path to themongot.conffile.<path-to-password-file>with the path to the password file.<network-name>with the Docker network created in step 4.
docker run --rm \ --name mongot \ -v <path-to-data-mongot>:/data/mongot \ -v <path-to-mongot-conf>:/mongot-community/config.default.yml:ro \ -v <path-to-password-file>:/passwordFile:ro \ --network <network-name> \ percona/percona-server-mongodb-mongot:<TAG>To view the
mongotlogs:docker logs -f mongot -
Verify the health of the
mongotprocess.Send a request to the readiness endpoint.
docker exec mongot -- curl localhost:8080/healthIf
mongotstarts successfully, the endpoint returns:SERVING
Install mongot on RHEL and derivatives¶
Follow these steps to install mongot using the Percona RPM repository:
-
Install the Percona repository.
sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -
Enable the Percona Search for MongoDB repository.
sudo percona-release enable ps4m release -
Install
mongot.sudo yum install percona-search-mongodb
After installing the package, continue with step 3 in the Tarballs tab to configure mongod and mongot.
Install mongot on Debian and Ubuntu¶
Follow these steps to install mongot using the Percona APT repository:
-
Install the Percona repository.
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb sudo apt install ./percona-release_latest.$(lsb_release -sc)_all.deb -
Enable the Percona Search for MongoDB repository.
sudo percona-release enable ps4m release -
Install
mongot.sudo apt install percona-search-mongodb
After installing the package, continue with step 3 in the Tarballs tab to configure mongod and mongot.