Skip site navigation (1)Skip section navigation (2)
Date:      08 Feb 2003 00:07:52 -0300
From:      Juan Pablo Villa <juan@datafull.com>
To:        dirk@FreeBSD.org
Cc:        ports@FreeBSD.org
Subject:   FreeBSD Port: mysql-server-3.23.55
Message-ID:  <1044673674.1375.209.camel@depot>

next in thread | raw e-mail | index | archive | help

--=-0oXCV7X7unC/H4XLm4wb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello Dirk 

I'm the network administrator of a major dotcom here in Argentina. I
introduced FreeBSD here, and we use it on all our boxes. 
MySQL has been, since the migration from Linux, one of our weakest
points (mainly mine, because I'm the only FreeBSD guy here), and the
major point of failure when a DoS attack comes. All our servers are
Dual-processor, and they're still running 4.x, since I don't know how
5.0-R will perform on production. 

The default MySQL-Server port install didn't work well for me (a mysqld
restart was mandatory from time to time, since it stopped responding
randomly on a monthly basis or less, depending from workload). Apart
from this I've had a lot of trouble in the past trying to build mysqld
with Linuxthreads (it behaved worse than the default build), basically
trying to take advantage of SMP and to workaround FreeBSD 4.x threading
limitations. Recently, looking for FreeBSD-MySQL related problems (I
didn't want to have to go back to a MySQL Linux box), I found a solution
for all MySQL-LinuxThreads-FreeBSD related problems, on Jeremy Zawodny's
blog http://jeremy.zawodny.com/blog/archives/000458.html#000458

Last week, we had a terrible DoS attack on our site (front end
webservers had no problems handling the load, but mysqld was erratic and
completely dependant from my fingertips). So, I was forced under the
circumstances to test this recipe on production. So far, it's working
flawlessly. 

I don't like to compile apart from ports, so I modified the port
Makefile according to Jeremy's recommendations. It's attached here if
you want to commit some of this to the ports tree. The only problem is
that mysql_install_db seems to fail for some reason. 

Sorry for my bad English, and I hope that this doesn't take much of your
time (I know that this mail is pretty long). 

Best regards 

Juan Pablo Villa 
Network Administrator - Datafull.com 
Cuatro Cabezas SA 
Buenos Aires, Argentina 





--=-0oXCV7X7unC/H4XLm4wb
Content-Description: 
Content-Disposition: attachment; filename=Makefile
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-makefile; charset=UTF-8

# ports collection makefile for:	MySQL-server
# Date created:				Sun Sep 24 21:20:46 CEST 2000
# Whom:					Dirk Froemberg <dirk@FreeBSD.org>
#
# $FreeBSD: ports/databases/mysql323-server/Makefile,v 1.154 2003/01/29 16:=
30:27 dirk Exp $
#

PORTNAME?=3D	${MASTERPORTNAME}
PORTVERSION=3D	3.23.55
PORTREVISION?=3D	0
CATEGORIES=3D	databases
MASTER_SITES=3D	http://www.kernelnotes.de/MySQL/Downloads/MySQL-3.23/ \
		http://mysql.he.net/Downloads/MySQL-3.23/ \
		ftp://ftp.sunet.se/pub/unix/databases/relational/mysql/Downloads/MySQL-3.=
23/ \
		ftp://mysql.secsup.org/pub/software/mysql/Downloads/MySQL-3.23/ \
		http://mysql.orst.edu/Downloads/MySQL-3.23/ \
		http://web.tryc.on.ca/mysql/Downloads/MySQL-3.23/ \
		ftp://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-3.23/
DISTFILES=3D	mysql-${PORTVERSION}${EXTRACT_SUFX}

MAINTAINER=3D	dirk@FreeBSD.org

WRKSRC=3D		${WRKDIR}/mysql-${PORTVERSION}
SLAVEDIRS=3D	databases/mysql323-client
MASTERPORTNAME=3D	mysql-server
DB_DIR?=3D	/var/db/mysql
USE_PERL5=3D	yes
USE_LIBTOOL=3D	yes
CONFIGURE_ARGS=3D	--localstatedir=3D${DB_DIR} \
		--without-perl \
		--without-debug \
		--without-readline \
		--without-bench \
		--with-mit-threads=3Dno \
		--with-libwrap \
		--with-low-memory \
		--with-comment=3D'FreeBSD port: ${PKGNAME}' \
		--program-prefix=3D'' \
		--with-innodb

#My defaults, commented out.=20
#BUILD_STATIC=3D	yes
#WITH_LINUXTHREADS=3Dyes=20

.if ${MACHINE_ARCH} =3D=3D "i386"
CONFIGURE_ARGS+=3D--enable-assembler --with-berkeley-db
.endif
.if defined(WITH_CHARSET) && ${WITH_CHARSET} !=3D ""
CONFIGURE_ARGS+=3D--with-charset=3D${WITH_CHARSET}
.endif
.if defined(WITH_XCHARSET) && ${WITH_XCHARSET} !=3D ""
CONFIGURE_ARGS+=3D--with-extra-charsets=3D${WITH_XCHARSET}
.endif
.if defined(BUILD_STATIC)
CONFIGURE_ARGS+=3D--with-mysqld-ldflags=3D--static
.endif
.if defined(BUILD_OPTIMIZED)
CFLAGS+=3D	-mcpu=3Dpentiumpro -O3
.endif
.if defined(WITH_LINUXTHREADS)
CONFIGURE_ARGS+=3D--with-mit-threads=3Dno '--with-comment=3DLinThreads-SMP'=
 --enable-assembler --with-innodb '--with-named-thread-libs=3D-DHAVE_GLIBC2=
_STYLE_GETHOSTBYNAME_R -D_THREAD_SAFE -DHAVE_BROKEN_REALPATH -I/usr/local/i=
nclude/pthread/linuxthreads -L/usr/local/lib -llthread -llgcc_r' --prefix=
=3D$PREFIX --enable-thread-safe-client --with-server-suffix=3D'-LinThreads-=
SMP' --with-libwrap --with-raid
CFLAGS+=3D	-O -pipe -march=3Dpentiumpro -D__USE_UNIX98 -D_REENTRANT -D_THRE=
AD_SAFE -DHAVE_BROKEN_REALPATH -I/usr/local/include/pthread/linuxthreads
CXXFLAGS+=3D	${CFLAGS} -felide-constructors -fno-rtti -O -pipe -march=3Dpen=
tiumpro -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE -DHAVE_BROKEN_REALPATH -=
I/usr/local/include/pthread/linuxthreads -felide-constructors -fno-rtti -fn=
o-exceptions
LIB_DEPENDS+=3D	lthread.2:${PORTSDIR}/devel/linuxthreads
.endif
.if defined(THREAD_SAFE_CLIENT)
CONFIGURE_ARGS+=3D--enable-thread-safe-client
.endif
CONFIGURE_ENV+=3D	PERL=3D${PERL} \
		PERL5=3D${PERL} \
		INSTALL_SCRIPT=3D"${INSTALL_SCRIPT}" \
		CFLAGS=3D"${CFLAGS}" \
		CONFIGURE_ARGS=3D"${CONFIGURE_ARGS}"

.include <bsd.port.pre.mk>
# without including these flags mysqld may crash under heavy load
# and multiple connections at the same time
CXXFLAGS+=3D	${CFLAGS} -felide-constructors -fno-rtti
.if ${OSVERSION} >=3D 400002
CXXFLAGS+=3D	-fno-exceptions
.endif
.if ${OSVERSION} < 500000
CONFIGURE_ENV+=3D	CXX=3D"${CC}"
.endif

# MySQL-Server part
.if !defined(CLIENT_ONLY)
RUN_DEPENDS=3D	mysql:${PORTSDIR}/databases/mysql323-client \
		${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Mysql.pm:${PORT=
SDIR}/databases/p5-Mysql

PLIST_SUB=3D	MYSQL_VERSION=3D${PORTVERSION}

ONLY_FOR_ARCHS=3D	i386 alpha sparc64

pre-fetch:
	@${ECHO} ""
	@${ECHO} "You may use the following build options:"
	@${ECHO} ""
	@${ECHO} "	WITH_CHARSET=3Dcharset	define the primary built-in charset (lat=
in1);"
	@${ECHO} "	WITH_XCHARSET=3Dlist	define other built-in charsets (may be 'al=
l');"
	@${ECHO} "	DB_DIR=3Ddirectory	Set alternate directory for database files"
	@${ECHO} "				(default is /var/db/mysql)."
	@${ECHO} "	WITH_LINUXTHREADS=3Dyes	Use the linuxthreads pthread library."
	@${ECHO} "				This is _NOT_ recommended for production"
	@${ECHO} "				servers. Expect problems when enabled."
	@${ECHO} "	SKIP_INSTALL_DB=3Dyes	Skip mysql_install_db"
	@${ECHO} "				(i. e. leave ${DB_DIR} alone)."
	@${ECHO} "				This is useful for upgrades."
	@${ECHO} "				Be sure to know what you are doing!"
	@${ECHO} "	SKIP_DNS_CHECK=3Dyes	don't run resolveip to do an additional"
	@${ECHO} "				DNS check before inserting local hostname to"
	@${ECHO} "				mysql database."
	@${ECHO} "				Use if your machine has no offical DNS entry."
	@${ECHO} "	BUILD_STATIC=3Dyes	Build a static version of mysqld."
	@${ECHO} "	BUILD_OPTIMIZED=3Dyes	Add -mcpu=3Dpentiumpro -O3 to CFLAGS."
	@${ECHO} "				This setting may produce broken code and thus"
	@${ECHO} "				is not recommended for production servers."
	@${ECHO} ""

.if exists(${DB_DIR}) && !defined(PACKAGE_BUILDING) && !defined(OVERWRITE_D=
B) && !defined(SKIP_INSTALL_DB)
pre-install:
	@${ECHO} "You appear to already have a mysql database directory in ${DB_DI=
R}."
	@${ECHO} ""
	@${ECHO} "In order to preserve your existing data, you should:"
	@${ECHO} "	- dump all your databases"
	@${ECHO} "	- kill mysql if it is running"
	@${ECHO} "	- delete the ${DB_DIR} directory"
	@${ECHO} "	- run 'make install'"
	@${ECHO} "	- start up mysql"
	@${ECHO} "	- re-create all of your database"
	@${ECHO} "	- re-load your data"
	@${ECHO} ""
	@${ECHO} "If you understand the consequences of this upgrade, please re-bu=
ild this"
	@${ECHO} "port with the environment variable OVERWRITE_DB defined."
	@${FALSE}
.endif

post-install:
.if !defined(PACKAGE_BUILDING)
.if !defined(SKIP_INSTALL_DB)
.if defined(SKIP_DNS_CHECK)
	${PREFIX}/bin/mysql_install_db --force
.else
	${PREFIX}/bin/mysql_install_db
.endif
.endif
	@${SETENV} DB_DIR=3D${DB_DIR} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.endif
	@${SED} "s|%%PREFIX%%|${PREFIX}|g; s|%%DB_DIR%%|${DB_DIR}|g" < ${FILESDIR}=
/mysql-server.sh > ${PREFIX}/etc/rc.d/mysql-server.sh
	@${CHMOD} 750 ${PREFIX}/etc/rc.d/mysql-server.sh

.if !defined(NOPORTDOCS)
	${MKDIR} ${PREFIX}/share/doc/mysql/Flags
.for doc in manual.html manual.ps manual_toc.html manual.txt manual.texi in=
clude.texi
	${INSTALL_DATA} ${WRKSRC}/Docs/${doc} ${PREFIX}/share/doc/mysql
.endfor
	${INSTALL_DATA} ${WRKSRC}/Docs/Flags/*.gif ${PREFIX}/share/doc/mysql/Flags
	${INSTALL_DATA} ${WRKSRC}/Docs/mysql.info ${PREFIX}/info
	@install-info ${PREFIX}/info/mysql.info ${PREFIX}/info/dir
.endif

# MySQL-Client part
.else
MAN1=3D		isamchk.1 isamlog.1 mysql.1 mysql_zap.1 mysqlaccess.1  \
		mysqladmin.1 mysqld.1 mysqld_multi.1 mysqldump.1 mysqlshow.1 \
		perror.1 replace.1 safe_mysqld.1

INSTALLS_SHLIB=3D	yes
LDCONFIG_DIRS=3D	%%PREFIX%%/lib/mysql

CONFIGURE_ARGS+=3D--without-server
MAKE_ENV=3D	CLIENT_ONLY=3D"${CLIENT_ONLY}"

post-install:
	@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/mysql-client.sh > ${PREFI=
X}/etc/rc.d/000.mysql-client.sh
	@${CHMOD} 750 ${PREFIX}/etc/rc.d/000.mysql-client.sh

.endif

# This is for the maintainer only...
make-plist:
	/usr/bin/find foo -type f -or -type l | /usr/bin/cut -d / -f 2- | /usr/bin=
/sort  > ${.CURDIR}/pkg-plist.new
	/usr/bin/perl -i -ne 'if (m#share/doc/#) { print "%%PORTDOCS%%", $$_; } el=
se { print $$_; }' ${.CURDIR}/pkg-plist.new

.include <bsd.port.post.mk>

--=-0oXCV7X7unC/H4XLm4wb--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1044673674.1375.209.camel>