Configuring MSR for NFS

Configuring MSR for NFS

You can configure MSR to store Docker images in an NFS directory. Starting in MSR 2.6, changing storage backends involves initializing a new metadatastore instead of reusing an existing volume. This helps facilitate online garbage collection. See changes to NFS reconfiguration below if you have previously configured MSR to use NFS.

Before installing or configuring MSR to use an NFS directory, make sure that:

  • The NFS server has been correctly configured
  • The NFS server has a fixed IP address
  • All hosts running MSR have the correct NFS libraries installed

To confirm that the hosts can connect to the NFS server, try to list the directories exported by your NFS server:

showmount -e <nfsserver>

You should also try to mount one of the exported directories:

mkdir /tmp/mydir && sudo mount -t nfs <nfs server>:<directory> /tmp/mydir

Install MSR with NFS

One way to configure MSR to use an NFS directory is at install time:

docker run -it --rm docker/dtr:2.7.5 install \
  --nfs-storage-url <nfs-storage-url> \
  <other options>

Use the format nfs://<nfs server>/<directory> for the NFS storage URL. To support NFS v4, you can now specify additional options when running mirantis/dtr install with --nfs-storage-url.

When joining replicas to a MSR cluster, the replicas will pick up your storage configuration, so you will not need to specify it again.

Reconfigure MSR to use NFS

To support NFS v4, more NFS options have been added to the CLI.

Warning

When running DTR 2.5 (with experimental online garbage collection) andMSR 2.6.0 to 2.6.3, there is an issue with reconfiguring and restoring MSR with --nfs-storage-url which leads to erased tags. Make sure to back up your MSR metadata before you proceed. To work around the --nfs-storage-url flag issue, manually create a storage volume. If MSR is already installed in your cluster, reconfigure MSR<msr-cli-reconfigure> with the --dtr-storage-volume flag using your newly-created volume.

See Reconfigure Using a Local NFS Volume for Docker’s recommended recovery strategy.

MSR 2.6.4

In MSR 2.6.4, a new flag, --storage-migrated has been added to mirantis/dtr reconfigure which lets you indicate the migration status of your storage data during a reconfigure. Upgrade to 2.6.4 and follow Best practice for data migration in 2.6.4 when switching storage backends. The following shows you how to reconfigure MSR using an NFSv4 volume as a storage backend:

docker run --rm -it \
  docker/dtr:2.7.5 reconfigure \
  --ucp-url <mke_url> \
  --ucp-username <mke_username> \
  --nfs-storage-url <msr-registry-nf>
  --async-nfs
  --storage-migrated

To reconfigure DTR to stop using NFS storage, leave the --nfs-storage-url option blank:

docker run -it --rm docker/dtr:2.7.5 reconfigure \
  --nfs-storage-url ""