Failover with 4 servers

This forum is for everyone having trouble with linking two UnrealIRCd servers

Moderator: Supporters

Locked
orodriguez
Posts: 2
Joined: Wed Jul 26, 2017 2:52 pm

Failover with 4 servers

Post by orodriguez »

Hello,
Currently I am experiencing some issues in regards to failover topology. The starting topology is currently setup to have all servers directly connect to server.1; once server.1 disconnects the idea is to have server.3 and server.4 directly connect to server.2. Finally, if server.2 goes offline, i would like server.3 and server.4 to connect to each other. Using the deny link block I have tried a few different combinations and have not succeeded yet. Are there any examples that can be shared?
I am using the unsecure option for linking servers, my link blocks look as follows:

Code: Select all

link server.1 
{
	incoming {
		mask *;
	};
	outgoing {
		bind-ip *; /* or explicitly an IP */
		hostname  server.2;
		port 7777;
		options { insecure; autoconnect; };
	};
	password "password"; 
	hub *;
	class servers;
};
using the deny link block I have attempted to block connection between nodes; the base case where all nodes directly connect to server.1 is not an issue using the following deny link block on server.2, server.3, and server.4

Code: Select all

/*server.3 deny link looks as follows */
deny link {
        mask server.2;
        rule !connected(server.1);
        type auto;
};

deny link {
        mask server.4;
        rule !connected(server.1)&&directcon(server.2);
        type auto;
};
any help would be greatly appreciated, thank you in advance
Syzop
UnrealIRCd head coder
Posts: 2112
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Re: Failover with 4 servers

Post by Syzop »

Right, so you have the case where server 2+3+4 are connected to 1. And you have the case where 1 is unavailable and you want 3+4 connected to 2.

I'm going to assume you have an autoconnect from 2+3+4 to 1 and from 3+4 to 1 and 2...
This by itself will already make sure 3+4 are either connected to 1 or to 2... but it doesn't "enforce" your policy that you prefer the servers to be connected to server 1 instead of server 2. Which is what you want, right?

I think the best way to achieve this is to have two deny link { } blocks on server 2: if it is connected to server 1, then it will reject (direct) incoming links from server 3 and 4.
That means adding this configuration to server 2 only:

Code: Select all

/* This goes in the config on server.2 */

deny link {
        mask server.3;
        rule directcon(server.1); /* reject this link as long as we are connected to server 1 */
        type all;
};

deny link {
        mask server.4;
        rule directcon(server.1); /* reject this link as long as we are connected to server 1 */
        type all;
};
So, you have the above deny link { } blocks only on server.2. You don't need any deny link { } blocks on the other servers.

Sorry I didn't test this. So, I hope it works.

What deny link { } blocks will not help you with:
This may be obvious, but... what this will not prevent is that if your "backup scenario" happens, so 3+4 linked to 2 (and 1 is down), then when server 1 comes back online server 2 will link to 1 but it won't magically re-link your servers 3 and 4 to 1, they will stay connected to 2.
Personally, I don't use deny link { } blocks myself because of this. I can live with either server1 or server2 acting as a hub or a combination of both.
The alternative is to re-link servers manually after server 1 gets back with /SQUIT and /CONNECT them but IMO it only causes noise (unnecessary netsplits) that is not sufficiently warranted. Of course, your network may be different and the options are there so everyone can make his/her own choice with regards to this.
Locked