MySQL Service maintenance notes

Source: Internet
Author: User
Tags socket stop script backup

Some experience with MySQL service, mainly from the following aspects of the MySQL service planning and design considerations.

1 MySQL Service installation/configuration versatility;

2 system upgrades and data migration convenience;

3 Backup and system rapid recovery;

Planning for MySQL Server

=================

In order to maintain later, upgrade the convenience of backup and data security, it is best to install MySQL program files and data on "different hardware".

             /    usr                     <== operating system         
/ /opt/mysql
Hard Drive 1==>| /opt/mysql-3.23.54/ <== The latest version of the Mysql/home/mysql link to here
\ /opt/mysql-old/ <== old version of MySQL previously run
\ /etc/my.multi.cnf <== multiple daemon configuration file

/ /data/app_3301/ <== Application data, etc.,
Hard Drive 2==>| /data/app_3302/
\ /data/app_3303/

Installation of MySQL services and startup of services:

MySQL generally uses the current stable version, try not to use the--with-charset= option, I feel that with-charset only in alphabetical order when the useful, these options will bring a lot of trouble with the data migration.

Configure--prefix=/home/mysql

Make

Make install

Start and stop of services

================

1 Copy the default Mysql/var/mysql to the/database/app_1/directory,

2 mysqld startup script: start_mysql.sh

#!/bin/sh

Rundir= ' dirname ' "$"

echo "$rundir"

/home/mysql/bin/safe_mysqld--user=mysql--pid-file= "$rundir"/mysql.pid--datadir= "$rundir"/var "$@" \

-O max_connections=500-o wait_timeout=600-o key_buffer=32m--port=3402--socket= "$rundir"/mysql.sock &

Comments:

--pid-file= "$rundir"/mysql.pid--socket= "$rundir"/mysql.sock--datadir= "$rundir"/var

The purpose is to put the corresponding data and the application of temporary documents together;

-O is generally the server to start global variable optimization parameters, sometimes need to adjust according to the specific application;

--port: Different applications use port parameters to distribute to different services, a service can provide the number of connections is generally the main bottleneck of MySQL services;

After modifying different services to a different port, add the following in the Rc.local file:

/database/app_1/start_mysql.sh

/database/app_2/start_mysql.sh

/database/app_3/start_mysql.sh

Note: Full path must be written

3 mysqld Stop script: stop_mysql.sh

#!/bin/sh

Rundir= ' dirname ' "$"

echo "$rundir"

/home/mysql/bin/mysqladmin-u mysql-s "$rundir"/mysql.sock shutdown

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.