From 14d29b77ae7e7f25d58ab098bb1976e160d80ac2 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 3 Jan 2023 22:54:39 -0800 Subject: [PATCH] update replication tests with latest 'mc' (#16348) --- docs/bucket/replication/delete-replication.sh | 3 +- .../setup_2site_existing_replication.sh | 11 +-- .../replication/setup_3site_replication.sh | 91 ++++--------------- docs/bucket/replication/setup_replication.sh | 8 +- 4 files changed, 27 insertions(+), 86 deletions(-) diff --git a/docs/bucket/replication/delete-replication.sh b/docs/bucket/replication/delete-replication.sh index c10b86769..20f6527c1 100755 --- a/docs/bucket/replication/delete-replication.sh +++ b/docs/bucket/replication/delete-replication.sh @@ -62,8 +62,7 @@ export MC_HOST_myminio2=http://minioadmin:minioadmin@localhost:9002 ./mc mb myminio2/testbucket/ ./mc version enable myminio2/testbucket/ -arn=$(mc admin bucket remote add myminio1/testbucket/ http://minioadmin:minioadmin@localhost:9002/testbucket/ --service "replication" --json | jq -r .RemoteARN) -./mc replicate add myminio1/testbucket --remote-bucket "$arn" --priority 1 +./mc replicate add myminio1/testbucket --remote-bucket http://minioadmin:minioadmin@localhost:9002/testbucket/ --priority 1 ./mc cp README.md myminio1/testbucket/dir/file ./mc cp README.md myminio1/testbucket/dir/file diff --git a/docs/bucket/replication/setup_2site_existing_replication.sh b/docs/bucket/replication/setup_2site_existing_replication.sh index e1b43aa9b..ce1e5cae6 100755 --- a/docs/bucket/replication/setup_2site_existing_replication.sh +++ b/docs/bucket/replication/setup_2site_existing_replication.sh @@ -76,14 +76,11 @@ done ./mc mb siteb/bucket/ ./mc version enable siteb/bucket/ -echo "adding replication config for site a -> site b" -remote_arn=$(./mc admin bucket remote add sitea/bucket/ \ - http://minio:minio123@127.0.0.1:9004/bucket \ - --service "replication" --json | jq -r ".RemoteARN") -echo "adding replication rule for a -> b : ${remote_arn}" - +echo "adding replication rule for site a -> site b" ./mc replicate add sitea/bucket/ \ - --remote-bucket "${remote_arn}" + --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket + +remote_arn=$(./mc replicate ls sitea/bucket --json | jq -r .rule.Destination.Bucket) sleep 1 ./mc replicate resync start sitea/bucket/ --remote-bucket "${remote_arn}" diff --git a/docs/bucket/replication/setup_3site_replication.sh b/docs/bucket/replication/setup_3site_replication.sh index 04c4bf6ac..17d38d79b 100755 --- a/docs/bucket/replication/setup_3site_replication.sh +++ b/docs/bucket/replication/setup_3site_replication.sh @@ -80,127 +80,76 @@ export MC_HOST_sitec=http://minio:minio123@127.0.0.1:9006 ./mc version enable sitec/bucket/ ./mc mb -l sitec/olockbucket -echo "adding replication config for site a -> site b" -remote_arn=$(./mc admin bucket remote add sitea/bucket/ \ - http://minio:minio123@127.0.0.1:9004/bucket \ - --service "replication" --json | jq -r ".RemoteARN") echo "adding replication rule for a -> b : ${remote_arn}" sleep 1 ./mc replicate add sitea/bucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" sleep 1 -echo "adding replication config for site b -> site a" -remote_arn=$(./mc admin bucket remote add siteb/bucket/ \ - http://minio:minio123@127.0.0.1:9001/bucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 echo "adding replication rule for b -> a : ${remote_arn}" ./mc replicate add siteb/bucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9001/bucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" sleep 1 -echo "adding replication config for site a -> site c" -remote_arn=$(./mc admin bucket remote add sitea/bucket/ \ - http://minio:minio123@127.0.0.1:9006/bucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 echo "adding replication rule for a -> c : ${remote_arn}" ./mc replicate add sitea/bucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9006/bucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 sleep 1 -echo "adding replication config for site c -> site a" -remote_arn=$(./mc admin bucket remote add sitec/bucket/ \ - http://minio:minio123@127.0.0.1:9001/bucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for c -> a : ${remote_arn}" ./mc replicate add sitec/bucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9001/bucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 sleep 1 -echo "adding replication config for site b -> site c" -remote_arn=$(./mc admin bucket remote add siteb/bucket/ \ - http://minio:minio123@127.0.0.1:9006/bucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for b -> c : ${remote_arn}" ./mc replicate add siteb/bucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9006/bucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 sleep 1 -echo "adding replication config for site c -> site b" -remote_arn=$(././mc admin bucket remote add sitec/bucket \ - http://minio:minio123@127.0.0.1:9004/bucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 echo "adding replication rule for c -> b : ${remote_arn}" ./mc replicate add sitec/bucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 sleep 1 -echo "adding replication config for olockbucket site a -> site b" -remote_arn=$(././mc admin bucket remote add sitea/olockbucket/ \ - http://minio:minio123@127.0.0.1:9004/olockbucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for olockbucket a -> b : ${remote_arn}" ./mc replicate add sitea/olockbucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9004/olockbucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" sleep 1 -echo "adding replication config for site b -> site a" -remote_arn=$(././mc admin bucket remote add siteb/olockbucket/ \ - http://minio:minio123@127.0.0.1:9001/olockbucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for olockbucket b -> a : ${remote_arn}" ./mc replicate add siteb/olockbucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9001/olockbucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" sleep 1 -echo "adding replication config for olockbucket site a -> site c" -remote_arn=$(././mc admin bucket remote add sitea/olockbucket/ \ - http://minio:minio123@127.0.0.1:9006/olockbucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for olockbucket a -> c : ${remote_arn}" ./mc replicate add sitea/olockbucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9006/olockbucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 sleep 1 -echo "adding replication config for site c -> site a" -remote_arn=$(././mc admin bucket remote add sitec/olockbucket/ \ - http://minio:minio123@127.0.0.1:9001/olockbucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for olockbucket c -> a : ${remote_arn}" ./mc replicate add sitec/olockbucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9001/olockbucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 sleep 1 -echo "adding replication config for site b -> site c" -remote_arn=$(././mc admin bucket remote add siteb/olockbucket/ \ - http://minio:minio123@127.0.0.1:9006/olockbucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for olockbucket b -> c : ${remote_arn}" ./mc replicate add siteb/olockbucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9006/olockbucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 sleep 1 -echo "adding replication config for site c -> site b" -remote_arn=$(././mc admin bucket remote add sitec/olockbucket \ - http://minio:minio123@127.0.0.1:9004/olockbucket \ - --service "replication" --json | jq -r ".RemoteARN") -sleep 1 + echo "adding replication rule for olockbucket c -> b : ${remote_arn}" ./mc replicate add sitec/olockbucket/ \ - --remote-bucket "${remote_arn}" \ + --remote-bucket http://minio:minio123@127.0.0.1:9004/olockbucket \ --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 sleep 1 diff --git a/docs/bucket/replication/setup_replication.sh b/docs/bucket/replication/setup_replication.sh index 518a29891..0db50b370 100755 --- a/docs/bucket/replication/setup_replication.sh +++ b/docs/bucket/replication/setup_replication.sh @@ -96,10 +96,6 @@ cat ./replpolicy.json # assign this replication policy to repluser mc admin policy set dest replpolicy user=repluser -# define remote target for replication from source/bucket -> dest/bucket -remote_arn=$(mc admin bucket remote add repladminAlias/bucket http://repluser:repluser123@localhost:9000/bucket --service replication --json | jq -r ".RemoteARN") - -echo "Now, use this ARN to add replication rules using 'mc replicate add' command" -# use arn returned by above command to create a replication policy on the source/bucket with `mc replicate add` -mc replicate add source/bucket --priority 1 --remote-bucket "${remote_arn}" \ +# configure replication config to remote bucket at http://localhost:9000 +mc replicate add source/bucket --priority 1 --remote-bucket http://repluser:repluser123@localhost:9000/bucket \ --replicate existing-objects,delete,delete-marker,replica-metadata-sync