[OpenSIPS-Users] clusterer_shtag_set_INactive
Wadii
wadii.elmajdi at gmail.com
Fri Jun 20 13:01:30 UTC 2025
hello
I had a similar setup, you can avoid the split brain issue by not
hardcoding the sharing_tag active state in clusterer module config
Either set both servers to start with 'backup' state / 'none' by removing
the param entirely, then few seconds after startup via startup_route each
server checks if it actually has the VIP and only then sets itself active
if needed.
startup_route {
launch(exec("sleep 10 && /path/check_vip.py",, $var(out), $var(err)),
vip_check_route);
}
This way reality determines who's active, not config files
Le ven. 20 juin 2025 à 13:48, Alexey <slackway2me at gmail.com> a écrit :
> Hi list, hi Team,
>
> I would like to know if it is possible to add one more
> MI command for the clusterer module, which will be
> the opposite for the 'clusterer_shtag_set_active' command.
>
> E.g. 'clusterer_shtag_set_inactive'.
> It could be very useful in some scenarios.
>
> We have an active/standby cluster based on Keepalived.
> And Keepalived is configured with the ability to be switched
> manually from active to standby. I mean that the keepalived.conf
> on both nodes has these two not default options:
>
> state BACKUP # both must be BACKUP for nopreempt to work
> nopreempt
>
> And keepalived is configured to execute the script when the node
> becomes active (or 'master' in keepalived terminology):
>
> ...
> vrrp_instance voip {
>
> notify_master "/etc/keepalived/master-backup.sh MASTER"
> notify_backup "/etc/keepalived/master-backup.sh BACKUP"
> notify_stop "/etc/keepalived/master-backup.sh STOP"
> notify_fault "/etc/keepalived/master-backup.sh FAULT"
> ...
>
>
> And this script runs MI command:
>
> ...
> /usr/bin/opensips-cli -x mi clusterer_shtag_set_active vip/1
> ...
>
> Keepalived works well.
>
> One OpenSIPS node has the following configuration
> of the clusterer module and sharing_tags:
>
> ...
> modparam("clusterer", "sharing_tag", "vip/1=active")
> ...
>
>
> The other one - the following:
> ...
> modparam("clusterer", "sharing_tag", "vip/1=backup")
> ...
>
>
> So, if the state of nodes changes, we can run MI command
> 'clusterer_shtag_set_active' triggered by Keepalived state change,
> and we do it.
>
> But if the first node is rebooted, OpenSIPS starts with the configured
> options -
> modparam("clusterer", "sharing_tag", "vip/1=active") .
>
> But because of 'nopreempt' option in keepalived.conf the state
> of the nodes remains unchanged (I configured it on purpose,
> it's convenient for me to be able to switch nodes manually and
> to decide which one will be active - I copied the behavior of AcmePacket
> SBC
> with these options).
>
> So, in some cases the situation bacomes as follows:
> the second node became active (either manually or because of some
> problems on the first node) and remains in active state.
>
> But after rebooting the first node OpenSIPS on it starts with
> modparam("clusterer", "sharing_tag", "vip/1=active") parameters.
>
> So, since that, both nodes are sure that each of them should have
> active sharing_tags.
> At the same time, keepalived on the first node enters backup state,
> because it sees that the second node is already in master state
> (nopreempt option works).
>
> If such a command existed, I could use it in keepalived config/script
> and run it during switching to backup, something like -
>
> /usr/bin/opensips-cli -x mi clusterer_shtag_set_INactive vip/1
>
>
> --
> best regards, Alexey
> https://alexeyka.zantsev.com/
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20250620/c434e111/attachment.html>
More information about the Users
mailing list