Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Bandwidth in Multiple WebServer

Discussion in 'General Discussion' started by approx, Jul 23, 2007.

  1. approx

    approx Well-Known Member

    Mar 6, 2007
    Likes Received:
    Trophy Points:
    I'm implementing load balancing apache clustered. The problem is the bandwidth management. Anybody have experience on this issue?
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. freedman

    freedman Well-Known Member

    Feb 13, 2005
    Likes Received:
    Trophy Points:
    it's messy, but here's what I do.

    I've created a folder, /var/domlogs
    (cpanels log update script looks here first)

    using logrotate I rotate the logs for each server into /var/domlogs/SERVERID

    copy all those folders to the server you're going to use to generate the logs.

    download/install mergelog
    (I'm compressing my rotated logs, and mergelog comes with zmergelog which will merge gzipped logfiles)

    for i in `(cd /etc/httpd/domlogs/;echo *)`;
      echo $i
      mv -f $i temp
      zmergelog temp */$i.[0-9].gz > $i
      rm -f temp
    this assumes there are at most 10 rotated logfiles (if you want to archive your logs for longer, either save a copy of the merged log, or save the compressed logs somewhere else.

    now, you have in /var/domlogs a logfile for each domain that contains the data from all the servers.

    run /scripts/runlogsnow
    and it will process all the logs and your stats are generated using all the servers data.
    when it's complete it leaves a 0 length file.
    This is important.

    if the logs are run before the next time you merge them, they will see the 0 length files and do nothing, then when the logs are merged, it will add the data.
    if there is NOT a file in /var/domlogs, it will then look in /etc/httpd/domlogs.
    now... if it finds a file there, then it will process it's data.
    this is bad.. because the stats (awstats at least), ignores any entries that happen before it's 'last visit' date.. so if it processes the data from this server, then when you merge the data from the other ones, all their entries from before the last stats run get ignored.

    hope that helps.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice