Manual installation - switching from running cockroach manually to using systemd


I’ve got a cluster of 3 cockroachDB nodes on my network (works great!) but have a question about switching to systemd when cockroach has been run with the manual commands in the background.

The first two nodes are running the service this way, with the manual commands in the background. I configured the third node to use systemd to manage the service.

I was going to swap the first two over to systemd today but realise that both nodes have a directory cockroach-data in my users home directory.

On node 3 this directory is located in /var/lib/cockroach/

Now, I’m assuming if I follow the docs to configure systemd, the cockroach-data directory will change.

Is it possible to migrate that data to the new location or will i lose it? What’s the best way to proceed?

Thanks :slight_smile:


It’s perfectly safe to move cockroach-data directories around, so I would try to move them to where you expect systemd will find them and see what happens. In either case, if you’re nervous, you can always “make a backup” of the cockroach-data directories by making a tarball or other copy method of your choice.

Hope that helps!

Hi @jordan thank you for replying!

That worked perfectly, I wasn’t sure if I could just copy the data or if I would need to edit the systemd unit file to point to a different working directory (the one in my home dir). Or, if both were an option which would be the best one.

Thanks for the help Jordan.