본문 바로가기

Prefect

[Prefect] Configuration

728x90

Overview

  • Prefect에서 Custom한 Profile과 Configuration을 만들고 적용 할 수 있다.
  • Prefect는 기본적으로 SQLite DB에서 동작하지만, PostgreSQL DB 사용을 권장한다.
    • 아래의 설정에서는 PostgreSQL이 설치되어 있다고 가정하고 작성한 것이다.
    • Prefect에 사용될 DB는 사전에 생성되어 있어야 한다.

참고

 

Profiles and Configuration - Prefect Docs

Prefect settings let you customize your workflow environment, including working with Prefect server and Prefect Cloud.

docs.prefect.io

 

# Prefect 설정
> prefect config set PREFECT_SERVER_API_HOST='your_host'
> prefect config set PREFECT_SERVER_API_PORT='14200'
> prefect config set PREFECT_API_URL="http://your_host:14200/api"
> prefect config set PREFECT_HOME='/stg/prefect'
> prefect config set PREFECT_LOCAL_STORAGE_PATH='${PREFECT_HOME}/storage'
> prefect config set PREFECT_API_DATABASE_CONNECTION_URL="postgresql+asyncpg://db_user:db_password@your_host:15432/prefect"

# 설정 확인
> prefect config view
PREFECT_PROFILE='default'
PREFECT_API_URL='http://172.30.1.210:14200/api' (from profile)
PREFECT_HOME='/stg/prefect' (from profile)
PREFECT_SERVER_API_HOST='172.30.1.210' (from profile)
PREFECT_SERVER_API_PORT='14200' (from profile)

# Prefect DB 초기화 (사전에 postgresql 설정 및 prefect db가 생성되어 있어야 한다.)
> prefect server database reset -y
Downgrading database...
Upgrading database...
Prefect database "postgresql+asyncpg://postgres:***@host:15432/prefect" reset!
728x90

'Prefect' 카테고리의 다른 글

[Prefect] Server 로깅 설정  (0) 2023.12.24
[Prefect] SlackWebhook 사용법  (1) 2023.12.20
[Prefect] Blocks for Infrastructure & RemoteFileSystem  (0) 2023.05.22
[Prefect] Installation & Run  (0) 2023.05.22
[Prefect] Docker-Compose  (0) 2023.02.01