lakeFS 데이터 복사
lakeFS 데이터 복사 (Copying data to/from lakeFS)
lakeFS 저장소로 데이터를 가져오거나 내보낼 때 쓸 수 있는 복사 도구들을 소개해요. Hadoop DistCp와 Rclone 두 가지 방법이 대표적이에요.
출처: 문서
본문
DistCp 사용하기
Apache Hadoop DistCp(distributed copy)는 대규모 클러스터 간/클러스터 내 복사에 쓰는 도구예요. lakeFS 저장소에서도 쉽게 쓸 수 있어요.
정보
아래 예시에서는 설명을 단순하게 하려고 명령줄에 AWS 자격 증명을 직접 넣었어요. 실제 운영 환경에서는 S3 인증에 쓰는 Hadoop 표준 방법 중 하나로 이 속성들을 설정해야 해요.
lakeFS 저장소 사이에서 복사
두 개의 서로 다른 lakeFS 저장소 사이를 DistCp로 복사할 수 있어요. 액세스 키 페어를 자신의 lakeFS 키 페어로 바꾸세요:
hadoop distcp \
-Dfs.s3a.path.style.access=true \
-Dfs.s3a.access.key="«redacted:AKIA…»" \
-Dfs.s3a.secret.key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
-Dfs.s3a.endpoint="https://lakefs.example.com" \
"s3a://example-repo-1/main/example-file.parquet" \
"s3a://example-repo-2/main/example-file.parquet"
S3 버킷과 lakeFS 사이에서 복사
S3 버킷에서 lakeFS 저장소로 데이터를 복사하려면 Hadoop의 버킷별 설정(per-bucket configuration)을 사용해요. 아래 예시에서 첫 번째 액세스 키 페어는 lakeFS 키 페어로, 두 번째는 AWS IAM 키 페어로 바꾸세요.
S3에서 lakeFS로
hadoop distcp \
-Dfs.s3a.path.style.access=true \
-Dfs.s3a.bucket.example-repo.access.key="«redacted:AKIA…»" \
-Dfs.s3a.bucket.example-repo.secret.key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
-Dfs.s3a.bucket.example-repo.endpoint="https://lakefs.example.com" \
-Dfs.s3a.bucket.example-bucket.access.key="«redacted:AKIA…»" \
-Dfs.s3a.bucket.example-bucket.secret.key="wJalrXUtnFEMI/K3MDENG/bPxRfiCYEXAMPLEKEY" \
"s3a://example-bucket/example-file.parquet" \
"s3a://example-repo/main/example-file.parquet"
lakeFS에서 S3로
hadoop distcp \
-Dfs.s3a.path.style.access=true \
-Dfs.s3a.bucket.example-repo.access.key="«redacted:AKIA…»" \
-Dfs.s3a.bucket.example-repo.secret.key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
-Dfs.s3a.bucket.example-repo.endpoint="https://lakefs.example.com" \
-Dfs.s3a.bucket.example-bucket.access.key="«redacted:AKIA…»" \
-Dfs.s3a.bucket.example-bucket.secret.key="wJalrXUtnFEMI/K3MDENG/bPxRfiCYEXAMPLEKEY" \
"s3a://example-repo/main/myfile" \
"s3a://example-bucket/myfile"
Rclone 사용하기
Rclone은 클라우드 제공자 사이에서 파일과 디렉터리를 동기화하는 명령줄 프로그램이에요. lakeFS와 함께 쓰려면 아래 설명대로 Rclone 리모트(remote)를 하나 만들고, 다른 Rclone 리모트처럼 사용하면 돼요.
Rclone에 lakeFS 리모트 만들기
Rclone에 리모트를 추가하려면 다음 중 한 가지 방법을 골라요.
옵션 1: Rclone 설정 파일에 항목 추가
- Rclone 설정 파일 경로를 찾아서 다음 단계를 위해 복사해 두세요.
rclone config file
# output:
# Configuration file is stored at:
# /home/myuser/.config/rclone/rclone.conf
- lakeFS 액세스 키가 이미 AWS 프로필이나 환경 변수로 설정되어 있다면, 아래 명령을 실행하고 endpoint 속성을 자신의 lakeFS 엔드포인트로 바꾸세요:
cat <<EOT >> /home/myuser/.config/rclone/rclone.conf
[lakefs]
type = s3
provider = Other
endpoint = https://lakefs.example.com
no_check_bucket = true
EOT
- 그렇지 않다면 lakeFS 액세스 키 페어도 Rclone 설정 파일에 함께 넣어요:
cat <<EOT >> /home/myuser/.config/rclone/rclone.conf
[lakefs]
type = s3
provider = Other
env_auth = false
access_key_id = «redacted:AKIA…»
secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
endpoint = https://lakefs.example.com
no_check_bucket = true
EOT
옵션 2: Rclone 대화형 설정 명령 사용
아래 명령을 실행하고 안내를 따라가요:
rclone config
Choose AWS S3 as your type of storage, and enter your lakeFS endpoint as your S3 endpoint.
You will have to choose whether you use your environment for authentication (recommended),
or enter the lakeFS access key pair into the Rclone configuration. Select "Edit advanced
config" and accept defaults for all values except `no_check_bucket`:
If set, don't attempt to check the bucket exists or create it.
This can be useful when trying to minimize the number of transactions
Rclone carries out, if you know the bucket exists already.
This might also be needed if the user you're using doesn't have bucket
creation permissions. Before v1.52.0, this would have passed silently
due to a bug.
Enter a boolean value (true or false). Press Enter for the default ("false").
no_check_bucket> yes
S3와 lakeFS 동기화
rclone sync mys3remote://mybucket/path/ lakefs:example-repo/main/path
로컬 디렉터리와 lakeFS 동기화
rclone sync /home/myuser/path/ lakefs:example-repo/main/path
더 알아보기 (Learn more)
공식 문서: lakeFS 데이터 복사 가이드