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:
Antes de começar
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.
Procedimento
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
(opcional). Verifique a integridade do pacote tarball.
Consulte Verificar a integridade dos pacotes mongot para obter mais informações.
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
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.
Configure mongod to communicate with mongot.
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 |
|---|---|
| O endereço do host de |
| O endereço do host de Você deve especificar o mesmo endereço em |
| Especifica se a autenticação está habilitada para o servidor de gerenciamento de índice de pesquisa |
| 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.
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.
Conecte-se a
mongoshcomo usuário administrador.mongosh --port 27017 -u <your_admin_username> -p <your_admin_password> Conecta-se ao banco de dados
admin.Execute o seguinte comando para conectar ao banco de dados do
admin:use admin 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áriomongotSubstitua
<mongot-password>pela senha que você especificar em seupasswordFilena próxima etapaExecute o seguinte comando:
db.createUser( { user: <mongot-username>, pwd: <mongot-password>, roles: [ "searchCoordinator"] } )
Crie seu arquivo de senha.
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")
Especifique suas opções de configuração do 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.
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.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.
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.
Inicie o processo de mongot.
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
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
O endpoint retorna uma das seguintes opções na resposta:
SERVING, se o processomongotestiver em execuçãomongotpode não servir queries, pois não verifica o status dos índices, que devem estar no estadoReadypara servir queries.NOT_SERVING, se o processomongotnão estiver em execução
Para obter detalhes adicionais, consulte Verifique sua conexão mongot.
Desinstalar o MongoDB Search e o MongoDB Vector Search
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.
Drop the mongotUser user
Para soltar o usuário do mongotUser, execute os seguintes comandos:
use admin db.dropUser("mongotUser")
For details, see db.dropUser().
Remova todos os logs e o diretório de logs de mongot
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