2021-09-20 21:24:24 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-11-10 21:18:09 -05:00
|
|
|
trap 'catch $LINENO' ERR
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-11-10 21:18:09 -05:00
|
|
|
# shellcheck disable=SC2120
|
2021-09-20 21:24:24 -04:00
|
|
|
catch() {
|
2021-11-10 21:18:09 -05:00
|
|
|
if [ $# -ne 0 ]; then
|
|
|
|
echo "error on line $1"
|
|
|
|
for site in sitea siteb sitec; do
|
|
|
|
echo "$site server logs ========="
|
|
|
|
cat "/tmp/${site}_1.log"
|
|
|
|
echo "==========================="
|
|
|
|
cat "/tmp/${site}_2.log"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2021-09-20 21:24:24 -04:00
|
|
|
echo "Cleaning up instances of MinIO"
|
|
|
|
pkill minio
|
2021-11-10 21:18:09 -05:00
|
|
|
pkill -9 minio
|
2021-09-20 21:24:24 -04:00
|
|
|
rm -rf /tmp/multisitea
|
|
|
|
rm -rf /tmp/multisiteb
|
|
|
|
rm -rf /tmp/multisitec
|
|
|
|
}
|
|
|
|
|
|
|
|
catch
|
|
|
|
|
|
|
|
set -e
|
2022-02-13 18:42:07 -05:00
|
|
|
export MINIO_CI_CD=1
|
2021-09-20 21:24:24 -04:00
|
|
|
export MINIO_BROWSER=off
|
|
|
|
export MINIO_ROOT_USER="minio"
|
|
|
|
export MINIO_ROOT_PASSWORD="minio123"
|
2021-12-07 13:08:26 -05:00
|
|
|
export MINIO_KMS_AUTO_ENCRYPTION=off
|
2021-09-20 21:24:24 -04:00
|
|
|
export MINIO_PROMETHEUS_AUTH_TYPE=public
|
2021-12-07 13:08:26 -05:00
|
|
|
export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
|
|
|
|
unset MINIO_KMS_KES_CERT_FILE
|
|
|
|
unset MINIO_KMS_KES_KEY_FILE
|
|
|
|
unset MINIO_KMS_KES_ENDPOINT
|
|
|
|
unset MINIO_KMS_KES_KEY_NAME
|
|
|
|
|
|
|
|
go build ./docs/debugging/s3-check-md5/
|
|
|
|
wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc \
|
|
|
|
&& chmod +x mc
|
|
|
|
wget -O mc.RELEASE.2021-03-12T03-36-59Z https://dl.minio.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-03-12T03-36-59Z \
|
|
|
|
&& chmod +x mc.RELEASE.2021-03-12T03-36-59Z
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-11-10 21:18:09 -05:00
|
|
|
minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
|
|
|
|
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 &
|
|
|
|
minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
|
|
|
|
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 &
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-11-10 21:18:09 -05:00
|
|
|
minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
|
|
|
|
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 &
|
|
|
|
minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
|
|
|
|
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 &
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-11-10 21:18:09 -05:00
|
|
|
minio server --address 127.0.0.1:9005 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \
|
|
|
|
"http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_1.log 2>&1 &
|
|
|
|
minio server --address 127.0.0.1:9006 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \
|
|
|
|
"http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_2.log 2>&1 &
|
2021-09-20 21:24:24 -04:00
|
|
|
|
|
|
|
sleep 30
|
|
|
|
|
2021-12-07 13:08:26 -05:00
|
|
|
export MC_HOST_sitea=http://minio:minio123@127.0.0.1:9001
|
|
|
|
export MC_HOST_siteb=http://minio:minio123@127.0.0.1:9004
|
|
|
|
export MC_HOST_sitec=http://minio:minio123@127.0.0.1:9006
|
|
|
|
|
|
|
|
./mc mb sitea/bucket
|
|
|
|
./mc version enable sitea/bucket
|
|
|
|
./mc mb -l sitea/olockbucket
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc mb siteb/bucket/
|
|
|
|
./mc version enable siteb/bucket/
|
|
|
|
./mc mb -l siteb/olockbucket/
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc mb sitec/bucket/
|
|
|
|
./mc version enable sitec/bucket/
|
|
|
|
./mc mb -l sitec/olockbucket
|
2021-09-20 21:24:24 -04:00
|
|
|
|
|
|
|
echo "adding replication config for site a -> site b"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(./mc admin bucket remote add sitea/bucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9004/bucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
echo "adding replication rule for a -> b : ${remote_arn}"
|
|
|
|
sleep 1
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitea/bucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
echo "adding replication config for site b -> site a"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(./mc admin bucket remote add siteb/bucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9001/bucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for b -> a : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add siteb/bucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
echo "adding replication config for site a -> site c"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(./mc admin bucket remote add sitea/bucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9006/bucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for a -> c : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitea/bucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for site c -> site a"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(./mc admin bucket remote add sitec/bucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9001/bucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for c -> a : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitec/bucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for site b -> site c"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(./mc admin bucket remote add siteb/bucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9006/bucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for b -> c : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add siteb/bucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
echo "adding replication config for site c -> site b"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add sitec/bucket \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9004/bucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for c -> b : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitec/bucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for olockbucket site a -> site b"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add sitea/olockbucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9004/olockbucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for olockbucket a -> b : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitea/olockbucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for site b -> site a"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add siteb/olockbucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9001/olockbucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for olockbucket b -> a : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add siteb/olockbucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for olockbucket site a -> site c"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add sitea/olockbucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9006/olockbucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for olockbucket a -> c : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitea/olockbucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for site c -> site a"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add sitec/olockbucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9001/olockbucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for olockbucket c -> a : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitec/olockbucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for site b -> site c"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add siteb/olockbucket/ \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9006/olockbucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for olockbucket b -> c : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add siteb/olockbucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication config for site c -> site b"
|
2021-12-07 13:08:26 -05:00
|
|
|
remote_arn=$(././mc admin bucket remote add sitec/olockbucket \
|
2021-11-10 21:18:09 -05:00
|
|
|
http://minio:minio123@127.0.0.1:9004/olockbucket \
|
2021-09-20 21:24:24 -04:00
|
|
|
--service "replication" --json | jq -r ".RemoteARN")
|
|
|
|
sleep 1
|
|
|
|
echo "adding replication rule for olockbucket c -> b : ${remote_arn}"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc replicate add sitec/olockbucket/ \
|
2021-09-20 21:24:24 -04:00
|
|
|
--remote-bucket "${remote_arn}" \
|
|
|
|
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
|
|
|
|
sleep 1
|
|
|
|
|
2021-10-30 11:57:59 -04:00
|
|
|
echo "Set default governance retention 30d"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc retention set --default governance 30d sitea/olockbucket
|
2021-09-20 21:24:24 -04:00
|
|
|
|
2021-10-30 11:57:59 -04:00
|
|
|
echo "Copying data to source sitea/bucket"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc cp --encrypt "sitea/" --quiet /etc/hosts sitea/bucket
|
2021-09-20 21:24:24 -04:00
|
|
|
sleep 1
|
|
|
|
|
2021-10-30 11:57:59 -04:00
|
|
|
echo "Copying data to source sitea/olockbucket"
|
2021-12-07 13:08:26 -05:00
|
|
|
./mc cp --quiet /etc/hosts sitea/olockbucket
|
2021-10-30 11:57:59 -04:00
|
|
|
sleep 1
|
|
|
|
|
2021-09-20 21:24:24 -04:00
|
|
|
echo "Verifying the metadata difference between source and target"
|
2021-12-07 13:08:26 -05:00
|
|
|
if diff -pruN <(./mc stat --json sitea/bucket/hosts | jq .) <(./mc stat --json siteb/bucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
|
2021-10-30 01:09:55 -04:00
|
|
|
echo "verified sitea-> COMPLETED, siteb-> REPLICA"
|
|
|
|
fi
|
|
|
|
|
2021-12-07 13:08:26 -05:00
|
|
|
if diff -pruN <(./mc stat --json sitea/bucket/hosts | jq .) <(./mc stat --json sitec/bucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
|
2021-10-30 01:09:55 -04:00
|
|
|
echo "verified sitea-> COMPLETED, sitec-> REPLICA"
|
|
|
|
fi
|
|
|
|
|
2021-10-30 11:57:59 -04:00
|
|
|
echo "Verifying the metadata difference between source and target"
|
2021-12-07 13:08:26 -05:00
|
|
|
if diff -pruN <(./mc stat --json sitea/olockbucket/hosts | jq .) <(./mc stat --json siteb/olockbucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
|
2021-10-30 11:57:59 -04:00
|
|
|
echo "verified sitea-> COMPLETED, siteb-> REPLICA"
|
|
|
|
fi
|
|
|
|
|
2021-12-07 13:08:26 -05:00
|
|
|
if diff -pruN <(./mc stat --json sitea/olockbucket/hosts | jq .) <(./mc stat --json sitec/olockbucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
|
2021-10-30 11:57:59 -04:00
|
|
|
echo "verified sitea-> COMPLETED, sitec-> REPLICA"
|
|
|
|
fi
|
|
|
|
|
2021-12-07 13:08:26 -05:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
head -c 221227088 </dev/urandom >200M
|
|
|
|
./mc.RELEASE.2021-03-12T03-36-59Z cp --config-dir ~/.mc --encrypt "sitea" --quiet 200M "sitea/bucket/200M-enc-v1"
|
|
|
|
./mc.RELEASE.2021-03-12T03-36-59Z cp --config-dir ~/.mc --quiet 200M "sitea/bucket/200M-v1"
|
|
|
|
|
|
|
|
./mc cp --encrypt "sitea" --quiet 200M "sitea/bucket/200M-enc-v2"
|
|
|
|
./mc cp --quiet 200M "sitea/bucket/200M-v2"
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
|
|
|
echo "Verifying ETag for all objects"
|
2021-12-21 13:08:26 -05:00
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9001/ -bucket bucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9002/ -bucket bucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9003/ -bucket bucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9004/ -bucket bucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9005/ -bucket bucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9006/ -bucket bucket
|
|
|
|
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9001/ -bucket olockbucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9002/ -bucket olockbucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9003/ -bucket olockbucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9004/ -bucket olockbucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9005/ -bucket olockbucket
|
|
|
|
./s3-check-md5 -versions -access-key minio -secret-key minio123 -endpoint http://127.0.0.1:9006/ -bucket olockbucket
|
2021-12-07 13:08:26 -05:00
|
|
|
|
2021-10-30 01:09:55 -04:00
|
|
|
catch
|