#1 2014-07-04 23:16:02

mikho
Low End Mod
From: Hell and gore == Sweden
Registered: 2013-03-02
Posts: 1,520
Website

dokuwiki - High Availability

HI!

this is a short post so that I can remember to get the complete story out here.
After the suggestion to create a wiki for LES I thought it would be a nice test what could be done with a bunch of LES.

Testing the waters and failing multiple times with the setup I had in mind (more details later) I now have three (3) LES replicating the information.
IT being the "main server" with slaves in UK and US.

Every five minutes the content is synced. All servers are behind cloudflare and you will see which country that serves your pages by the little flag in the top left corner.

so the URLs:
the one to use is wiki.mikho.pw
but you can reach the different servers with
it.mikho.pw
uk.mikho.pw
us.mikho.pw

I'm still pondering on how/what to use to monitor this setup (think I will use my PRTG probe and some PowerShell scripting).

What I want is a GEO-DNS solution, so I might change to Rage4 and add some HAProxy entries on each location.

Offline

#2 2014-07-05 01:10:54

5n1p
Trusted Member
Registered: 2013-04-02
Posts: 235
Website

Re: dokuwiki - High Availability

How do you sync content? Rsync?

Offline

#3 2014-07-05 13:52:27

mikho
Low End Mod
From: Hell and gore == Sweden
Registered: 2013-03-02
Posts: 1,520
Website

Re: dokuwiki - High Availability

Content is synced with Unison.
Upgrades of dokuwiki are made with rsync.

Offline

#4 2014-07-05 15:38:49

5n1p
Trusted Member
Registered: 2013-04-02
Posts: 235
Website

Re: dokuwiki - High Availability

OK.

About monitoring for IPv6  you could use something like this:

import subprocess
import shlex
import time
 
servers = ["iplog.pw", "jp.iplog.pw", "uk.iplog.pw"]
 
def server_check():
    server_down = []
    for server in servers:
        command_line = "ping6 -c 1 %s" % server
        args = shlex.split(command_line)
        try:
            subprocess.check_call(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            print "%s is up" % server
        except subprocess.CalledProcessError:
            print "%s is down" % server
            server_down.append(server)
            print "Down servers: ", server_down
 
if __name__ == "__main__":
    while True:
        server_check()
        time.sleep(10)

This script would ping ipv6 with 1 packet every 10 seconds. Ofc. this is very simple it would need more work. And it would need function to change DNS records if server is 'down' and then again when server is 'up'.

Here is sample output for some of my LES's:

$python simpleping.py
iplog.pw is up
jp.iplog.pw is down
Down servers:  ['jp.iplog.pw']
uk.iplog.pw is down
Down servers:  ['jp.iplog.pw', 'uk.iplog.pw']
iplog.pw is up
jp.iplog.pw is up
uk.iplog.pw is down
Down servers:  ['uk.iplog.pw']
iplog.pw is up
jp.iplog.pw is down
Down servers:  ['jp.iplog.pw']
uk.iplog.pw is down
Down servers:  ['jp.iplog.pw', 'uk.iplog.pw']
iplog.pw is up
jp.iplog.pw is down
Down servers:  ['jp.iplog.pw']
uk.iplog.pw is up
iplog.pw is up
jp.iplog.pw is up
uk.iplog.pw is down
Down servers:  ['uk.iplog.pw']
iplog.pw is up
jp.iplog.pw is up
uk.iplog.pw is up

Ofc. this would change there would be no output it would be logfile.

Offline

#5 2014-07-05 16:32:21

mikho
Low End Mod
From: Hell and gore == Sweden
Registered: 2013-03-02
Posts: 1,520
Website

Re: dokuwiki - High Availability

I have a prtg node that is monitoring some of my servers already, there is the option to execute a program on the monitoring node (windows).
A simple task would be to remove the AAAA record for wiki.mikho.pw for the server that is down.
Next part to monitor is the bandwidth used, for instance Sydney and Tokyo has very low bandwidth.

Offline

#6 2014-07-20 21:32:00

mikho
Low End Mod
From: Hell and gore == Sweden
Registered: 2013-03-02
Posts: 1,520
Website

Re: dokuwiki - High Availability

I finally found time to write down the installation steps I made to create the wiki. If you are interested, read about it in the wiki: http://wiki.lowendguide.com/doku.php?id=wiki_setup smile

Offline

Board footer

Powered by FluxBB