Question on Loadbalanced High-Availability MYSQL/Apache Cluster

Discussion in 'HOWTO-Related Questions' started by Pichi_B, Jul 25, 2007.

  1. Pichi_B

    Pichi_B New Member

    Hello,

    I just finished setting up the How To's for Falkos High Availability Apache Cluster and High Availibility MYSQL Cluster. I did this on Debian Etch servers. So I could see that the differneces in the setups were the contents of the ldirectord.cf file. This is the file that controls the virtual server.

    My question is:

    Is there a way to combine the two virtaul servers (apache and mysql). I mean each How To tells us how to cluster one service i.e MYSQL or Apache. What I would like to do is cluster MYSQL and Apache on the same servers. Does the ldirectord.cf allow for more than one service to be virtualized?

    I would go ahead and try this but I dont want to blow up what took me a few days to set up. I am a complete noob to LINUX and so I am doing all this slowly and trying to learn as much as possible.

    Thank you for your help and especially to Falko for his great documentation,

    Pete
    Granada Spain
     
  2. Pichi_B

    Pichi_B New Member

    OK after a while I got brave and changed the ldirectord.cf file myself. I included the two services (MYSQL & Apache) like so:

    Code:
    checktimeout=10
    checkinterval=2
    autoreload=no
    logfile="local0"
    quiescent=yes
    
    virtual=192.168.0.105:80
            real=192.168.0.101:80 gate
            real=192.168.0.102:80 gate
            fallback=127.0.0.1:80 gate
            service=http
            request="ldirector.html"
            receive="Elvis has left the building!"
            scheduler=rr
            protocol=tcp
            checktype=negotiate
    
    
    # Global Directives
    checktimeout=10
    checkinterval=2
    autoreload=no
    logfile="local0"
    quiescent=yes
    
    virtual = 192.168.0.105:3306
            service = mysql
            real = 192.168.0.101:3306 gate
            real = 192.168.0.102:3306 gate
            checktype = negotiate
            login = "ldirector"
            passwd = "ldirectorpassword"
            database = "ldirectordb"
            request = "SELECT * FROM connectioncheck"
            scheduler = wrr
    
    I then rebooted the two load balancers and issued the following command:

    Code:
    bubba:/home/pete# ipvsadm -L -n
    IP Virtual Server version 1.2.1 (size=4096)
    Prot LocalAddress:Port Scheduler Flags
      -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
    TCP  192.168.0.105:80 rr
      -> 192.168.0.101:80             Route   1      0          0
      -> 192.168.0.102:80             Route   1      0          0
    TCP  192.168.0.105:3306 wrr
      -> 192.168.0.101:3306           Route   1      0          0
      -> 192.168.0.102:3306           Route   1      0          0
    bubba:/home/pete#
    
    Seeing this was what I wanted. I was able to access both services via the virtual address 192.168.0.105. I added rsync for Apache using this How To:

    http://www.howtoforge.com/mirroring_with_rsync

    This gave me all the functionality I was looking for:

    1. Replicated MYSQL databases
    2. Mirrored Apapche Servers
    3. Loadbalancing of services
    4. Fault-tolerence of services

    My next question would be how can I take advantage of this technology for my mail server which really is the most important service I have.

    Thanks again to anyone who can help,

    Pete
    Granada Spain
     
  3. falko

    falko Super Moderator ISPConfig Developer

    I think the best would be to create backup MX: http://www.howtoforge.com/postfix_backup_mx
     
  4. Pichi_B

    Pichi_B New Member

    Production ready??

    Hello Again,

    Having finished the How To's High Availability Apache Cluster , High Availibility MYSQL Cluster, and Mirroring with Rsync I am wondering if I can go ahead and put this into a production enviroment?

    The reason I am unsure is the version for MYSQL-MAX (now called MAXDB)in the How To is 5.0 and the currrent version is 7.5. I am unaware of how older versions of software are updated in the LINUX world. Are older versions safe to use?

    So simply put would you feel comfortable running mysql-max 5.0 on a publically available server?

    Another reason we are reluctant to use 7.5 is that it requires X and that could lead to security issues.

    Thanks again,

    P.
     
  5. falko

    falko Super Moderator ISPConfig Developer

  6. chris.zeman

    chris.zeman New Member

    I have two questions regarding this tutorial.


    1. Can I configure the cluster using a clean lamp install, or do I need to follow everything step-by-step?
    2. Can I omit the second load-balancer?

    Thank you,
    Chris
     
  7. falko

    falko Super Moderator ISPConfig Developer

    I recommend to do it step-by-step, but you can also start with a clean LAMP system.
    Yes, but then you lose high-availability because the load balancer that is left becomes a single point of failure.
     
  8. chris.zeman

    chris.zeman New Member

    Thank you, Falko. I might just have to see what I can do about getting just one more server. I'll probably wipe the clean LAMP install of Ubuntu I have on the two MySQL nodes and do it step-by-step like you said. :)

    Thanks!
    Chris
     
  9. chris.zeman

    chris.zeman New Member

    I am to the point of install UltraMonkey, but I am having the following problem:
    Code:
    cybernetics@LoadBalancer1:/var/lib/mysql-cluster$ sudo apt-get install ultramonkey libdbi-perl libdbd-mysql-perl libmysqlclient14-dev
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package libmysqlclient14-dev is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
      libalps-heap1-dev
    E: Package libmysqlclient14-dev has no installation candidate
    cybernetics@LoadBalancer1:/var/lib/mysql-cluster$
    Should I install libalps-heap1-dev instead, or use libmysqlclient15-dev?

    Thank you,
    Chris
     
  10. chris.zeman

    chris.zeman New Member

    I went ahead and installed libmysqlclient15-dev.

    Now, I tried to bring up lo:0, but here's what happened:
    Code:
    cybernetics@Automation:/var/lib/mysql-cluster$ sudo ifup lo:0
    SIOCSIFFLAGS: Cannot assign requested address
    lo:0 is up, so can I just ignore the error message?

    Thank you,
    Chris
     
  11. chris.zeman

    chris.zeman New Member

    ...and this. lol

    Code:
    cybernetics@LoadBalancer1:/etc/ha.d$ sudo /etc/init.d/ldirectord stop
    /etc/init.d/ldirectord: 36: Syntax error: "}" unexpected (expecting "fi")
    cybernetics@LoadBalancer1:/etc/ha.d$
     
  12. falko

    falko Super Moderator ISPConfig Developer

    What's in /etc/init.d/ldirectord?

    Can you double-check that your setup is as close as possible to the one in the tutorial?

    I'd install libmysqlclient15-dev.
     

Share This Page