detection of primary server failure
Posted in 2004
I posted this question few days back and got no reply. There is an unusual lull in the number of postings in c.d.i. May be Americans are still in thanksgiving mode. I am posting again. IDS921UC4. Informix has disabled DRAUTO in this version (and all subsequent versions). Now switching of the secondary server from read-only to standard mode (when the primary server goes down) has to be done manually. I tried looking at documentation to find out whether Informix on the secondary server sends an alarm when it finds the primary server down. I could not find any. So that leaves me with a polling script to determine when the primary goes down and take action accordingly. if a program to poll is the only way to go,then I am thinking of a program something like below (in "C" for maximum efficiency) connect to sysmaster on the primary server. prepare a cursor for select 1 from systables where tabid = 1 ; while (true) open cursor if (SQLCODE != 0 ) then /* something happened to the primary server */ exit(-1); end if ; close cursor sleep(3) end while So I assume it will take around 5 seconds for the above program to conclude that the primary server is down. To keep the impact minimum on the server, cursor is declared outside the loop so that it does not have to parse the SQL every time. Is there a better way of doing it. TIA.