본문 바로가기
MLOps

MLflow 설치 및 S3와 Mysql 함께 사용하기(ubuntu 환경)

by nothing-error 2023. 2. 25.

 

0. 환경세팅

postgresql 사용시(우분투) : pip install psycopg2-binary

 

 

1.  S3 버킷 생성

버킷 생성은 아래 참고하시면 될듯합니다.

2023.02.10 - [Cloud] - [AWS] S3 소개 및 버킷 생성부터 파일 업로드 다운로드까지

 

[AWS] S3 소개 및 버킷 생성부터 파일 업로드 다운로드까지

S3 소개 Amazon Simple Storage Service (Amazon S3)는 Amazon Web Services (AWS)의 가장 오래된 서비스 중 하나입니다. S3는 간단하고 효율적인 클라우드 저장소 솔루션으로, 웹에서 개인 또는 사업용 데이터를 저

nothing-error.pysyntax.com

 

2. 환경변수 설정

아래 엔드포인트 유알엘에서 s3-{버킷리전} 적어주시면 됩니다.

$ ~/.profile

export MLFLOW_S3_ENDPOINT_URL=https://s3-ap-northeast-2.amazonaws.com
export AWS_ACCESS_KEY_ID=''
export AWS_SECRET_ACCESS_KEY=''
export MLFLOW_S3_IGNORE_TLS=true
export MLFLOW_TRACKING_URI=postgresql+psycopg2://postgres:postgres@localhost:5432/mlflow_db

$ source ~/.profile

 

 

3. postgresql 설치

 

#postgresql 컨테이너 생성 및 실행

$ docker run  --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -h localhost -d postgres


#컨테이너 접속 

 

$ docker exec -it postgres bash


# DBMS접속

$ psql -U postgres


#db생성 : 위의 환경변수와 동일한 이름의 db 생성

$ create database mlflow_db;

 

 

4. mlflow server

$ mlflow server --backend-store-uri postgresql://postgres:postgres@localhost:5432/mlflow_db --default-artifact-root s3://버킷이름 --host localhost

 

 

 

댓글