国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

生產(chǎn)庫自動化MySQL5.6安裝部署詳細教程

2024-07-24 12:53:39
字體:
供稿:網(wǎng)友

自動化運維是一個DBA應(yīng)該掌握的技術(shù),其中,自動化安裝數(shù)據(jù)庫是一項基本的技能,本文中的安裝腳本已通過測試,作為生產(chǎn)庫來說沒有問題,鑒于每個公司存儲規(guī)劃要求不同,可以按需自行修改腳本。

腳本中已經(jīng)注釋說明一些基本的安裝信息

本腳本默認啟用5.6部分新特性

innodb_buffer_pool_dump_at_shutdown=1 它dump的不是數(shù)據(jù),是Id號innodb_buffer_pool_load_at_startup=1

開啟這個兩個參數(shù)當(dāng)數(shù)據(jù)庫重啟后把這些熱數(shù)據(jù)重新加載回去

只有正常關(guān)庫才會dump熱數(shù)據(jù)塊,宕機和kill -9不會

部分參數(shù)按需整改,例如innodb_buffer_pool_size = 512M,本文給的512M,一般給內(nèi)存的50%-80%。

來看一下腳本的具體情況[root@HE3 ~]# cat mysql_auto_install.sh

######二進制自動安裝數(shù)據(jù)庫腳本root密碼MANAGER將腳本和安裝包放在/root目錄即可#####################數(shù)據(jù)庫目錄/usr/local/mysql##################數(shù)據(jù)目錄/data/mysql##################日志目錄/log/mysql##################端口號默認3306其余參數(shù)按需自行修改###############################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)echo"YouwillinstallMySQL5.6.25"isinstallmysql56="y";;*)echo"INPUTerror,YouwillexitinstallMySQL5.6.25"isinstallmysql56="n"exitesacget_char(){SAVEDSTTY=`stty-g`stty-echosttycbreak#ddif=/dev/ttybs=1count=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
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 博湖县| 太原市| 勃利县| 太仆寺旗| 蕲春县| 澳门| 京山县| 云浮市| 吉林省| 沾益县| 报价| 开化县| 武城县| 华宁县| 烟台市| 广昌县| 油尖旺区| 津市市| 厦门市| 镇远县| 兴山县| 石棉县| 城步| 长治市| 浦北县| 津南区| 永修县| 富顺县| 错那县| 临夏市| 沿河| 申扎县| 昭平县| 丰城市| 克山县| 马公市| 平远县| 浦县| 乐昌市| 名山县| 龙南县|