From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/766 Path: news.gmane.org!not-for-mail From: Vincent Danen Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Warning about mysqld's behaviour Date: Thu, 14 Apr 2005 12:05:48 -0600 Message-ID: <970f15f9f68f816a06c38ffb05a4e274@annvix.org> References: <20050414085007.3830.qmail@b6398251b71d42.315fe32.mid.smarden.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-21--96720818" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1113501848 10836 80.91.229.2 (14 Apr 2005 18:04:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2005 18:04:08 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-1002-gcsg-supervision=m.gmane.org@list.skarnet.org Thu Apr 14 20:04:00 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1DM8fd-0002tg-Ug for gcsg-supervision@gmane.org; Thu, 14 Apr 2005 20:02:30 +0200 Original-Received: (qmail 12199 invoked by uid 76); 14 Apr 2005 18:06:16 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 12193 invoked from network); 14 Apr 2005 18:06:15 -0000 In-Reply-To: <20050414085007.3830.qmail@b6398251b71d42.315fe32.mid.smarden.org> Original-To: Gerrit Pape X-Pgp-Agent: GPGMail 1.0.2 X-Mailer: Apple Mail (2.619.2) X-SA-Exim-Connect-IP: 68.149.32.85 X-SA-Exim-Mail-From: vdanen@annvix.org X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on hades.annvix.org X-Spam-Level: X-Spam-Status: No, hits=-3.0 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=2.64 X-SA-Exim-Version: 4.1 (built Thu, 17 Mar 2005 01:31:55 -0500) X-SA-Exim-Scanned: Yes (on hades.annvix.org) Xref: news.gmane.org gmane.comp.sysutils.supervision.general:766 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:766 --Apple-Mail-21--96720818 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On Apr 14, 2005, at 2:53, Gerrit Pape wrote: > On Sun, Apr 10, 2005 at 11:16:06PM -0400, Charlie Brady wrote: >> Version of mysql is 3.23.58. I haven't looked at other versions, so >> don't >> know whether this is new or old brain-damage. >> >> I have a straightforward run file: >> >> #!/bin/sh >> exec /usr/libexec/mysqld \ >> --defaults-file=/etc/my.cnf \ >> --basedir=/usr \ >> --datadir=/var/lib/mysql \ >> --user=mysql \ >> --pid-file=/var/run/mysqld/mysqld.pid >> >> This starts a set of four mysqld processes/threads: > >> But notice that the pid file doesn't reference the parent process: >> >> sh-2.05a# svstat . >> .: up (pid 31796) 123 seconds, normally down >> sh-2.05a# cat /var/run/mysqld/mysqld.pid ; echo >> 31798 >> sh-2.05a# > >> But, it's worse than that, Jim! The parent process - the one that >> supervise is watching and "controlling" ignores INT, TERM and QUIT >> signals. > >> So we lose control of the daemon: > >> Fortunately runit provides an easy solution to this problem (although >> we >> are left with no option but to trust a pid file, with all the problems >> that entails). We just create control/t and control/d files (at >> least), >> containing: >> >> #! /bin/sh >> exec kill -TERM $(cat /var/run/mysqld/mysqld.pid) > >> [Gerrit, if you can verify this, you'll need to update your run script >> list.] > > I personally don't use mysql, I won't verify it. I think instead of > updating the run script on the web page, I'll remove mysql completely > from the list. This service daemon causes so many troubles for a > supervisor, that's not worth it imho, it even seems to change behavior > from version to version. I don't have a problem here running the latest mysql (4.1.11) using the following scripts: [root@titan mysqld]# cat run #!/bin/sh PATH="/sbin:/usr/sbin:/bin:/usr/bin" # this runs mysqld supervised umask 077 DATADIR="/var/lib/mysql" PID_FILE="$DATADIR/`/bin/hostname`.pid" MYSQLD_OPTS="" LOG="" # overwrite the above if [ -f /etc/sysconfig/mysqld ]; then . /etc/sysconfig/mysqld fi if [ "$LOG" != "" ]; then LOGFILE="--log=$LOG" fi /usr/sbin/mysqld --basedir=/ --datadir=$DATADIR --user=mysql --pid-file=$PID_FILE $LOGFILE --skip-locking $MYSQLD_OPTS 2>&1 [root@titan mysqld]# cat finish #!/bin/sh PATH="/sbin:/usr/sbin:/bin:/usr/bin" # this uses mysqladmin to shutdown mysqld, but we have to tell it where to find .my.cnf HOME=/root /usr/bin/mysqladmin shutdown As you can see, we can start and stop it all we like, provided we store the root user's password (for the db root user) in root's (system root) ~/.my.cnf: [root@titan mysqld]# srv stop mysqld Stopping mysqld: mysqld mysqld/log done [root@titan mysqld]# srv status mysqld /service/mysqld: down 1 seconds /service/mysqld/log: down 5 seconds [root@titan mysqld]# srv start mysqld Starting mysqld: mysqld/log mysqld done [root@titan mysqld]# srv status mysqld /service/mysqld: run (pid 3590) 9 seconds /service/mysqld/log: run (pid 3580) 9 seconds -- Annvix - Secure Linux Server: http://annvix.org/ "lynx -source http://linsec.ca/vdanen.asc | gpg --import" {FEE30AD4 : 7F6C A60C 06C2 4811 FA1C A2BC 2EBC 5E32 FEE3 0AD4} --Apple-Mail-21--96720818 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (Darwin) iD8DBQFCXrD8LrxeMv7jCtQRAtN7AJ98FreVtOAq+8CL1E/4L+I052oG4QCcCrzY +E1WcEEU04uk2mUE7eKKiFs= =IoFj -----END PGP SIGNATURE----- --Apple-Mail-21--96720818--