Is it possible to switch the master to candidate host via CLI?

Yes. After you configure different management hosts, you can run "egoconfig masterlist host2,host1". (The first host name in the list becomes the new master.) Then run egosh ego restart all on the new master host for the change to take effect.

You can also change the master host through the Platform Management Console.