Sites Not Showing on mirror

Discussion in 'Installation/Configuration' started by Toucan, Jun 5, 2010.

  1. Toucan

    Toucan Member

    I have ISPconfig3 on my master server working with multiple sites.

    I have set up a mirror and it is showing as all services working on the master control panel.

    I'm using rsync to mirror all files in /var/www and subdirectories.

    If I browse:
    it displays the site correctly

    If I browse using it's domain name, it resolves to the main site /var/www/index.html

    Is there something else I need to do to get this backup server working?
  2. falko

    falko Super Moderator ISPConfig Developer

    Is the domain pointing to the master or the backup server?
  3. Toucan

    Toucan Member

    I have one public ip address which comes to a router
    The router forwards all ports to the internal ip
    All dns records point to the public ip address.
    The slave server is set as mirror
    rsync mirrors all the sites under var/www

    To test the slave I forwarded port 80 to slave instead of the master

    When I do this it any site request only shows the master index file under /var/www

    however, if I switch off the 'is mirror' setting, add the site to the second server the mirrored site displays correctly.

    Does that make sense?
  4. CSsab

    CSsab New Member

    Hi Toucan,
    Yes - it's clear what you are trying to test.

    I have thought about this also but I am wondering the following things:

    1. How is DNS forwarded to the slave? (In the past I have set up database replication - I had to tell the slave it was a slave and so on) In phpMyAdmin you can see if replication is set up.

    2. If the slave is a mirror and the master goes down (presumably the purpose of having a slave) how can the slave be configured to completely take over from the master temporarily?

    3. As I understand it - your setup suggests that you have things set up correctly because at the moment mirroring function sets up a blank template for all the sites you have on the master but doesn't transfer across your ACTUAL website.

    This means you'd have to have a way of making regular backups of your website on the master and then transferring them across to the slave. I have tried to do this with rsync with no success - permission issues etc.

    Another way I have been looking into for a single point of failure (having a single static (class C) ip is to use mutt to mail (hourly or daily) backups of my site to an external source (gmail in the case) so that they can be pulled down from gmail in case of the master going down.

    4. With your current situation - in the worst case scenario you'd have a record of any websites created on the slave if the master is lost with none of the changes you have made to your website.

    Correct me if I am wrong.
  5. Toucan

    Toucan Member

    In this example I am only changing port forwarding for port 80, so DNS is still handled by the master. At the moment my one server acts as the primary and secondary name server as it was also hosting all other services so if one was down the chance are they would all be. However, looking into the future, I would have a difference secondary name server ready to take over should the first not be available.

    The idea I think is, the will keep the services going although won't actually take over with a control panel. Not sure how a more permanent solution is made to take over as the master.

    The transer of the website is taken care of by rsync. It works very well. If i make even a minor change on the master, within five minutes or less, the change is mirrored on the slave. You mention you had permission problems with this? Are you talking about after the mirroring or in the mirroring process? If it's part of the mirroring process, Falko has written a good howto that I followed.

    So, yes, I do have exact mirrors of the master sites that are up to date. What I am having a problem with, is getting the slave to serve up. It's a real stab in the dark, but I think it's because the slave doesn't have the vhost files in sites-enabled or available. The reason i came to this conclusion is if switch off the 'is mirror' function, then add one of the sites to the slave through the control panel, it does then serve it up without problems. I'm sure that that is not the correct method though. I'm hoping someone will be able to tell me exactly which extra files I need to rsync.
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you selected the IP address or * for the website? If you selected the IP address, then you have to switch this IP also dynamically to the slave server. Using * is mucg esaier in this case, as you dont have to reconfigre your network card to change over the site to the second server as the vhost will listen on all IP addresses.
  7. Toucan

    Toucan Member

    I only have one public ip at the moment and this is the ip that the sites point to, all that changes when I test the mirror is port 80 is forwarded to a different internal ip. As it happens, when I add a site i do add it as *.

    All the sites are carried across in /var/www so they are there. What the slave does seem to be missing is knowing it has these sites to be served up.

    Any ideas?
  8. Toucan

    Toucan Member

    Do I need to also copy the vhost files to tell apache what sites it has?
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    No. All configuration related parts are mirrored by ispconfig.
  10. Toucan

    Toucan Member

    Should I expect to see these files?
    If the mirror service copies configuration files I'm concerned somethings happened to stop this. I did originally have this server set as an independent slave, not mirror. Could this have caused problems?

    I'd really like to be in a position to have this mirror working by the end of the week for a client so any help is much appreciated


  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you assign / add any items (websites, email domains etc.) to this server before you set it up as a mirror?
  12. Toucan

    Toucan Member

    Yes, and these are the only sites are served.

    I'm guessing you're about to tell me this is what's causing the problem.

    If that's the case, how do I undo this?
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. A mirror may not have any individual items assigned.

    Not absolutely sure as I never tested this. I guess these steps might work:

    1) Disable mirroring.
    2) Delete all items that are assigned to this server in ispconfig and wait until the items have been removed (see jobqueue in monitor).
    3) switch mirroring on again.
    4) enable debugging on the slave server
    5) Edit a setting in a website that is configured on the master server (e.g. change quota) and check if the configuration gets written and which output is in the ispconfig.log file.
  14. Toucan

    Toucan Member

    Wow, things really got a little complicated there but got there in the end. There were a couple of problems and a few solutions fixed it but not entirely sure which but I'll list them for future reference.

    1. Yes, adding the server as a slave, adding sites and then switching it to 'is mirror' caused problems. I had to delete each off the vhosts for the sites in sites-enabled and sites available before apache would go back online.

    2. Switching the slave logging into debug mode helped me find the solution to the next problem, a lot!

    I then switched the slave back into 'is mirror' mode. It didn't perform so I looked at the System log for the slave. It complained that network configuration was not enabled. I enabled Network Configuration on the slave tried again the 'is mirror' setting; all logs reported good, vhosts were created, the apache went back online.

    I then went to the router, changed the port forwarding for port 80 to the slave internal IP and it served the page perfectly.

    Till, thanks for your help solving this. I now have a backup server should the master fail for static sites and as soon as I get my head around mysql replication my joomla sites will have a fall back too!

    Thanks again.

    my advice to anyone doing this:
    1 Add the slave
    2 Do NOT try to add sites even to test it
    3 Enable network configuration on the slave
    4 Set to 'is mirror' of your master server.

Share This Page