Moving Gerrit to new host

200 views
Skip to first unread message

Craig Janeczek

unread,
Jan 5, 2022, 2:38:51 AM1/5/22
to Repo and Gerrit Discussion
I have a Gerrit server version 2.16.27 migrated to NoteDB which I am trying to move to a different host. This will be a one time cutover and replacement. 

I have manually copied over the full repositories, H2 databases (database.h2.db and account_patch_reviews.h2.db), and have confirmed the gerrit.serverId value matches between the old and new instances. I see the repositories, groups and users in the UI but do not see any of the reviews or old comments.

Does anyone have tips on how to move gerrit instances between hosts?

Matthias Sohn

unread,
Jan 5, 2022, 3:03:32 AM1/5/22
to Craig Janeczek, Repo and Gerrit Discussion
On Wed, Jan 5, 2022 at 8:38 AM Craig Janeczek <cdjan...@gmail.com> wrote:
I have a Gerrit server version 2.16.27 migrated to NoteDB which I am trying to move to a different host. This will be a one time cutover and replacement. 

I have manually copied over the full repositories, H2 databases (database.h2.db and account_patch_reviews.h2.db), and have confirmed the gerrit.serverId value matches between the old and new instances. I see the repositories, groups and users in the UI but do not see any of the reviews or old comments.

looks like you missed the indexes and their configuration under the index folder
 
Does anyone have tips on how to move gerrit instances between hosts?

Move the complete gerrit site directory and adapt the configuration files under etc/ ?
I think you can leave out the tmp directory. If you don't need the old logs you can remove them as well.

-Matthias

Craig Janeczek

unread,
Jan 5, 2022, 8:11:26 AM1/5/22
to Repo and Gerrit Discussion
Thank you for the guidance, that has resolved my issue.

Nasser Grainawi

unread,
Jan 5, 2022, 2:46:16 PM1/5/22
to Matthias Sohn, Craig Janeczek, Repo and Gerrit Discussion
For future, you can also refer to the backup doc which has info on what you need to be able to backup and restore Gerrit (potentially to a different host): https://gerrit-review.googlesource.com/Documentation/backup.html


-Matthias

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/CAKSZd3QpD5EXUHfRk-xxBS%2BGyA99CwmO969iPUnOB3A%3DSDKjjg%40mail.gmail.com.

Craig Janeczek

unread,
Jan 16, 2022, 2:24:10 PM1/16/22
to Repo and Gerrit Discussion
Copying the git, index and db directories along with validating the serverId fields matched worked for getting the new host up and running. I have found that if I run an online reindex everything continues to work, but if I run an offline reindex the changes all disappear. The accounts, groups, and projects are all ok.

Do you have any thoughts on what could cause this? I am concerned that there is something missing that will cause issues later on down the line.

Martin Fick

unread,
Jan 16, 2022, 2:52:42 PM1/16/22
to Craig Janeczek, Repo and Gerrit Discussion
On 2022-01-16 12:24, Craig Janeczek wrote:
> Copying the git, index and db directories along with validating the
> serverId fields matched worked for getting the new host up and
> running. I have found that if I run an online reindex everything
> continues to work, but if I run an offline reindex the changes all
> disappear. The accounts, groups, and projects are all ok.

This sounds like your offline reindex failed. What command did you run,
and did you run it as the gerrit user? What was the output, what was in
your etc/gerrit.config?

-Martin

--
The Qualcomm Innovation Center, Inc. is a member of Code
Aurora Forum, hosted by The Linux Foundation

Craig Janeczek

unread,
Jan 16, 2022, 3:56:52 PM1/16/22
to Repo and Gerrit Discussion
The offline reindex is not throwing any errors, but it does not seem to be picking up any changes

This is the command that I am running as the gerrit user
 reindex --verbose --index changes -d /mnt/gerritsite/

Here is the output of the reindex. It finds the correct number of projects, but it does not pick up any changes from the projects.
Collecting projects:    4
Reindexing changes: project-slices: 100% (4/4), done
Reindexed 0 documents in changes index in 0.1s (0.0/s)
Index changes in version 50 is ready

Martin Fick

unread,
Jan 16, 2022, 4:13:52 PM1/16/22
to Craig Janeczek, Repo and Gerrit Discussion
On 2022-01-16 13:56, Craig Janeczek wrote:
> The offline reindex is not throwing any errors, but it does not seem
> to be picking up any changes
>
> This is the command that I am running as the gerrit user
> reindex --verbose --index changes -d /mnt/gerritsite/
>
> Here is the output of the reindex. It finds the correct number of
> projects, but it does not pick up any changes from the projects.
> Collecting projects: 4
> Reindexing changes: project-slices: 100% (4/4), done
> Reindexed 0 documents in changes index in 0.1s (0.0/s)
> Index changes in version 50 is ready

My best guess is that your site isn't really fully Notedb migrated,
and it cannot find the changes in the git repos. You should be able
to investigate to see if you have the notedb meta refs for each
change in your repo (like refs/change/01/01/meta), if you don't,
then you likely did not actually migrate to notedb as you believe
you did,

Craig Janeczek

unread,
Jan 16, 2022, 5:12:44 PM1/16/22
to Repo and Gerrit Discussion
Resolved the issue, thank you for the information.

I  confirmed that I see meta entries such as refs/changes/00/1700/meta for each change in the packed-refs file in the repositories. Comparing the old and new sites, I realized there was a notedb.config file which did not exist on the new site. Once I copied that file over and re-ran the reindex the changes were detected and showed up in the UI.
Reply all
Reply to author
Forward
0 new messages