Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Last active May 1, 2023 09:13
Show Gist options
  • Save yuvalif/527a5064a1748d447129c594838448b0 to your computer and use it in GitHub Desktop.
Save yuvalif/527a5064a1748d447129c594838448b0 to your computer and use it in GitHub Desktop.
  • start multisite wirh 2 clusters
MON=1 OSD=1 MDS=0 MGR=0 ../src/test/rgw/test-rgw-multisite.sh 2
  • export credentials
export AWS_ACCESS_KEY_ID=1234567890
export AWS_SECRET_ACCESS_KEY=pencil
  • create a http topic on 1st zone (RGW at port 8101)
aws --region=zg1 --endpoint-url http://localhost:8101 sns create-topic --name=fishtopic \
  --attributes='{"push-endpoint": "http://localhost:10900"}'
  • create a http topic on 2nd zone (RGW at port 8201)
aws --region=zg1 --endpoint-url http://localhost:8201 sns create-topic --name=fishtopic \
  --attributes='{"push-endpoint": "http://localhost:10900"}'
  • download a python HTTP POST server:
wget https://gist.githubusercontent.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7/raw/a6a1d090ac8549dac8f2bd607bd64925de997d40/server.py
  • in a separate terminal run the above server:
python server.py 10900
  • create a verioned bucket on 1st zone (RGW at port 8101) - will be synced to 2nd zone
aws --region=zg1 --endpoint-url http://localhost:8101 s3 mb s3://fish
aws --region=zg1 --endpoint-url http://localhost:8101 s3api put-bucket-versioning \
  --bucket fish --versioning-configuration Status=Enabled
  • create a regular notification on the 1st zone:
aws --region=zg1 --endpoint-url http://localhost:8101 s3api put-bucket-notification-configuration  --bucket fish \
  --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:rg1::fishtopic", "Events": []}]}'
  • create a sync notification on 2nd zone
aws --region=zg1 --endpoint-url http://localhost:8201 s3api put-bucket-notification-configuration  --bucket fish \
  --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:rg1::fishtopic", "Events": ["s3:ObjectSynced:Create"]}]}'
  • create a tagged object and upload to 1st zone
head -c 50M </dev/urandom > myfile
aws --region=zg1 --endpoint-url http://localhost:8101 s3api put-object --bucket fish --key myfile \
  --tagging "Key1=Value1" --metadata "ka=boom,foo=bar" --body ./myfile
  • upload another version to 1st zone
head -c 512 </dev/urandom > myfile
aws --region=zg1 --endpoint-url http://localhost:8101 s3 cp myfile s3://fish
  • verify that the object was synched to the 2nd zone
aws --region=zg1 --endpoint-url http://localhost:8201 s3 ls s3://fish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment