对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

Verify Your mongot Connection

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.

1

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.

# standalone mongot container
docker ps --filter "name=<mongot-container-name>"
# atlas-local
docker ps --filter "ancestor=mongodb/mongodb-atlas-local"

If mongot is active, this command returns the active container.

2

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 the mongot process is running.

  • {"status":"NOT_SERVING"}, if the mongot process 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 the mongot process is ready for queries.

  • {"status":"NOT_SERVING"}, if the mongot process isn't ready for queries.

3

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)"
4

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.

5

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.