> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ale.run/llms.txt
> Use this file to discover all available pages before exploring further.

# 데이터베이스 운영

> PostgreSQL, Redis, Qdrant 등 애플리케이션에 필요한 데이터베이스를 배포하고 서비스와 연결해 운영합니다.

> [card]
>
> 배포한 데이터베이스는 커넥터로 연동하여 AI로 활용할 수 있습니다. 자세한 내용은 [DB·벡터DB에서 데이터 조회](https://docs.ale.run/ko/database.md) 페이지를 참고하세요.

> [!TIP]
>
> 커넥터 연동 시 [TCP 외부 접속을 허용](https://docs.ale.run/ko/application-database.md#tcp)해 주세요.

## 데이터베이스 배포하기

![](https://files.cloudtype.io/ale-docs/developers/images/database-app01.png)

> 애플리케이션 메뉴의  또는 `⌘ + K`로 생성되는 배포 창에서, 배포할 데이터베이스를 선택한 후 표시되는 설정 필드값을 입력하세요.

> [accordion] 기본 설정값
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/database-app02.png)
>
> 버전, Root Password 등의 설정값을 정할 수 있습니다.
>
> > [!NOTE]
> >
> > 서비스별로 표시되는 **기본 설정값** 항목이 다릅니다. 사용하려는 목적에 맞게 알맞은 값을 입력해 주세요.

> [accordion] 더 많은 옵션
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/database-app03.png)
>
> 데이터베이스 이름, Timezone 설정 등, 추가적인 설정값을 입력할 수 있습니다.
>
> > [!NOTE]
> >
> > 서비스별로 표시되는 **더 많은 옵션**의 항목이 다릅니다. 사용하려는 목적에 맞게 알맞은 값을 입력해 주세요.

> [accordion] 성능(리소스) 설정과 배포
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/database-app04.png)
>
> * **CPU** : 서비스가 사용할 vCPU 리소스의 최댓값을 설정하며, '최소 vCPU' 선택 시 0.1 vCPU 사용
>
> * **메모리** : 서비스가 사용할 메모리 리소스의 최댓값을 설정
>
> * **디스크** : 데이터베이스가 차지할 수 있는 디스크의 용량 설정
>
> * **배포** : `배포하기` 클릭

> [!TIP]
>
> Root Password 미설정 시, [자동 생성된 Password를 프로젝트 설정 화면의 시크릿 섹션에서 조회](https://docs.ale.run/ko/application-database.md#root-password-조회)할 수 있습니다.

## 다른 서비스와의 통신

### 같은 프로젝트의 서비스

![](https://files.cloudtype.io/ale-docs/developers/images/database-app05.png)

> 같은 프로젝트에 있는 서비스 사이에는 내부 연결 주소인 **서비스 이름과 포트 번호로 통신**할 수 있습니다.

> [!NOTE]
>
> 프로젝트별로 격리된 네트워크가 구성되기 때문에 방화벽 규칙 적용이 필요 없고, 통신 지연 현상이 최소화됩니다.

### 다른 프로젝트 또는 외부 서비스

![](https://files.cloudtype.io/ale-docs/developers/images/database-app06.png)

> 서비스 상세 페이지 **리소스 탭의 인그레스 주소(호스트 이름 : 포트 번호)로** 다른 배포 환경 또는 외부의 서비스와 통신할 수 있습니다. 이 경우 TCP 외부 접속을 허용하도록 설정해야 합니다.

> [accordion] TCP 외부 접속 허용
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/database-app07.png)
>
> 연결하려는 DB가 속한 프로젝트 설정 화면의 방화벽 섹션에서 TCP 외부 접속을 허용할 수 있습니다.
>
> > [!TIP]
> >
> > TCP 접속 허용 설정은 프로젝트 단위로 가능하며, 서비스 단위의 개별 설정은 불가합니다.

### DB 관리 툴

> 인그레스 주소를 사용해 로컬 컴퓨터의 관리툴로 데이터베이스에 TCP 접속할 수 있습니다.

> [accordion] MariaDB - MySQL Workbench
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/07_08.png)
>
> > 접속 정보를 입력한 후, 이어지는 화면에서 배포 시 설정한 Root Password를 입력하세요.
>
> > [!NOTE]
> >
> > [MySQL Workbench Download](https://dev.mysql.com/downloads/workbench/)

> [accordion] PostgreSQL - pgAdmin
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/07_10.png)
>
> > Connection 탭에서 접속 정보와 배포할 때 설정한 Username(기본값 **root**), Root Password를 입력하세요.
>
> > [!NOTE]
> >
> > [pgAdmin Download](https://www.pgadmin.org/download/)

> [accordion] MongoDB - MongoDB Compass
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/07_11.png)
>
> > `New Connection` 버튼 클릭 후, **Advanced Connection Options** 하단부의 General 탭에서 **포트 번호까지 포함한 호스트 이름**을 Host 필드에 입력하세요.
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/07_12.png)
>
> > Authentication 탭에서 배포할 때 설정한 Username(기본값 **admin**), Root Password를 입력하세요.
>
> > [!NOTE]
> >
> > [MongoDB Compass Download](https://www.mongodb.com/try/download/compass)

> [accordion] Redis - Redis Insight
>
> ![](https://files.cloudtype.io/ale-docs/developers/images/07_13.png)
>
> > `Add Redis database` 버튼 클릭 후, 접속 정보를 입력해 주세요.
>
> > [!NOTE]
> >
> > [Redis Insight Download](https://redis.io/insight/)

> [!TIP]
>
> DB 관리 툴과 데이터베이스를 연결하려면 [TCP 외부 접속을 허용](https://docs.ale.run/ko/application-database.md#tcp)하도록 설정해야 합니다.

## 데이터베이스 관리

### 리소스 변경

![](https://files.cloudtype.io/ale-docs/developers/images/database-app08.png)

> 서비스 상세 페이지 설정 탭의 배포 설정 섹션에서 디스크, CPU 등의 리소스를 변경하고 `배포하기` 버튼으로 재배포하면 변경된 리소스가 적용됩니다.

> [!NOTE]
>
> 재배포 시 기존의 데이터는 유지됩니다.

### Root Password 조회

![](https://files.cloudtype.io/ale-docs/developers/images/database-app09.png)

> 프로젝트 설정 화면의 시크릿 섹션에서 Root Password 값을 조회할 수 있습니다.

### 데이터베이스 삭제

![](https://files.cloudtype.io/ale-docs/developers/images/database-app10.png)

> 서비스 상세 페이지 설정 탭 하단부의 `서비스 삭제하기` 버튼으로 데이터베이스를 삭제할 수 있습니다.

> [!WARNING]
>
> 배포한 데이터베이스를 중지하거나 재배포할 경우 데이터가 보존되지만, **데이터베이스 서비스 삭제 시 데이터도 영구적으로 제거됩니다.**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.