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

Anish March 5, 2020

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
Wolfgang Kritzinger
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 23, 2020

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
AUG Leaders

Atlassian Community Events