臨盆庫主動化MySQL5.6裝置安排具體教程。本站提示廣大學習愛好者:(臨盆庫主動化MySQL5.6裝置安排具體教程)文章只能為提供參考,不一定能成為您想要的結果。以下是臨盆庫主動化MySQL5.6裝置安排具體教程正文
主動化運維是一個DBA應當控制的技巧,個中,主動化裝置數據庫是一項根本的技巧,本文中的裝置劇本已經由過程測試,作為臨盆庫來講沒有成績,鑒於每一個公司存儲計劃請求分歧,可以按需自行修正劇本。
劇本中曾經正文解釋一些根本的裝置信息
本劇本默許啟用5.6部門新特征
innodb_buffer_pool_dump_at_shutdown=1 它dump的不是數據,是Id號 innodb_buffer_pool_load_at_startup=1
開啟這個兩個參數當數據庫重啟後把這些熱數據從新加載歸去
只要正常關庫才會dump熱數據塊,宕機和kill -9不會
部門參數按需整改,例如innodb_buffer_pool_size = 512M,本文給的512M,普通給內存的50%-80%。
來看一下劇本的詳細情形[root@HE3 ~]# cat mysql_auto_install.sh
######二進制主動裝置數據庫劇本root暗碼MANAGER將劇本和裝置包放在/root目次便可############### ######數據庫目次/usr/local/mysql############ ######數據目次/data/mysql############ ######日記目次/log/mysql############ ######端標語默許3306其他參數按需自行修正############ ################## #author:[email protected]# ################## #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:~/bin export PATH #Check ifuserisroot if[$(id -u)!="0"];then echo"Error:Youmustberoottorun thisscript,pleaseuseroottoinstall" exit1 fi clear echo "=========================================================================" echo "Atooltoauto-compile&installMySQL5.6.25onRedhat/CentOSLinux " echo "=========================================================================" cur_dir=$(pwd) #set mysqlrootpassword echo"===========================" mysqlrootpwd="MANAGER" echo-e"Pleaseinputtherootpasswordofmysql:" read-p"(Defaultpassword:MANAGER):"mysqlrootpwd if["$mysqlrootpwd"=""];then mysqlrootpwd="MANAGER" fi echo"===========================" echo"MySQLrootpassword:$mysqlrootpwd" echo"===========================" #which MySQLVersiondoyouwanttoinstall? echo "===========================" isinstallmysql56="n" echo"InstallMySQL5.6.25,Pleaseinputy" read-p"(Pleaseinputy,n):"isinstallmysql56 case"$isinstallmysql56"in y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) echo"YouwillinstallMySQL5.6.25" isinstallmysql56="y" ;; *) echo"INPUTerror,YouwillexitinstallMySQL5.6.25" isinstallmysql56="n" exit esac get_char() { SAVEDSTTY=`stty-g` stty-echo sttycbreak #ddif=/dev/ttybs=1count=12>/dev/null stty-raw sttyecho stty$SAVEDSTTY } echo"" echo"Pressanykeytostart...orPressCtrl+ctocancel" char=`get_char` # Initializetheinstallationrelated content. function InitInstall() { cat/etc/issue uname-a MemTotal=`free-m|grepMem|awk'{print$2}'` echo-e"\nMemoryis:${MemTotal}MB" #Settimezone rm-rf/etc/localtime ln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtime #DeleteOldMysqlprogram rpm-qa|grepmysql rpm-emysql #yum-yremovemysql-servermysqlmysql-libs #yum-yremovephp-mysql #yum-yinstallyum-fastestmirror #yum-yupdate #DisableSeLinux if[-s/etc/selinux/config];then sed-i's/SELINUX=enforcing/SELINUX=disabled/g'/etc/selinux/config fi setenforce0 } #Installation ofdependonandoptimizationoptions. function InstallDependsAndOpt() { cd $cur_dir cat >>/etc/security/limits.conf<>/etc/sysctl.conf } #Install MySQL function InstallMySQL56() { echo "============================InstallMySQL 5.6.22==================================" cd $cur_dir #Backup oldmy.cnf #rm-f /etc/my.cnf if[-s /etc/my.cnf];then mv/etc/my.cnf/etc/my.cnf.`date +%Y%m%d%H%M%S`.bak fi #mysql directoryconfiguration groupadd mysql-g512 useradd-u512-gmysql-s/sbin/nologin-d/home/mysqlmysql tarxvf/root/mysql-5.6.25-linux-glibc2.5-x86_64.tar.gz mv/root/mysql-5.6.25-linux-glibc2.5-x86_64/usr/local/mysql mkdir-p/data/mysql mkdir-p/log/mysql chown-Rmysql:mysql/data/mysql chown-Rmysql:mysql/usr/local/mysql chown-Rmysql:mysql/log #edit/etc/my.cnf SERVERID=`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.log CheckAndDownloadFiles2>&1|tee-a/root/mysql-install.log InstallDependsAndOpt2>&1|tee-a/root/mysql-install.log InstallMySQL562>&1|tee-a/root/mysql-install.log CheckInstall2>&1|tee-a/root/mysql-install.log
履行劇本後,輸出用戶名暗碼(默許MANAGER)後登錄數據庫勝利。
wKioL1fOIHTQR5ktAAElfoh_FOg089.jpg-wh_50
以上所述是小編給年夜家引見的臨盆庫主動化MySQL5.6裝置安排具體教程,願望對年夜家有所贊助,假如年夜家有任何疑問請給我留言,小編會實時答復年夜家的。在此也異常感激年夜家對網站的支撐!