fredbcode / Vrrpd

Project moved to https://gitlab.com/fredbcode/Vrrpd Advanced Vrrpd That version has many improvements like monitoring other vrrpd processes and executing a command when changing back and forth from master to backup. You can also use atropos program for view or change global state. VRRP For Linux
https://gitlab.com/fredbcode
GNU General Public License v2.0
75 stars 31 forks source link

Support setup priorities after SIGTTIN and SIGTTOU #1

Closed ivan-zhiltsov closed 10 years ago

ivan-zhiltsov commented 10 years ago

I made small improvemnts to fit my need that don't break nothing and adding:

Two optional command line arguments (x,z) with value of priorities. If this arguments exists, calling signal SIGTTIN and SIGTTOU instead of increment/decrement priority of running process, it will set values for command line.

I use it in my system to make server "higher as master" or "higher as backup".

For me it is better than just increment/decrement priority because I can send signal many times in case of some event in my network and don't broke logic: with old variant it was possible this case: original priority was, for example, 50 secondary server had, for example, 45 and it was in backup mode. for some reason we need to make primary server as backup and send signal SIGTTIN it change priority to 40 and become backup if we send SIGTTIN again, its priority changes to 30

after that we want revert config to make first server as master we send SIGTTOU and it increment priority, but if SIGTTIN was send twice or more, server don't become to master.

With this patch I am able to not worry about how many times I called signals to make server backup or master, and sure what priority is set after calling signal.

If command line arguments not set - all works as it was before.

PS. command line arguments named "z", "x" because a failed to create more correct letters for this, all my variants was already used by other options :(

fredbcode commented 10 years ago

Hello, Very interesting, we can already use atropos --backup to force the state, I think it should be better and more easier for user to also add this options in atropos (atropos --master so)

ivan-zhiltsov commented 10 years ago

yes, you are right. I didn't find --master in atropos and vrrpd, so created this. I will read code more, and maybe will try to make it, but I'm afraid I will need another signal handler to this ))

But for my task it dont fit. I am creating NAT/Shaper farm and i'm trying to make all nodes active at the same time.

So at all my whole system will be like this: I got 4 nodes and lots of vlan with clients. I distribute vlans between nodes each node has:

And I want to redistribute each vlan to 2 or 3 nodes, so some vrrpd instances will be master, some backup. In case of signle node failure its primary vlans will be UPed by other nodes evenly. (and associated external IPS to by UP/DOWN scripts)

My patch for me is needed for part that checks status of external interface witch don't has vrrp, i will listen and check that I got default route from network core (i think by some shell script over 'ip monitor route') and if I don't recieve it i will set priorities to make all vrrpd instances as backup, if default route reverts I will revert vrrpd's to normal state: some master, some backup

fredbcode commented 10 years ago

And I want to redistribute each vlan to 2 or 3 nodes, so some vrrpd instances will be master, some backup.

You mean, asynchronous on same system ? Something like eth0 master, eth1 backup, etc ? So you should disabled monitoring or at least use -M 1

With atropos --backup you can with a script, but maybe I misunderstand something, if the default route is missing the system will be backup and the other master, and if there is no default route the two will be backup, where is the problem, the asynchronous Interfaces ?

fredbcode commented 10 years ago

yes, you are right. I didn't find --master in atropos and vrrpd, so created this. I will read code more, and maybe will try to make it, but I'm afraid I will need another signal handler to this ))

Yes certainly, or maybe a kind of loop (like atropos --backup) who increase the value and check the state (if Master -> stop the loop)

fredbcode commented 10 years ago

If vrrpd run with -x : Set the priority after SIGTTOU (not increment as default) If vrrpd run with -z : Set the priority after SIGTTIN (not decrement as default)

So atropos --reduce not decrement as default, and atropos --increase not increment as default