Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Last active April 16, 2023 14:11
Show Gist options
  • Save yuvalif/6188bf64f1298891804157df697410cc to your computer and use it in GitHub Desktop.
Save yuvalif/6188bf64f1298891804157df697410cc 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 kafka topic on 2nd zone (RGW at port 8201)
aws --region=default --endpoint-url http://localhost:8201 sns create-topic --name=fishtopic \                         
  --attributes='{"push-endpoint": "kafka://localhost"}'
  • in a separate terminal run a kafka consumer subscribed to the "fish" topic when using the consumer that comes with kafka itself, you can use (from within the kafka directory):
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic "fishtopic" | jq
  • create a bucket on 1st zone (RGW at port 8101) - will be synced to 2nd zone
aws --endpoint-url http://localhost:8101 s3 mb s3://fish
  • create a sync notification on 2nd zone
aws --region=default --endpoint-url http://localhost:8201 s3api put-bucket-notification-configuration  --bucket fish \
  --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::fishtopic", "Events": ["s3:ObjectSynced:Create"]}]}'
  • create an object and upload to 1st zone
head -c 512 </dev/urandom > myfile
aws --endpoint-url http://localhost:8101 s3 cp myfile s3://fish
  • verify that the object was synched to the 2nd zone
aws --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