[OpenSIPS-Users] clusterer_shtag_set_INactive
Alexey
slackway2me at gmail.com
Fri Jun 20 11:45:26 UTC 2025
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/
More information about the Users
mailing list