참고
MongoDB Atlas
MongoDB Atlas is a hosted MongoDB service option in the cloud which requires no installation overhead and offers a free cluster to get started.
개요
이 튜토리얼을 통해 다운로드한 .tgz tarball 파일을 사용하여 Ubuntu Linux의 LTS(장기 지원) 릴리스에 MongoDB 7.0 Community Edition을 수동으로 설치합니다.
MongoDB 버전
이 튜토리얼에서는 MongoDB 7.0 Community 에디션을 설치합니다. 다른 버전의 MongoDB Community를 설치하려면 페이지 왼쪽 상단의 버전 드롭다운 메뉴에서 해당 버전에 대한 문서를 선택할 수 있습니다.
설치 방법
이 문서 에 설명된 대로 다운로드한 .tgz tarball을 사용하여 MongoDB 수동으로 설치할 수 있지만 가능하면 시스템에서 apt 패키지 관리자를 사용하는 것이 좋습니다. 패키지 관리자를 사용하면 필요한 모든 종속성이 자동으로 설치되고, 예시 mongod.conf 파일 제공되며, 향후 업그레이드 및 유지 관리 작업이 간소화됩니다.
➤ apt 패키지 관리자를 이용한 MongoDB 설치를 참고합니다.
고려 사항
MongoDB Shell mongosh
.tgz 패키지를 사용하여 서버를 설치하는 경우 mongosh 설치 지침에 따라 mongosh를 별도로 다운로드하여 설치해야 합니다.
플랫폼 지원
MongoDB 7.0 Community Edition은 x86_64 아키텍처에서 다음 64비트 Ubuntu LTS(장기 지원) 릴리스를 지원합니다:
22.04 LTS ('Jammy')
20.04 LTS ("Focal")
MongoDB는 이러한 플랫폼의 64비트 버전만 지원합니다. 호스트에서 실행 중인 Ubuntu 릴리스를 확인하려면 호스트의 터미널에서 다음 명령을 실행합니다.
cat /etc/lsb-release
Ubuntu의 MongoDB 7.0 커뮤니티 에디션은 일부 플랫폼에서 ARM64 아키텍처도 지원합니다.
자세한 정보는 플랫폼 지원에서 확인할 수 있습니다.
프로덕션 정보
프로덕션 환경에 MongoDB 배포하기 전에 자체 관리형 배포서버에 대한 프로덕션 노트 문서에서 성능 고려 사항 및 구성 권장 사항을 확인하세요.
MongoDB Community Edition 설치
전제 조건
다음 명령을 사용하여 MongoDB Community .tgz tarball에 필요한 종속성을 설치합니다.
sudo apt-get install libcurl4 libgssapi-krb5-2 libldap-2.5-0 libwrap0 libsasl2-2 libsasl2-modules libsasl2-modules-gssapi-mit openssl liblzma5
sudo apt-get install libcurl4 openssl liblzma5
절차
다음 단계에 따라 .tgz에서 MongoDB Community Edition을 수동으로 설치합니다.
(선택 사항) PATH에 바이너리가 있는지 확인합니다.
MongoDB 바이너리는 tarball의 bin/ 디렉터리에 있습니다. 다음 방법 중 하나를 선택할 수 있습니다.
바이너리를
PATH변수에 나열된 디렉토리(예:/usr/local/bin에 복사합니다 (적절한 설치 디렉토리로/path/to/the/mongodb-directory/를 업데이트하세요).sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/ PATH변수에 나열된 디렉토리 (예:/usr/local/bin)에서 바이너리에 대한 심볼릭 링크를 만듭니다 (적절한 설치 디렉터리로/path/to/the/mongodb-directory/를 업데이트하세요).sudo ln -s /path/to/the/mongodb-directory/bin/* /usr/local/bin/
(선택 사항) MongoDB Shell (mongosh)을 설치합니다.
설치 mongosh 그 다음 MongoDB Shell을 사용하여 배포서버에 연결합니다.
Download the package for the version of mongosh you need from the MongoDB Download Center and uncompress the package.
MongoDB Community Edition 실행
ulimit 고려 사항
Unix 계열 운영 체제는 대부분 프로세스가 사용할 수 있는 시스템 리소스를 제한합니다. 이러한 제한은 MongoDB 작동에 부정적인 영향을 미칠 수 있으므로 조정해야 합니다. 플랫폼에 권장되는 설정은 자체 관리형 배포에 대한 UNIX ulimit 설정을 참조하세요.
참고
열려 있는 파일 수의 ulimit 값이 64000 미만인 경우 MongoDB가 시작 경고를 생성합니다.
구성
명령줄 옵션이나 구성 파일을 사용하여 데이터 디렉토리 및 로그 디렉토리 사양과 같은 MongoDB 인스턴스를 구성할 수 있습니다.
절차
다음 단계에 따라 MongoDB Community Edition을 실행합니다. 이 지침에서는 기본 설정을 사용한다고 가정합니다.
데이터 및 로그 디렉터리를 생성합니다.
MongoDB 인스턴스가 데이터를 저장하는 디렉토리를 생성합니다. 예시:
sudo mkdir -p /var/lib/mongo
MongoDB 인스턴스가 로그를 저장하는 디렉터리를 만듭니다. 예시:
sudo mkdir -p /var/log/mongodb
MongoDB 프로세스를 시작하는 사용자는 이러한 디렉토리에 대한 읽기 및 쓰기 권한을 반드시 보유해야 합니다. 예를 들어 MongoDB를 직접 실행하려면 다음이 필요합니다.
sudo chown `whoami` /var/lib/mongo # Or substitute another user sudo chown `whoami` /var/log/mongodb # Or substitute another user
MongoDB 사용을 시작합니다.
Start a mongosh session on the same host machine as the mongod. You can run mongosh without any command-line options to connect to a mongod that is running on your localhost with default port 27017.
mongosh
For more information on connecting using mongosh, such as to connect to a mongod instance running on a different host and/or port, see the mongosh documentation.
To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. For the driver documentation, see Start Developing with MongoDB.
추가 정보
기본 로컬 호스트 바인딩
By default, MongoDB launches with bindIp set to 127.0.0.1, which binds to the localhost network interface. This means that the mongod can only accept connections from clients that are running on the same machine. Remote clients will not be able to connect to the mongod, and the mongod will not be able to initialize a replica set unless this value is set to a valid network interface which is accessible from the remote clients.
이 값은 다음 중 한 가지 방법으로 구성할 수 있습니다.
경고
인스턴스를 공개적으로 접근 가능한 IP 주소에 바인딩하기 전에 무단 접근으로부터 클러스터를 보호해야 합니다. 보안 권장 사항의 전체 목록은 자체 관리 배포서버에 대한 보안 검사 목록을 참조하세요. 최소한 인증을 활성화하고 네트워크 인프라를 강화하는 것을 고려합니다.
bindIp 구성에 대한 자세한 내용 은 자체 관리 배포서버의 IP 바인딩을 참조하세요.