Use the tutorial on this page to verify that your mongot deployment is active and connected to your MongoDB Community deployment.
开始之前
Install MongoDB Community and MongoDB Search. For installation tutorials, see Install MongoDB Community Edition and Procedure.
步骤
Verify that your mongot instance is active.
To check the status of your mongot instance, run one of the following commands in your terminal, based on your installation method:
ps aux | grep '[m]ongot'
If mongot is active, this command returns the mongot process with a reference to your configuration file.
Verify the health of your mongot instance.
To check the health of your mongot instance, use the /health and /ready endpoints.
To check if mongot is live, curl against the /health endpoint:
注意
The default healthCheck address is localhost:8080. However, you can define the address in the healthCheck.address option in your mongot configuration file.
curl localhost:8080/health
The endpoint returns one of the following responses:
{"status":"SERVING"}, if themongotprocess is running.{"status":"NOT_SERVING"}, if themongotprocess isn't running.
To check if mongot is ready for queries, curl against the /ready endpoint:
curl localhost:8080/ready
The endpoint returns one of the following responses:
{"status":"SERVING"}, if themongotprocess is ready for queries.{"status":"NOT_SERVING"}, if themongotprocess isn't ready for queries.
Check mongot Prometheus metrics.
If you enabled the Prometheus metrics endpoint in your mongot configuration file, curl the /metrics endpoint to retrieve process-level metrics:
curl localhost:9946/metrics
注意
The default metrics address is localhost:9946. To use a different address, set the metrics.address option in your mongot configuration file.
To view the state of search index replication, filter for the mongot_replication_mongodb_indexManagerState metric:
curl -s localhost:9946/metrics | grep -E \ "^(# (HELP|TYPE) mongot_replication_mongodb_indexManagerState|mongot_replication_mongodb_indexManagerState)"
Verify that index management is active.
To verify that index management is active, run a search index management method against any collection.
For example, the following command checks if any search indexes exist on a movies collection:
db.movies.getSearchIndexes()
If the operation succeeds without an error, index management is functional.
Run a search query.
Run an end-to-end search query to confirm that the full query path is functional.
For example, create a test collection with a search index:
db.test.insertMany([ { name: "alpha" }, { name: "beta" }, { name: "alphabet" } ]) db.test.createSearchIndex( "verify-index", { mappings: { dynamic: true } } )
Verify that MongoDB builds the index:
db.test.getSearchIndexes()
The index is ready for queries if the command returns the following response:
status: 'READY', queryable: true,
Then, run a search query:
db.test.aggregate([ { $search: { index: "verify-index", text: { query: "alpha", path: "name" } } } ])
A successful query confirms that you configured mongod and mongot correctly.
For troubleshooting your mongot and mongod connection, see Troubleshoot MongoDB Search for Self-Managed Deployments.
后续步骤
Create MongoDB Search indexes.