MySQL DBA - Tips and Techniques Magazine

11 Nov 2014

START AND STOP MYSQL USING SOLARIS SMF/SVCADM

For Solaris 10, Sun introduced the Service Management Facility. SMF is a framework that handles system boot-up, process management, and self-healing. It addresses the shortcomings of startup scripts and creates an infrastructure to manage daemons after the host has booted.

Note: Recent builds of Solaris Express, Nevada, and Solaris 10 updates are using SMF to start daemons such as mysql. The process below may vary. If your version of Solaris uses SMF, you will use the svcadm commands shown below to start/stop MySQL 5.

New SMF Method ( Notes for Sun Docs):

If you installed the MySQL 5 package on a version of Solaris that is using SMF instead of RC files, you will find that the package installed an SMF manifest for MySQL 5, and you can see the state of the service by using this command:

 # svcs -a | grep mysql

 disabled 13:36:01 svc:/network/cswmysql5:default

 

To make sure the MySQL 5 server starts (and also at reboot), issue this command:

# svcadm enable svc:/network/cswmysql5:default

You can verify using this command again:

# svcs -a | grep mysql

online 15:12:43 svc:/network/cswmysql5:default

You can stop the server with command # svcadm disable svc:/network/cswmysql5:default and it will remain stopped, even across a reboot, until you issue the svcadm enable command.

Example

 

 

a. Check the Machine Name

 

root@mk-n-portal-1[mysql] uname –n

 

mk-n-portal-1

 

b. Check the Operating System

 

root@mk-n-portal-1[mysql] uname –a

 

SunOS mk-n-portal-1 5.10 Generic_138889-03 i86pc i386 i86pc

 

c. Check the mySQL process and service on the Machine

 

root@mk-n-portal-1[~] svcs -a| grep mysql

 

online         11:08:23 svc:/application/database/sun-mysql50:default

 

 

d. Disable / stop mySQL

 

root@mk-n-portal-1[~] svcadm disable svc:/application/database/sun-mysql50:default

 

root@mk-n-portal-1[~] svcs -a| grep mysql

 

disabled       13:09:34 svc:/application/database/sun-mysql50:default

 

 

root@mk-n-portal-1[~] ps -ef | grep mysql

 

    root 11850 11811   0 13:09:55 pts/1       0:00 grep mysql

 

e. Enable / start mySQL

 

root@mk-n-portal-1[~] svcadm enable svc:/application/database/sun-mysql50:default

 

root@mk-n-portal-1[~] ps -ef | grep mysql

   mysql 11932   929   0 13:10:55 ?           0:00 /bin/sh /opt/webstack/mysql/5.0/bin/mysqld_safe --user=mysql --datadir=/var/opt

  root 11958 11811   0 13:10:57 pts/1       0:00 grep mysql

 mysql 11955 11932   0 13:10:55 ?           0:00 /opt/webstack/mysql/5.0/bin/mysqld --basedir=/opt/webstack/mysql/5.0 --datadir=

 

 

No comments:

Post a Comment