
























Data lakes require scalable, cost-effective object storage with S3-compatible APIs. Ceph RGW provides:
# Configure the AWS CLI to point to Ceph RGW
aws configure set default.endpoint_url https://rgw.example.com
export AWS_ACCESS_KEY_ID=<access-key>
export AWS_SECRET_ACCESS_KEY=<secret-key>
# Create a data lake bucket
aws s3 mb s3://datalake --endpoint-url https://rgw.example.com
# Create a structured folder hierarchy
aws s3api put-object --bucket datalake --key raw/ --endpoint-url https://rgw.example.com
aws s3api put-object --bucket datalake --key processed/ --endpoint-url https://rgw.example.com
aws s3api put-object --bucket datalake --key curated/ --endpoint-url https://rgw.example.comEnable versioning to maintain history of data changes:
aws s3api put-bucket-versioning \
--bucket datalake \
--versioning-configuration Status=Enabled \
--endpoint-url https://rgw.example.comMove data from raw to archive after 90 days:
{
"Rules": [{
"ID": "archive-raw-data",
"Filter": { "Prefix": "raw/" },
"Status": "Enabled",
"Transitions": [{
"Days": 90,
"StorageClass": "GLACIER"
}]
}]
}aws s3api put-bucket-lifecycle-configuration \
--bucket datalake \
--lifecycle-configuration file://lifecycle.json \
--endpoint-url https://rgw.example.comConfigure Spark to read from Ceph RGW:
from pyspark.sql import SparkSession
spark = SparkSession.builder \
.appName("DataLake") \
.config("spark.hadoop.fs.s3a.endpoint", "https://rgw.example.com") \
.config("spark.hadoop.fs.s3a.access.key", "my-access-key") \
.config("spark.hadoop.fs.s3a.secret.key", "my-secret-key") \
.config("spark.hadoop.fs.s3a.path.style.access", "true") \
.config("spark.hadoop.fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem") \
.getOrCreate()
# Read Parquet from data lake
df = spark.read.parquet("s3a://datalake/processed/events/")
df.show()Configure Trino catalog for Ceph S3:
connector.name=hive
hive.metastore.uri=thrift://hive-metastore:9083
hive.s3.endpoint=https://rgw.example.com
hive.s3.aws-access-key=my-access-key
hive.s3.aws-secret-key=my-secret-key
hive.s3.path-style-access=true
hive.s3.ssl.enabled=trueQuery data lake tables:
SELECT date_trunc('hour', event_time) AS hour,
count(*) AS events
FROM datalake.processed.events
WHERE event_date = CURRENT_DATE
GROUP BY 1
ORDER BY 1;Large data files (>100MB) should use multipart uploads. Configure the chunk size first, then upload:
# Set multipart chunk size to 64MB
aws configure set default.s3.multipart_chunksize 64MB
# Upload large file (multipart upload is used automatically)
aws s3 cp large-dataset.parquet s3://datalake/raw/datasets/ \
--endpoint-url https://rgw.example.comCeph RGW provides a scalable, self-hosted S3-compatible backend for data lake architectures. Configure structured bucket hierarchies with raw, processed, and curated zones, enable versioning for data lineage, and set lifecycle policies to automate data tiering. Integrate with Spark using the S3A connector and Trino using the Hive catalog, both of which support path-style access required by Ceph RGW.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。