MongoDB Community Edition 에 검색 프로세스 mongot을(를) 설치할 수 있습니다. 검색 프로세스 Docker 에서 이미지로 배포서버 할 수 있습니다. mongot 프로세스 자체 임베딩 또는 자동 임베딩을 사용한 전체 텍스트 검색 및 시맨틱 검색 지원합니다.
Install MongoDB Search and Vector Search with Docker
참고
실험용 배포서버 더 빠르게 온보딩하려면 자체 관리형 배포서버에 대한 다음 튜토리얼을 참조하세요.
시작하기 전에
mongot를 배포 전에 다음 단계를 완료해야 합니다.
Docker 및 Docker Compose를 설치합니다.
If you want MongoDB Vector Search to automatically generate embeddings for text data in your collection, create endpoint service API keys. To learn more, see Automated Embedding.
중요
자동 임베딩이 미리 보기로 제공됩니다. 기능 및 해당 설명서는 미리 보기 기간에 언제든지 변경될 수 있습니다. 자세히 학습 미리 보기 기능을 참조하세요.
If you don't already have the keys, create the endpoint service API keys from the Atlas UI. We recommend that you create two keys, one for generating embeddings at index-time and another for generating embeddings at query-time, from two Atlas projects.
참고
임베딩을 생성하기 위한 제공자 엔드포인트는 Atlas UI 에서 API 키를 생성하는지, 아니면 Voyage AI 에서 직접 생성하는지에 따라 달라집니다.
절차
경고
This procedure provides a simple and insecure default configuration that does not enable access control. The steps create a deployment intended for local experimentation only.
Before exposing these containers and using your setup in production, see the following resources to secure your deployment:
Download the MongoDB Docker image.
MongoDB Docker 이미지를 다운로드 하려면 다음 명령을 실행 .
docker pull mongodb/mongodb-community-server:latest
참고
You must have a minimum of MongoDB 8.2+ to use MongoDB Search with an on-prem deployment. For more information, see MongoDB Search Compatibility.
Docker 사용하여 MongoDB 설치하는 방법에 대한 자세한 내용은 Docker 로 MongoDB Community 설치를 참조하세요.
mongod 구성 파일 만듭니다.
구성 파일 만들려면 다음 코드를 mongod.conf 또는 원하는 위치 에 저장합니다.
# MongoDB Configuration File # Network configuration net: port: 27017 bindIpAll: true # Equivalent to --bind_ip_all # Replica set configuration replication: replSetName: rs0 # Search configuration parameters setParameter: # Server parameters to advise mongod of mongot availability for search index management and querying searchIndexManagementHostAndPort: mongot-community.search-community:27028 mongotHost: mongot-community.search-community:27028 skipAuthenticationToSearchIndexManagementServer: false useGrpcForSearch: true searchTLSMode: disabled
Start your mongod.
mongod을(를) 시작하려면 다음을 수행합니다.
Replace
<your_admin_username>with the username you want to specify for your admin user.Replace
<your_admin_password>with the password you want to specify for your admin user.Replace
</path/to/data/db>with the path to the local directory for the mounted volume.Replace
</path/to/mongod.conf>with the path to the configuration file you created above.
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 search-community \ mongodb/mongodb-community-server:latest \ --config /etc/mongod.conf \ --replSetMember=mongod.search-community:27017
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.
다음 명령을 실행하여 admin 데이터베이스 에 연결합니다.
use admin
searchCoordinator 역할 가진 사용자를 만들려면 다음을 수행합니다.
Replace
<your-mongot-username>with a username for yourmongotuser.<your-mongot-password>를 5단계의passwordFile에 지정한 비밀번호로 바꿉니다.다음 명령을 실행합니다:
db.createUser( { user: "<mongot_username>", pwd: "<mongot_password>", roles: [ "searchCoordinator" ] } )
For more information on creating users, see Create a User on Self-Managed Deployments.
검색 구성 옵션을 지정합니다.
YAML 구성 파일 사용하여 mongot 를 구성할 수 있습니다. 이전 단계에서 지정한 사용자 이름 syncSource.replicaSet.username(으)로 지정해야 합니다. 또한 이전 단계에서 생성한 passwordFile 를 syncSource.replicaSet.passwordFile로 지정해야 합니다.
For more information on mongot configuration options, see mongot Options.
예시 들어 아래와 같이 로컬 구성에 맞게 설정을 조정할 수 있습니다.
# mongot.conf syncSource: replicaSet: hostAndPort: "mongod.search-community:27017" scramAuth: username: "mongotUser" passwordFile: "/passwordFile" authSource: "admin" tls: enabled: false replicationReader: readPreference: "secondaryPreferred" storage: dataPath: "/data/mongot" server: grpc: address: "mongot-community.search-community:27028" tls: mode: "disabled" metrics: enabled: true address: "mongot-community.search-community:9946" healthCheck: address: "mongot-community.search-community:8080" logging: verbosity: INFO
파일 mongot.config 또는 원하는 파일 위치 에 저장합니다.
두 컨테이너 모두 동일한 search-community Docker 네트워크에서 실행 .
mongot 프로세스 시작합니다.
커뮤니티 바이너리에서 검색을 시작하려면 mongot를 실행합니다.
Replace
</path/to/data/mongot>with the path to the local directory for the mounted volume to storemongotdata.</path/to/mongot.conf>을 이전 단계에서 생성한mongot구성 파일 의 경로로 바꿉니다.</path/to/passwordFile>을(를) 생성한 비밀번호 파일 의 경로로 바꿉니다.
docker run --rm \ --name mongot-community \ -v </path/to/data/mongot>:/data/mongot \ -v </path/to/mongot.conf>:/mongot-community/config.default.yml \ -v </path/to/passwordFile>:/passwordFile:ro \ --network search-community \ -p 8080:8080 \ -p 9946:9946 \ mongodb/mongodb-community-search:latest
이 명령은 다음을 수행합니다.
볼륨을 마운트합니다.
로컬 볼륨에서 구성 파일 마운트합니다.
포트 범위 지정합니다.
지표 포트를 노출합니다.
이름이
mongot-community인 컨테이너 사용하여search-communityDocker 네트워크에서 컨테이너 시작합니다.
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
엔드포인트는 응답에서 다음 중 하나를 반환합니다.
SERVING, if themongotprocess is runningmongotmight not serve queries as it doesn't check the status of the indexes, which must be inReadystate to serve queries.NOT_SERVING, if themongotprocess isn't running
For more information, see Verify Your mongot Connection.
Uninstall MongoDB Search and MongoDB Vector Search with Docker
To completely remove MongoDB Search and MongoDB Vector Search from a system, remove the container image, the configuration files, and any data or log directories. The following section guides you through the necessary steps.
Drop the mongotUser user.
mongotUser 사용자를 삭제하려면 다음 명령을 실행 .
use admin db.dropUser("mongotUser")
For details, see db.dropUser().