List:General Discussion« Previous MessageNext Message »
From:Mogens Melander Date:March 12 1999 12:26am
Subject:MySQL, No problems !!
View as plain text  
Hi all,

I those times of trouble reporting, i have to pitch in.

I still have to say "Go Monty, Go" :)

I do not have any problems at all, running ->

On the server side:
	Linux (slackware 3.5) 
		Linux 2.0.34 #3 Mon Aug 29 23:31:01 CEST 1998 i586 unknown
		Apache 1.3.3 (php3)
		mysql  Ver 9.20 Distrib 3.22.4-beta, for pc-linux-gnu (i586)

	Linux (slackware 3.5) 
		Linux 2.0.35 #3 Mon Aug 31 23:42:33 CEST 1998 i586 unknown
		Apache 1.3.3 (php3)
		mysql  Ver 9.20 Distrib 3.22.4-beta, for pc-linux-gnu (i586)

	Linux (slackware 3.5) 
		Linux 2.0.36 #3 Mon Aug 28 22:30:10 CEST 1998 i586 unknown
		Apache 1.3.4 (php3)
		mysql  Ver 9.20 Distrib 3.22.4-beta, for pc-linux-gnu (i586)

	(and some RH5.x/slackware 3.x, Kernel 2.0.x, Apache 1.3.0 (php2), DB client)

On the client side:

	Win 95/98: > 30 (unknown)
		MyODBC Ver 2.50.17

	Win NT 4.0 Server/WrkStation (SR 1->4) = 5
		MyODBC Ver 2.50.17

	Linux (slackware 3.5)  > 10 (unknown)
		Linux 2.0.33 #5 Mon Aug 31 23:00:48 MET DST 1998 i586
		mysql  Ver 9.20 Distrib 3.22.4-beta, for pc-linux-gnu (i586)

This setup is supplying detailed info on a point-to-point basis on any traffic
involving any front-line router/gateway (i'm involved in) for the last 3 months,
and consolidated for the last 2 years. I know this is basic stuff, but it's
still faster, and more "install and go" than the two heavy db (oracle and sybase)
test servers i have running. At some point i'll do a comparison on these date,
oracle/sybase against MySQL. Not that i have any cracks in my beliefs.

This MySQL environment is running "close to" uninterrupted 23 hours a day.
But at midnight, all routers and servers has to report (in a cron job), al 
traffic occurred today (last 24 hours) on a source destination ip-addr basis, 
consolidating, (if anybody feels like commenting, feel free) this is far
more than 1 million records a day, collected like this:



cd /root/mysql
echo "Current directory are `pwd`"


ddir=/root/mysql/data		#local pre data
odir=/root/mysql/data-ok	#local post data
rdir=/root/mysql/data		#remote data

MYSQL="/usr/local/bin/mysql -h -u uuuuuuu -pppppppp"

d1=`date +"%H:%M:%S"`

DATO=`date +%y%m%d`
PID=`cat /var/run/`

echo "Start at $d1"

echo "Stop net-logging.. pid($PID)"
kill -TSTP $PID

echo "Moving /var/log/net-acct $ddir/net-acct.$DATO"
mv /var/log/net-acct $ddir/net-acct.$DATO

echo "Restart net-logging.. pid($PID)"
kill -CONT $PID

echo "Cleaning data..."

fsize=`filesize $ddir/net-acct.$DATO`

echo "Filesize before cleaning : $fsize"

# remove src/dst addr starting with zerro (isdn errors)
# remove all (src or dst) not local (isdn errors)


fsize=`filesize $ddir/net-acct.$DATO`
echo "Filesize after cleaning  : $fsize"

echo "Generating ftp.cmd file..."

echo "open transfer" > ftp.cmd
echo "lcd /root/mysql/data" >> ftp.cmd

for A in `ls -1 $ddir`
	echo "put $A" >> ftp.cmd

echo "quit" >> ftp.cmd

echo -e "Uploading transfer-data to $REMOTE_DB_SERVER ...\n\n"

ncftp < ftp.cmd

echo -e "\nStarting remote processing..\n\n"

for fname in `ls -A1 $ddir`

# What are we working on (try awk) ?

yymmdd=`tail -n1 $ddir/$fname|cut -f1 -d ' '`
yy=`echo $yymmdd | cut -f1 -d '/'`
mm=`echo $yymmdd | cut -f2 -d '/'`
dd=`echo $yymmdd | cut -f3 -d '/'`

echo "Loading $rdir/$fname $yy $mm $dd"

load data infile '$rdir/$fname' into table transfer;

echo -e "\n\tMoving $ddir/$fname to $odir...\n"
mv $ddir/$fname $odir/$fname

echo "	Updating YEAR,MONTH,DAY fields...."

update transfer set yy=left(dato,4),
where yymmdd=0;

echo -e "\tUpdating perday table...\n"

insert into perday
select name,yy,mm,dd,sum(bytes) 
from domain,transfer
where (source=addr or dest=addr) and yymmdd=0
group by name,yy,mm,dd;

echo -e "\tUpdating YYMMDD field....\n"

update transfer
set yymmdd=(yy*10000)+(mm*100)+dd
where yymmdd=0;

tmp=`date +"%H:%M:%S"`

echo -e "Done processing $fname : $tmp\n\n"


echo "Emptying permonth table..."

delete from permonth;

echo "Updating permonth table..."

insert into permonth
select name,yy,mm,sum(bytes) 
from perday
group by name,yy,mm;

OLD=`date -d "3 months ago" +"%Y%m00"`

echo "Deleting data older than 3 months ( $OLD )..."

delete from transfer where yymmdd < $OLD;

cd $cdir
echo "Current directory are `pwd`"

# Do the dirty deed
#	Put some sanity logic in here


# Let somebody else worry about the backup :)

d2=`date +"%H:%M:%S"`

echo "Start : $d1"
echo "End   : $d2"

      Mogens Melander              mailto:mogens@stripped
Compiling mysql on HPChris Trown11 Mar
  • MySQL, No problems !!Mogens Melander12 Mar
  • Re: Compiling mysql on HPChristian Mack12 Mar