Safely removing controller machines

Hello folks,

I’m trying to rebalance the controller machines and I keep hitting this error:

juju remove-unit -m controller controller/0
ERROR removing unit controller/0 failed: removing units from the controller application not supported

I have three juju controller machines - I want to add a fourth controller, then remove controller/0 (machine 0)

I think I can remove the machine if I run a juju remove-machine --force 0, my question is - will this cause damage to my controller? if I do this after adding the fourth machine

Thanks, Peter

You cannot mess with the controller application. But you can remove-machine (without force) a controller machine. Mongo will downgrade the cluster to 1 voting machine with 1 standby. Then you can run enable-ha and it will create a new controller machine and reconfigure the mongo replicaset.

If you remove the primary machine, the controller api server will briefly stop responding (eg juju status will block) while the cluster reconfigures itself. Removing a secondary is “instant”. show-controller command will give you the info on how the controllers are set up.

You can also add a machine ahead of time and use --to with enable-ha to upgrade the machine to a controller.

1 Like

Perfect, I’ll take a look, thank you @wallyworld !