Production Database Automation MySQL5.6 installation and deployment detailed tutorial, automation mysql5.6

Source: Internet
Author: User

Production Database Automation MySQL5.6 installation and deployment detailed tutorial, automation mysql5.6

Automated O & M is a technology that DBAs should master. Among them, automated database installation is a basic skill. The installation script in this article has passed the test and is no problem as a production database, because each company has different storage planning requirements, you can modify the script as needed.

Some Basic installation information has been commented out in the script

This script enables part 1 of the new features by default.

Innodb_buffer_pool_dump_at_shutdown = 1 it dumps data instead of innodb_buffer_pool_load_at_startup = 1

Enable these two parameters. After the database is restarted, load the hot data back.

Hot data blocks are dumped only when the database is shut down normally. The downtime and kill-9 won't

Some parameters are adjusted as needed. For example, innodb_buffer_pool_size = 512 M. The 512 M given in this article is generally 50%-80% of the memory.

Let's take a look at the script details [root @ HE3 ~] # Cat mysql_auto_install.sh

###### Binary automatic database installation script root Password MANAGER place the script and installation package in the/root directory ################# #### database directory/usr/local/mysql ################# data DIRECTORY/data/mysql #### ############# log directory/log/mysql #################### default port number 3306 modify other parameters as needed ################################ author: rrhelei@126.com ####################! /Bin/bashPATH =/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin :~ /BinexportPATH # Checkifuserisrootif [$ (id-u )! = "0"]; thenecho "Error: Youmustberoottorunthisscript, pleaseuseroottoinstall "exit1ficlearecho" ================================== ============================================ "echo" atooltoauto-compile & installMySQL5.6.25onRedhat/CentOSLinux "echo" ====================== ========================================================== === "cur_dir = $ (pwd) # setmysqlrootpasswordecho "==========================" mysqlrootpwd = "MANAGER" echo -E "Pleaseinputtherootpasswordofmysql:" read-p "(Defaultpassword: MANAGER):" mysqlrootpwdif ["$ mysqlrootpwd" = ""]; thenmysqlrootpwd = "MANAGER" fiecho "===========================" echo" MySQLrootpassword: $ mysqlrootpwd "echo" ========================== "# whichMySQLVersiondoyouwanttoinstall? Echo "======================" isinstallmysql56 = "n" echo "InstallMySQL5.6.25, pleaseinputy "read-p" (Pleaseinputy, n): "isinstallmysql56case" $ isinstallmysql56 "iny | Y | Yes | YES | yes | yES | yEs | YeS | yeS | Yes) echo "YouwillinstallMySQL5.6.25" isinstallmysql56 = "y"; *) echo "INPUTerror, YouwillexitinstallMySQL5.6.25" isinstallmysql56 = "n" exitesacget_char () {SAVEDSTTY = 'stty-G' stty-keys # ddif =/dev/ttybs = 1 count = 12>/dev/nullstty-rawsttyechostty $ SAVEDSTTY} echo "" echo "Pressanykeytostart. .. orPressCtrl + ctocancel "char = 'get _ char '# Initializetheinstallationrelatedcontent. functionInitInstall () {cat/etc/issueuname-aMemTotal = 'free-m | grepMem | awk '{print $2} ''echo-e "\ nMemoryis: $ {MemTotal} MB "# Settimezonerm-rf/etc/localtimeln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtime # DeleteOldMysqlprogramrpm-qa | grepmysqlrpm-emysql # yum -yremovemysql-servermysqlmysql-libs # yum-yremovephp-mysql # yum-yinstallyum-fastestmirror # yum-yupdate # DisableSeLinuxif [-s/etc/selinux/config]; thensed-I's/SELINUX = enforcing/SELINUX = disabled/G'/etc/selinux/configfisetenforce0} # Installationofdependonandoptimizationoptions. functionInstallDependsAndOpt () {cd $ cur_dircat>/etc/security/limits. conf <>/etc/sysctl. conf} # InstallMySQLfunctionInstallMySQL56 () {echo "========================== InstallMySQL5.6.22 ======== ==================== "cd $ cur_dir # Backupoldmy. cnf # rm-f/etc/my. cnfif [-s/etc/my. cnf]; thenmv/etc/my. cnf/etc/my. cnf. 'date + % Y % m % d % H % M % s '. bakfi # mysqldirectoryconfigurationgroupaddmysql-g512useradd-u512-gmysql-s/sbin/nologin-d/home/mysqlmysqltarxvf/root/mysql-5.6.25-linux-glibc2.5-x86_64.tar.gzmv/root/mysql-5.6.25-linux-glibc2.5-x86_64/usr/local/mysqlmkdir-p/data/mysqlmkdir-p/log/mysqlchown- rmysql: mysql/data/mysqlchown-Rmysql: mysql/usr/local/mysqlchown-Rmysql: mysql/log # edit/etc/my. cnfSERVERID = 'ifconfigeth0 | grep "inetaddr" | awk '{print $2}' | awk-F. '{print $4 "3306"}' cat>/etc/my. cnf <>/etc/ld. so. conf. d/mysql-x86_64.conf <>/etc/profile </tmp/mysql_sec_script <& 1 | tee/root/mysql-install.logCheckAndDownloadFiles2> & 1 | tee-a/root/mysql-install.logInstallDependsAndOpt2> & 1 | tee- a/root/mysql-install.logInstallMySQL562> & 1 | tee-a/root/mysql-install.logCheckInstall2> & 1 | tee-a/root/mysql-install.log

After the script is executed, enter the username and password (default MANAGER) and log on to the database.

wKioL1fOIHTQR5ktAAElfoh_FOg089.jpg-wh_50

The above is a detailed tutorial on automatic MySQL5.6 installation and deployment of the production database introduced by xiaobian. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.