LXD Cluster scenarios

Hi everyone,
I want to know about lxd clusters like how it works and scenarios?

Turning down a node in lxd using command lxd stop container name it automatically stops the node2 but what i need is does the node2 will be available when node1 is down.

Thanks.

You need a minimal of 3 LXD servers to operate a cluster which will not go offline when a server goes down.

Instances running on a server which goes down will be unavailable until that server comes back up, that’s unless you’ve got your storage on Ceph in which case you can move instances from an offline server to one which is online (manually) and then start them back up rather than wait for the server to come back online.

@stgraber if i use two servers does it work or not?

No, you need a quorum for the database to be redundant and you can’t get a quorum with just two systems.

In a two nodes cluster, losing either of them will render the database unusable until the lost node comes back.

@stgraber ok fine. can you share the procedure to cluster lxd with three nodes?

https://lxd.readthedocs.io/en/latest/clustering/

Please make sure you read available documentation before posting questions, thanks.

https://linuxcontainers.org/lxd/docs/master/clustering is the preferred location for that documentation (identical content but hosted by us).

1 Like

@stgraber @freeekanayaka while using this cmd( lxd init --preseed) no response from system.

That’s normal if you don’t feed it any input (again, this is covered in documentation).

it hangs without response after that cmd… is it normal!

If you don’t feed it input through stdin, it will hang indefinitely, yes, again, the example in the documentation shows how to use it.

after clustering i can see the node2 database is “NO”. what does it mean?

It means it’s not a database node and that if node1 goes offline everything will go offline as we mentioned earlier for redundancy you need at least 3 nodes at which point they all will be marked as database nodes.

if am having 3 nodes in this case if the next two nodes shows “NO” database what does it mean?
Does it mean installation is not successfull.

That may be indicative of a problem of some kind though role redistribution can take a little while to happen.

A 3 nodes cluster here looks like this:

+---------+------------------------------------------------------+----------+--------+-------------------+--------------+
|  NAME   |                         URL                          | DATABASE | STATE  |      MESSAGE      | ARCHITECTURE |
+---------+------------------------------------------------------+----------+--------+-------------------+--------------+
| fw01    | https://[2001:470:b2b5:1010::1]:8443                 | YES      | ONLINE | fully operational | x86_64       |
+---------+------------------------------------------------------+----------+--------+-------------------+--------------+
| fw02    | https://[2001:470:b2b5:1010::2]:8443                 | YES      | ONLINE | fully operational | x86_64       |
+---------+------------------------------------------------------+----------+--------+-------------------+--------------+
| infra01 | https://[2001:470:b2b5:1010:ec4:7aff:feab:2f68]:8443 | YES      | ONLINE | fully operational | x86_64       |
+---------+------------------------------------------------------+----------+--------+-------------------+--------------+

ok will try with 3 nodes.
This is a different case:
created a lxd cluster and then removed it, again trying to join a cluster through cmd lxd init but i get this err.
What IP address or DNS name should be used to reach this node? [default=192.168.1.244]:
Invalid input: Can’t bind address “192.168.1.244:8443”: listen tcp 192.168.1.244:8443: bind: address already in use