Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What is the best method to check if gerrit mirrors are in sync with the master??

Edited

What is the best method to check if gerrit mirrors are in sync with the master??

I have 1 master and 5 mirors and then are running the replication but sometimes we see that the mirrors don't have the latest objects.

Is there a way command line or rest to check if the mirrors are in sync??

Thank you

Anish

1 answer

0 votes

Hi Anish!

There are a few ways to figure out when a repository on a mirror was last updated. Here's a little shell script that can do it for you:

PROJECT=<project_key> REPO=<repository_slug> HOST=<hostname> && curl -s "https://$HOST/rest/mirroring/latest/repos/$(curl -s -H "$COOKIE" https://$HOST/rest/api/latest/projects/$PROJECT/repos/$REPO | jq .id)/mirrors" | jq -r .values[].links.self[].href | while read url; do curl -s "$url"| jq -r '.mirrorName + "\t" + (.updatedDate | (. / 1000 | strftime("%Y-%m-%d %H:%M:%S")))'; done

This should print something like

Mirror Name 1        2020-04-23 23:52:11
Mirror Name 2 2020-04-23 23:52:07

You can of course adjust the script to your needs, you need to have the command "jq" installed on your system for it to work, and the necessary data is available since Bitbucket 6.7.

Cheers,

Wolfgang

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,762 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you