- start ceph cluster with an RGW using vstart:
MON=1 OSD=1 MDS=0 MGR=1 RGW=1 ../src/vstart.sh -d -n
- use the following lua script
postrequest.lua
:
RGWDebugLog("Post Request Request.RGWOp = " .. Request.RGWOp)
RGWDebugLog("number of http metadata entries is: " .. #Request.HTTP.Metadata)
for k, v in pairs(Request.HTTP.Metadata) do
RGWDebugLog("key=" .. k .. ", " .. "value=" .. v)
end
RGWDebugLog("number of tags is: " .. #Request.Tags)
for k, v in pairs(Request.Tags) do
RGWDebugLog("key=" .. k .. ", " .. "value=" .. v)
end
if Request.Object then
RGWDebugLog("number of object metadata entries is: " .. #Request.Object.Metadata)
for k, v in pairs(Request.Object.Metadata) do
RGWDebugLog("key=" .. k .. ", " .. "value=" .. v)
end
RGWDebugLog("number of object tags is: " .. #Request.Object.Tags)
for k, v in pairs(Request.Object.Tags) do
RGWDebugLog("key=" .. k .. ", " .. "value=" .. v)
end
end
- upload to
postrequest
context:
bin/radosgw-admin script put --infile postrequest.lua --context postrequest
- create a bucket using the AWS CLI:
aws --endpoint-url http://localhost:8000 s3 mb s3://fish
head -c 12K /dev/urandom > sample.txt
- upload the file to the bucket with custom metadata
aws --endpoint-url http://localhost:8000 s3 cp sample.txt s3://fish --metadata '{"hello": "world"}'
aws --endpoint-url http://localhost:8000 s3api put-object-tagging --bucket=fish --key='sample.txt' --tagging='{"TagSet": [{"Key": "hello", "Value": "world"}]}'
aws --endpoint-url http://localhost:8000 s3 cp s3://fish/sample.txt .
- verify the metadata tags are printed to the log