Para agentes de IA: um índice de documentação está disponível em https://www.mongodb.com/pt-br/docs/llms.txt — as versões de markdown de todas as páginas estão disponíveis anexando .md a qualquer caminho de URL.
Menu Docs

Install or Uninstall mongot on Linux

Você pode instalar o processo MongoDB Search e MongoDB pesquisa vetorial, mongot, no MongoDB Community Edition. O processo mongot está disponível para implantação para todas as distribuições Linux, como Red Hat, Ubuntu, Debian, SUSE e Amazon Linux, como um tarball com a extensão .tgz.

Observação

Para integrar rapidamente uma implantação para experimentação, consulte os seguintes tutoriais para implantações autogerenciadas:

Para instalar o mongot em uma implantação autogerenciada, você deve ter os seguintes pré-requisitos:

  • MongoDB Community Edition v8.3 ou posterior.

    See Install MongoDB Community Edition for installation tutorials.

    Observação

    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.

  • Um conjunto de réplicas iniciadas com controle de acesso ao arquivo-chave.

1

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
2

Consulte Verificar a integridade dos pacotes mongot para obter mais informações.

3

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

Observação

Se o seu navegador descompactar automaticamente o arquivo como parte das transferências, a extensão do arquivo será .tar.

O tarball contém um arquivo de configuração de exemplo, o script do iniciador do mongot e informações de licença do MongoDB Search e da pesquisa vetorial.

4

Se você tiver um conjunto de réplica existente que deseja usar, configure os parâmetros mongod a seguir para rotear as queries do Search e do MongoDB Vector Search e gerenciar índices.

Parâmetro
Descrição

searchIndexManagementHostAndPort

O endereço do host de mongot.

mongotHost

O endereço do host de mongot.

Você deve especificar o mesmo endereço em searchIndexManagementHostAndPort e mongotHost.

skipAuthenticationToSearchIndexManagementServer

Especifica se a autenticação está habilitada para o servidor de gerenciamento de índice de pesquisa

useGrpcForSearch

Especifica se o RGPC está ativado para o MongoDB Search

Por exemplo, você pode adicionar as seguintes linhas ao seu arquivo de configuração do mongod e então reiniciar o 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.

Observação

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.

5

mongot must be able to connect to your MongoDB deployment through a user with the searchCoordinator role.

  1. Conecte-se a mongosh como usuário administrador.

    mongosh --port 27017 -u <your_admin_username> -p <your_admin_password>
  2. Conecta-se ao banco de dados admin.

    Execute o seguinte comando para conectar ao banco de dados do admin :

    use admin
  3. Crie seu usuário mongot .

    Para criar um usuário com a função searchCoordinator:

    • Substitua <mongot-username> por um nome de usuário para o seu usuário mongot

    • Substitua <mongot-password> pela senha que você especificar em seu passwordFile na próxima etapa

    • Execute o seguinte comando:

    db.createUser(
    {
    user: <mongot-username>,
    pwd: <mongot-password>,
    roles: [ "searchCoordinator"]
    }
    )
6

Crie um arquivo de senha para mongot se conectar a mongod.

Por exemplo, selecione seu sistema operacional e substitua <mongot-password> por sua senha. Em seguida, execute o seguinte comando para criar um arquivo chamado passwordFile:

echo -n "<mongot-password>" > passwordFile
chmod 400 passwordFile

Observação

O sinalizador -n impede uma nova linha à direita.

echo|set /p="mongotPassword" > passwordFile
[System.IO.File]::WriteAllText("passwordFile", "mongotPassword")
7

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.

O tarball contém o seguinte arquivo de configuração de amostra, config.default.yml, com as configurações padrão do mongot. Você pode modificar as configurações do seu sistema:

Aviso

Dependendo da topologia do sistema, pode ser necessário vincular o servidor de query do mongot a uma interface acessível a partir do Cluster MongoDB. Embora a vinculação ao endereço IP 0.0.0.0 seja permitida, ela expõe o servidor a todas as redes públicas e acarreta o risco de acesso não autorizado.

Para aumentar a segurança, considere restringir server.grpc.address a interfaces específicas que sejam controladas e protegidas na camada de rede, como localhost ou outros endereços internos confiáveis.

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

Observação

O diretório dataPath no seu arquivo de configuração deve ser gravável pelo usuário que executa 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.address to a network interface that mongod can reach, rather than localhost.

  • Set the mongod mongotHost and searchIndexManagementHostAndPort parameters to that address.

  • Enable TLS for the sync source and gRPC connections. Running without TLS is only appropriate when mongot and mongod run on the same host. To configure TLS, see Configure TLS Encryption for mongot.

Use logging.logPath para especificar o caminho do arquivo de log que mongot grava. Se você não especificar um caminho de arquivo de log, mongot fará o log para a saída padrão.

8

Execute o script do iniciador mongot que você baixou com o tarball. O roteiro está na pasta mongot-community.

Alterar para a pasta mongot-community:

cd <path-to-mongot>

Para iniciar o mongot com o arquivo de configuração de amostra, emita o seguinte comando:

./mongot --config config.default.yml
9

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

O endpoint retorna uma das seguintes opções na resposta:

  • SERVING, se o processo mongot estiver em execução

    mongot pode não servir queries, pois não verifica o status dos índices, que devem estar no estado Ready para servir queries.

  • NOT_SERVING, se o processo mongot não estiver em execução

Para obter detalhes adicionais, consulte Verifique sua conexão mongot.

Para remover o MongoDB Search e o MongoDB pesquisa vetorial de um sistema, você deve remover mongot, os arquivos de configuração e quaisquer diretórios contendo dados e logs. A seção a seguir orienta você nas etapas necessárias.

1

Para soltar o usuário do mongotUser, execute os seguintes comandos:

use admin
db.dropUser("mongotUser")

For details, see db.dropUser().

2

Para interromper o binário mongot, use Ctrl + C na sessão do terminal em que ele está sendo executado.

3

Para remover os arquivos de configuração mongot e mongod, execute os seguintes comandos como root ou com sudo usando o caminho completo para seus arquivos de configuração:

sudo rm /path/to/config.default.yml
sudo rm /path/to/mongod.conf
4

Para remover o arquivo de chave e o arquivo de senha, execute os seguintes comandos usando o caminho completo para o arquivo de chave e o arquivo de senha:

rm /path/to/keyfile
rm /path/to/passwordFile
5

Para remover os logs e o diretório de logs do mongot, execute o seguinte comando usando o caminho completo para o diretório de logs especificado em logging.logPath:

rm -rf /path/to/mongot-logs
6

Para remover o diretório de dados que armazena dados mongot, execute o seguinte comando usando o caminho completo para o diretório de dados mongot :

rm /path/to/mongot/data