AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

Install or Uninstall MongoDB Search on Community in a Docker Container

MongoDB Community Edition 에 검색 프로세스 mongot을(를) 설치할 수 있습니다. 검색 프로세스 Docker 에서 이미지로 배포서버 할 수 있습니다. mongot 프로세스 자체 임베딩 또는 자동 임베딩을 사용한 전체 텍스트 검색 및 시맨틱 검색 지원합니다.

참고

실험용 배포서버 더 빠르게 온보딩하려면 자체 관리형 배포서버에 대한 다음 튜토리얼을 참조하세요.

mongot를 배포 전에 다음 단계를 완료해야 합니다.

  1. Docker 및 Docker Compose를 설치합니다.

  2. 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:

1

mongot Docker 이미지를 가져오려면 다음 명령을 실행 .

docker pull mongodb/mongodb-community-search:latest

이미지가 Docker Desktop에 있는지 확인하려면 다음 명령을 실행 .

docker image ls mongodb/mongodb-community-search
2

데이터베이스 와 검색 컨테이너 간의 컨테이너 간 통신을 위한 Docker 네트워크를 만들려면 다음 명령을 실행 .

docker network create search-community
3

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 설치를 참조하세요.

4

mongod에 연결할 mongot 의 비밀번호 파일 만듭니다.

예시 들어 운영 체제를 선택하고 <mongot_password> 을(를) 비밀번호로 바꿉니다. 그런 다음, 다음 명령을 실행 passwordFile이라는 파일 만듭니다.

echo -n "<mongot_password>" > passwordFile
chmod 400 passwordFile

참고

-n 플래그는 후행 개행을 방지합니다.

5

구성 파일 만들려면 다음 코드를 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
6

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
7

다음 명령을 실행하여 포트 27017에서 시작한 mongod 인스턴스 에 연결하고, <your_admin_username><your_admin_password> 을 관리자용으로 생성한 사용자 이름 및 비밀번호로 바꿉니다.

docker exec -it mongod mongosh --port 27017
8

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 your mongot user.

  • <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.

9

YAML 구성 파일 사용하여 mongot 를 구성할 수 있습니다. 이전 단계에서 지정한 사용자 이름 syncSource.replicaSet.username(으)로 지정해야 합니다. 또한 이전 단계에서 생성한 passwordFilesyncSource.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 네트워크에서 실행 .

10

커뮤니티 바이너리에서 검색을 시작하려면 mongot를 실행합니다.

  • Replace </path/to/data/mongot> with the path to the local directory for the mounted volume to store mongot data.

  • </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-community Docker 네트워크에서 컨테이너 시작합니다.

11

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

    mongot might not serve queries as it doesn't check the status of the indexes, which must be in Ready state to serve queries.

  • NOT_SERVING, if the mongot process isn't running

For more information, see Verify Your mongot Connection.

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.

1

mongotUser 사용자를 삭제하려면 다음 명령을 실행 .

use admin
db.dropUser("mongotUser")

For details, see db.dropUser().

2

mongot 프로세스 중지하려면 Docker 에서 실행 컨테이너 이미지를 중지합니다.

3

mongotmongod 구성 파일을 제거 하려면 구성 파일의 전체 경로를 사용하여 다음 명령을 실행 .

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

To remove the password file, run the following commands using the full path to the password file:

rm /path/to/passwordFile
5

mongot 데이터를 저장하는 데이터 디렉토리 제거 하려면 mongot 데이터 디렉토리 의 전체 경로를 사용하여 다음 명령을 실행 .

rm /path/to/mongot/data