The Coolstack 1.1 AMP package installs the 32-bit version of MySQL by default. We want to let the horses out of the corral on this SunFire X2200 M2, so we also install the 64-bit version, which is provided as a separate package. Since we need the 32-bit version in order to compile php5, we keep it in its original /opt/coolstack/mysql_32bit location.
After running mysql_install_db and the other steps in /opt/coolstack/mysqlREADME we then to prep MySQL to be a first class citizen on Solaris 10.
Convert MySQL to SMF
Like the the CoolStack 1.1 Apache, CoolStack 1.1 MySQL is not integrated with SMF. Here are the resulting manifest and method files to get MySQL working cleanly as a service:
/var/svc/manifest/network/mysql.xml :
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
Manifest for MySQL
-->
<service_bundle type='manifest' name='CSKmysql:mysql'>
<service
name='network/mysql'
type='service'
version='1'>
<create_default_instance enabled='false' />
<single_instance />
<!--
Wait for network interfaces to be initialized.
-->
<dependency name='network'
grouping='require_all'
restart_on='error'
type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<!--
Wait for all local filesystems to be mounted.
-->
<dependency name='filesystem-local'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/local:default'/>
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/CSKmysql start'
timeout_seconds='60'>
</exec_method>
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/CSKmysql stop'
timeout_seconds='60'>
</exec_method>
<exec_method
type='method'
name='restart'
exec='/lib/svc/method/CSKmysql restart'
timeout_seconds='60'>
</exec_method>
</service>
</service_bundle>
/lib/svc/method/CSKmysql :
#!/usr/bin/sh
#
# Method file for MySQL
#
# This uses the MySQL packages from CoolStack 1.1
# CSKmysql
#
# Modify accordingly!
#
# NOTE: Make sure DB_DIR is owned BY the mysql user and group and chmod
# 700.
#
. /lib/svc/share/smf_include.sh
DB_DIR=/site-data0/data
PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid
case "$1" in
start)
/opt/coolstack/mysql/bin/mysqld_safe --user=mysql --datadir=${DB_DIR} --pid-file=${PIDFILE} > /dev/null &
;;
stop)
if [ -f ${PIDFILE} ]; then
/usr/bin/pkill mysqld_safe >/dev/null 2>&1
/usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ' mysqld'
fi
;;
'restart')
stop
while pgrep mysqld > /dev/null
do
sleep 1
done
start
;;
*)
echo ""
echo "Usage: `basename $0` { start | stop | restart }"
echo ""
exit 64
;;
esac
Then import the service:
# svccfg import /var/svc/manifest/network/mysql.xml
Before starting MySQL we need to put a config file in /etc. The example small config provided with MySQL is just right for now.
# cp /opt/coolstack/mysql/share/mysql/my-small.cnf /etc/my.cnf
Then change the datadir setting in /etc/my.cnf to point to the 1.3TB zfs pool on the external StorageTek 3511:
39 datadir=/site-data0/data
Finally, set the data dir with proper ownership:>
# chown myqsql:mysql /site-data0/data
And make sure it starts:
# svcadm -v enable mysql
At this point we're ready to set up the content management system, Drupal.
Additional tips for MySQL on Solaris:
