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

Docker 컨테이너에 Community의 MongoDB Search 설치 또는 제거

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

참고

실험용 배포서버로 더 빠르게 온보딩하려면 MongoDB Search 및 MongoDB 벡터 검색 지역 개발 빠른 시작을 참조하세요.

중요

mongot mongod 에서 데이터를 동기화하며 MongoDB 복제본 세트가 필요합니다. 독립형 mongod 배포서버는 mongot를 지원하지 않습니다.

mongot를 배포하기 전에 다음 단계를 완료하세요.

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

  2. MongoDB Vector Search가 컬렉션의 텍스트 데이터에 대한 임베딩을 자동으로 생성하도록 하려면 엔드포인트 서비스 API 키를 생성하세요. 자세한 내용은 자동 임베딩을(를) 참조하세요.

    중요

    자동 임베딩이 미리 보기로 제공됩니다. 기능 및 해당 설명서는 미리 보기 기간에 언제든지 변경될 수 있습니다. 자세히 학습 미리 보기 기능을 참조하세요.

    아직 키가 없는 경우 Atlas UI에서 엔드포인트 서비스 API 키를 생성합니다. 두 개의 Atlas 프로젝트에서 인덱스 시간에 임베딩을 생성하기 위한 키와 쿼리 시간에 임베딩을 생성하기 위한 키를 각각 생성하는 것이 좋습니다.

    참고

    임베딩을 생성하기 위한 제공자 엔드포인트는 Atlas UI 에서 API 키를 생성하는지, 아니면 Voyage AI 에서 직접 생성하는지에 따라 달라집니다.

경고

이 절차는 액세스 제어를 활성화하지 않는 최소한 및 안전하지 않은 기본값 구성을 제공합니다. 이 단계는 로컬 실험용으로만 사용할 수 있는 배포를 만듭니다.

이러한 컨테이너를 노출하고 설정을 생산에 사용하기 전에 배포서버를 보안하려면 다음 리소스를 참조하세요.

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

참고

온프레미스 배포서버에서 MongoDB Search를 사용하려면 최소 MongoDB 8.2+ 이상이 있어야 합니다. 자세한 내용은 MongoDB Search 호환성을 참조하세요.

Docker 사용하여 MongoDB 설치하는 방법에 대한 자세한 내용은 Docker 로 MongoDB Community 설치를 참조하세요.

4

Create a password file for mongot to connect to mongod. Select your operating system and run the command:

Replace <mongot_password> with your password and run the following command to create a file called passwordFile in your current directory:

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

Replace <mongot_password> with your password and run the following command to create a file called passwordFile inside a Docker-managed named volume called mongot-secrets. You reference this volume instead of a host path when you start mongot in a later step.

docker volume create mongot-secrets
docker run --rm -v mongot-secrets:/secrets busybox sh -c "echo -n '<mongot_password>' > /secrets/passwordFile && chmod 400 /secrets/passwordFile"

On Windows, a bind-mounted host file does not preserve Unix permission bits inside a Linux container. Docker Desktop's file-sharing layer overrides the permissions that you set on the NTFS side, and Windows has no native chmod equivalent. The throwaway container in the preceding command sets the permissions correctly on the Linux side.

참고

-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을(를) 시작하려면 다음을 수행합니다.

  • </path/to/data/db> 를 마운트된 볼륨의 로컬 디렉토리 경로 바꾸십시오.

  • </path/to/mongod.conf> 을 위에서 만든 구성 파일의 경로로 바꿉니다.

  • On Windows, replace the backslash (\) at the end of each line with the line continuation character for your shell. Command Prompt uses a caret (^), and PowerShell uses a backtick.

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

Run the following command to connect to the mongod instance you started on port 27017:

docker exec -it mongod mongosh --port 27017
8

mongot searchCoordinator 역할이 있는 사용자를 통해 MongoDB deployment 에 연결할 수 있어야 합니다.

다음 명령을 실행하여 admin 데이터베이스 에 연결합니다.

use admin

searchCoordinator 역할 가진 사용자를 만들려면 다음을 수행합니다.

  • <mongot_username>mongot 사용자의 사용자 이름으로 바꾸십니다.

  • <mongot_password> 를 4단계의 passwordFile 에 지정한 비밀번호로 바꿉니다.

  • 다음 명령을 실행합니다:

db.createUser(
{
user: "<mongot_username>",
pwd: "<mongot_password>",
roles: [ "searchCoordinator" ]
}
)

사용자 생성에 대한 자세한 내용은 자체 관리 배포서버에서 사용자 생성을 참조하세요.

9

YAML 구성 파일 사용하여 mongot 를 구성할 수 있습니다. 이전 단계에서 지정한 사용자 이름 syncSource.replicaSet.scramAuth.username(으)로 지정해야 합니다. 또한 이전 단계에서 생성한 passwordFilesyncSource.replicaSet.scramAuth.passwordFile로 지정해야 합니다.

mongot 구성 옵션에 대한 자세한 내용은 mongot 옵션을 참조하세요.

예시 들어 아래와 같이 로컬 구성에 맞게 설정을 조정할 수 있습니다.

# 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

To start the Search in Community binary (mongot), select your operating system and run the command:

  • </path/to/data/mongot>mongot 데이터를 저장할 마운트된 볼륨의 로컬 디렉토리 경로로 바꾸십시오.

  • </path/to/mongot.conf> 을 이전 단계에서 생성한 mongot 구성 파일 의 경로로 바꿉니다.

  • Replace </path/to/passwordFile> with the path to the password file that you created.

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
  • </path/to/data/mongot>mongot 데이터를 저장할 마운트된 볼륨의 로컬 디렉토리 경로로 바꾸십시오.

  • </path/to/mongot.conf> 을 이전 단계에서 생성한 mongot 구성 파일 의 경로로 바꿉니다.

  • Set syncSource.replicaSet.scramAuth.passwordFile in your mongot configuration file to "/secrets/passwordFile" instead of "/passwordFile". The command mounts the mongot-secrets volume that you created in step 4 at /secrets in the container.

  • In PowerShell, replace each caret (^) with a backtick. The command uses the caret (^) line continuation character for Command Prompt.

docker run --rm ^
--name mongot-community ^
-v </path/to/data/mongot>:/data/mongot ^
-v </path/to/mongot.conf>:/mongot-community/config.default.yml ^
-v mongot-secrets:/secrets:ro ^
--network search-community ^
-p 8080:8080 ^
-p 9946:9946 ^
mongodb/mongodb-community-search:latest

이 명령은 다음을 수행합니다.

  • 볼륨을 마운트합니다.

  • 로컬 볼륨에서 구성 파일 마운트합니다.

  • 포트 범위 지정합니다.

  • 지표 포트를 노출합니다.

  • 이름이 mongot-community인 컨테이너 사용하여 search-community Docker 네트워크에서 컨테이너 시작합니다.

11

확인하려면 HTTP 클라이언트 또는 curl 를 사용하여 /health 엔드포인트로 요청을 보냅니다. 예를 들어 다음 샘플 요청과 유사한 curl 요청을 보냅니다.

curl localhost:8080/health

엔드포인트는 응답에서 다음 중 하나를 반환합니다.

  • SERVINGmongot 프로세스가 실행 중인 경우

    mongot 인덱스의 상태를 확인하지 않으므로 쿼리를 제공하지 않을 수 있으며, 쿼리를 제공하려면 인덱스는 Ready 상태여야 합니다.

  • NOT_SERVINGmongot 프로세스가 실행 중이 아닌 경우

자세한 내용은 mongot 연결 확인을 참조하세요.

시스템에서 MongoDB Search 및 MongoDB Vector Search를 완전히 제거하려면 컨테이너 이미지, 구성 파일, 데이터 또는 로그 디렉토리를 제거해야 합니다. 다음 섹션에서는 필요한 단계를 안내합니다.

1

mongot 사용자를 제거하려면 <mongot_username>mongot에 대해 만든 사용자 이름으로 바꾸고 다음 명령을 실행합니다.

use admin
db.dropUser("<mongot_username>")

자세한 내용은 db.dropUser()를 참조하십시오.

2

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

3

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

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

비밀번호 파일의 전체 경로를 사용하여 다음 명령을 실행하여 비밀번호 파일을 제거합니다.

rm /path/to/passwordFile
5

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

rm /path/to/mongot/data