bk31415 0 Posted Saturday at 04:48 PM I am writing an (MQTT) broker (serves) that serves about 100 clients. None of this out of ordinary. But, I'd like the machine this thing runs on to have a live backup machine. I.e. an identical machine that takes over in case the master fails. IOW, a High Availability situation. I will be using Windows 11 Pro or Enterprise and both machines will be idetical (clones), except for their static IP addresses. Box A will have, say, 10.xxx.yyy.1 and the other 10.xxx.yyy.2 They will continously ping one another to check that the other is alive. When both are alive, box A will activate a second IP address, such as, 10.xxx.yyy.3 which is the address MQTT broker is listens at. Box B does nothing of the sort. When box A is dead, then box B is activates IP address 10.xxx.yyy.3 where box B's MQTT broker is listening. This is the idea, at least. The first question is, is there a ready-made solution under Windows? Failing that, second question is, do you think this can work? Third question is: How do I dynamically add/remove a second IP address using Delphi? Share this post Link to post
Angus Robertson 647 Posted Saturday at 05:39 PM Not sure how quickly your network will recognize that an IP address has moved between devices, that is something that does not happen very often. Each client will need to refresh its ARP cache table to find the MAC of the new PC. WMI can be used to change IP addresses, ICS has a free WMI component and sample that sets IP addresses and gateway. A better solution would be for the clients to know about each server, and use the secondary if the primary fails to respond. Angus Share this post Link to post
bk31415 0 Posted Saturday at 05:51 PM (edited) 15 minutes ago, Angus Robertson said: Not sure how quickly your network will recognize that an IP address has moved between devices, that is something that does not happen very often. Each client will need to refresh its ARP cache table to find the MAC of the new PC. WMI can be used to change IP addresses, ICS has a free WMI component and sample that sets IP addresses and gateway. A better solution would be for the clients to know about each server, and use the secondary if the primary fails to respond. Angus Instead of PING, I can use TCP/UDP client-server code to check one another, which might be simpler. The network consists of 1G/10G wired backend, as well as Wifi5 (2.4 + 5G) which is fairly fast and stable. Ideally, it would be much simpler if I could tell the clients to communicate with 2 (or more) brokers/servers, but I have no control over that feature on the clients which are sometimes tiny IOT devicess. As a result, I have resorted to this idea. BTW, I am using ICS (your brain child) and would like to thank you for it. I have heavily modified the MQTT code. When finished, I might submit it for the next major version. Thank you again. Edited Saturday at 05:56 PM by bk31415 Share this post Link to post
bk31415 0 Posted Saturday at 05:55 PM 11 minutes ago, Angus Robertson said: Not sure how quickly your network will recognize that an IP address has moved between devices, that is something that does not happen very often. Each client will need to refresh its ARP cache table to find the MAC of the new PC. I missed this, hence overlooking the ARP table issue. Don't switches publish updates to ARP table changes up (and down) stream in near-real time? Share this post Link to post
Anders Melander 2001 Posted Saturday at 08:37 PM 3 hours ago, bk31415 said: But, I'd like the machine this thing runs on to have a live backup machine. I.e. an identical machine that takes over in case the master fails. IOW, a High Availability situation. IOW, a failover cluster. Have you considered a Windows Workgroup cluster? I believe they can be built fairly cheap. Share this post Link to post
bk31415 0 Posted Saturday at 08:52 PM 12 minutes ago, Anders Melander said: IOW, a failover cluster. Have you considered a Windows Workgroup cluster? I believe they can be built fairly cheap. Call it what you will, but hate the Server versions of Windows with passion. I have installed various versions over the years only to wipe the disks a week later. I'd have never thought I's have such strong feelings against an OS, but WWindows Servers just rub me the wrong way. I am looking for a solution that runs on consumer versions of Windows. I am hoping there's a way to do it. Share this post Link to post
Anders Melander 2001 Posted Saturday at 09:06 PM So this is a hobby project. Right? Share this post Link to post
bk31415 0 Posted Saturday at 09:18 PM 7 minutes ago, Anders Melander said: So this is a hobby project. Right? You could call it that if you go by the choice on the Windows version. But, it isn't really. While me using Delphi may look it, it will be used in professional/serious environment. Share this post Link to post
Anders Melander 2001 Posted Saturday at 09:24 PM Then I think you need to familiarize yourself with the Windows EULA. Share this post Link to post
bk31415 0 Posted Saturday at 09:34 PM Just now, Anders Melander said: Then I think you need to familiarize yourself with the Windows EULA. Specifically what? I mean, I can assign not just one but several IP addresses to a single NIC under Win11 Ent which I have been able to do for who knows how long. What could be in the EULA to forbid it, while the OS freely allows it? All I want to do is to just that under my own program's control. Share this post Link to post
Attila Kovacs 658 Posted Saturday at 09:38 PM (edited) if you're turning the machine into a server that violates terms intended for client/desktop use, i think you mixed something up, you meant it's running on the server version, and you like it Edited Saturday at 09:40 PM by Attila Kovacs 1 Share this post Link to post
Anders Melander 2001 Posted Saturday at 09:42 PM Just now, Attila Kovacs said: if you're turning the machine into a server that violates terms intended for client/desktop use Exactly. Read the EULA. Search for "server". It's stated pretty clearly what you can and cannot do. Share this post Link to post
bk31415 0 Posted Saturday at 09:43 PM 3 minutes ago, Attila Kovacs said: if you're turning the machine into a server that violates terms intended for client/desktop use, i think you mixed something up, you meant it's running on the server version, and you like it This must be the strictest possible interpretation out there. I wander what all those people running Web Servers on their personal machines on consumer OSes say about this. Share this post Link to post
Anders Melander 2001 Posted Saturday at 09:54 PM 2 minutes ago, bk31415 said: This must be the strictest possible interpretation out there. No it's not; You are not allowed to use a desktop Windows as a server. What other people that violate the license say about that isn't really relevant. Quote Installation and Use Rights. Restrictions. For the avoidance of doubt, this license does not give you any right to, and you may not (and you may not permit any other person or entity to): ... use the software as server software or to operate the device as a server, except as permitted under Section 2(d)(iii) below; use the software to offer commercial hosting services; make the software available for simultaneous use by more than one user over a network, except as permitted under Section 2(d)(vi) below; install the software on a server for remote access or use over a network; or install the software on a device for use only by remote users; Share this post Link to post
bk31415 0 Posted Saturday at 10:01 PM I think this discussion is starting to go nowhere. Assigning a different IP address to NIC is already doable with: netsh interface ip set ... here is also a Youtube one. All I want to do is that. Using Delphi. And, I am perfecly fine with "I don't know" or no replies. Quote Share this post Link to post
bk31415 0 Posted Saturday at 10:03 PM (edited) 7 minutes ago, Anders Melander said: Quote install the software on a server for remote access or use over a network; or install the software on a device for use only by remote users; Second part applies. Edited Saturday at 10:03 PM by bk31415 Share this post Link to post
Anders Melander 2001 Posted Saturday at 10:06 PM 1 minute ago, bk31415 said: Second part applies. You mean you are "installing the software on a device for use only by remote users"? Share this post Link to post
bk31415 0 Posted Saturday at 10:13 PM Anders, I love the nitpicking. Still, let me answer: No, not userS. Not plural. Both machines (A and B) single-user, they will access one another over the local network --not from Internet or similar. If this is sin in M$ religion, I'll immediately stop using anything that acceses another machine (such as SSH), I promise. Share this post Link to post
bk31415 0 Posted Saturday at 10:28 PM Thank you guys. I thought this was a good place to ask technical questions as opposed to philosophical or legal ones. Apparently, I was wrong. Here is the answer using command line. I will use TProcess (ported from FP/Lazarus) until I find a way to do all that natively. Share this post Link to post
Anders Melander 2001 Posted Saturday at 10:30 PM 5 hours ago, bk31415 said: I am writing an (MQTT) broker (serves) that serves about 100 clients. 9 minutes ago, bk31415 said: Both machines (A and B) single-user, they will access one another over the local network --not from Internet or similar. Alright then. So you are going to violate the license and don't want that aspect discussed. That's between you, Microsoft, and whatever unfortunate user/client, if any, this involves but maybe you shouldn't ask us to help you do it. Share this post Link to post
bk31415 0 Posted Saturday at 10:34 PM Just now, Anders Melander said: maybe you shouldn't ask us to help you do it. OK. Share this post Link to post
Angus Robertson 647 Posted 21 hours ago Quote BTW, I am using ICS (your brain child) and would like to thank you for it. I have heavily modified the MQTT code. When finished, I might submit it for the next major version. Please make sure you are using MQTT from SVN or the overnight zip, I did a major rewrite a couple of months ago that is not yet released. Coming back to your original problem, the best solution will be a new wrapper component around the ICS MQTT client, that handles reconnection if the connection drops, including using a list of IP addresses for multiple servers. This will avoid applications needing to handle all the reconnection stuff, which is tedious. I'll put it on my list, but it may not make the next release, which is already overdue. The TIcsIpStrmLog client component already does reconnections, just need to take those properties and methods. Angus Share this post Link to post