Ceph with 2 stand-alone lxd instances


I had a 2 node LXD cluster (yes I know, should be 3) but 2 servers are all I had the ability to use when setting this up. I had to reboot both servers at the same time and now by cluster is unable to start. I’ve decided it is best to go with stand-alone and make each of them remotes to the other.

Before I had a ceph backend shared between them. Am I able to add this backend back as is and import the existing containers? Also am I able to use the same shared pool between 2 or more stand-alone LXD instances?

Note that if you were to deploy current LXD now, only one of your two servers would act as a database server. Losing it would break your cluster for good, but it’s better than the previous state where losing either would break the cluster :slight_smile:

There’s also a very good chance that we can get your cluster back online if you want to go down that path instead of reinstalling.

Anyway, on the reinstalling front, you need a separate OSD pool per LXD installation, so you’d need two pools. You can import the existing one into the first server though by manually mounting the various RBD volumes at their normal spot under /var/snap/lxd/common/lxd/storage-pools/POOL/containers/NAME, once that’s done, you can use lxd import NAME to re-create the DB state of the container. It’s not perfect but it usually does the job.

I’d suggest importing all the containers back onto one of the two servers, bringing up the second one empty with a fresh OSD pool, then move the containers from one server to the other to balance things.

Thanks. I have moved forward with stand-alone. I have successfully mounted and imported several containers. but when I reboot them they unmount. this was my process.

Note: I am not using snap but local install.

  1. rbd map pool/container --name client.admin -m ceph-mon
  2. mount /dev/rbd2 /var/lib/lxd/containers/container
  3. lxd import container
  4. lxc shell container
  5. modify some settings
  6. reboot command
  7. container is stopped and the mount is gone
  8. I can successfully remount and start the container

running df the mount shows up as but this is missing after reboot.
/dev/rbd2 28773028 17168164 10321572 63% /var/lib/lxd/storage-pools/remote/containers/container

How can I make these stay for the imported containers?