您好,欢迎访问三七文档
当前位置:首页 > 机械/制造/汽车 > 制造加工工艺 > MYSQL数据库术改造环境部署方案
关键业务DNSDNSDNSDNS项目MYSQLMYSQLMYSQLMYSQL数据库主从复制高可用技术改造环境部署方案文档属性标题关键业务DNS项目mysql数据库主从复制高可用技术改造环境方案作者黄佳创建日期2009年9月29日版本Release1.0修改日期目录一、安装部署DRBD..................................................3二、HEARTBEAT软件包安装............................................161、HEARTBEAT的安装...........................................162、安装MySQL监控脚本mysqlmon.................................26三、安装配置MYSQL数据库...........................................27四、故障恢复.....................................................281、HEARTBEAT跳转后恢复HEARTBEAT主节点步骤.....................282、主机重启后主节点恢复正常后自动接管服务..........................29安装环境:NODE1主机名idc-d-1480IP地址10.1.24.202(210.51.170.120)NODE2主机名IDC-1481IP地址10.1.24.203(210.51.170.121)SLAVE主机名IDC-D-1408IP地址10.1.24.204(210.51.170.122)VIAIP(漂移IP)10.1.24.205NODE1和NODE2为主节点,SLAVE为从节点,同步的数据库名test在安装之前请确认下面的安装包不存在rpm-eperl-DBD-MySQL-2.9004-3.1.i386rpm-eperl-DBD-Pg-1.31-6.i386安装准备:我已经把相关的软件和配置文件都放在工具包里面了RedHatEnterpriseLinuxASrelease4(NahantUpdate4)32位libnet-1.1.2.1-1.rh.el.um.1.i386.rpmheartbeat-pils-2.0.4-1.el4.i386.rpmheartbeat-stonith-2.0.4-1.el4.i386.rpmheartbeat-2.0.4-1.el4.i386.rpmperl-5.8.8.tar.gzDBI-1.59.tar.gzDBD-mysql-4.005.tar.gzdrbd-8.3.2.tar.gz关闭防火墙Serviceiptablesstop一、安装部署DRBDDRBDDRBDDRBD主从都要做#cd/usr/local/drbd/#tarzxvfdrbd-8.3.2.tar.gz#cddrbd-8.3.2#make#makeallinstall#insmoddrbd/drbd.ko#lsmod|grepdrbddrbd2335240vi/etc/drbd.conf##drbd.confexample##parametersyou_need_tochangearethehostname,device,disk,#meta-disk,addressandportintheonhostname{}sections.##yououghttoknowabouttheprotocol,andthevarioustimeouts.##youprobablywanttosettherateinthesyncersections##NOTEcommonpitfall:#rateisgiveninunitsof_byte_notbit###increasetimeoutandmaybeping-intinnet{},ifyousee#problemswithconnectionlost/connectionestablished#(orchangeyoursetuptoreducenetworklatency;makesurefull#duplexbehavesassuch;checkaverageroundtriptimeswhile#networkissaturated;andsoon...)#skip{Asyoucansee,youcanalsocommentchunksoftextwitha'skip[optionalnonsense]{skippedtext}'section.Thiscomesinhandy,ifyoujustwanttocommentoutsome'resourcesomename{...}'section:justprecedeitwith'skip'.Thebasicformatofoptionassignmentisoptionnamelinearwhitespacevalue;Itshouldbeobviousfromtheexamplesbelow,butifyoureallycaretoknowthedetails:optionname:=validoptionsintherespectivescopevalue:=num|string|choice|...dependingonthesetofallowedvaluesfortherespectiveoption.num:=[0-9]+,sometimeswithanoptionalsuffixofK,M,Gstring:=(name|\([^\\\\n]*|\\.)*\)+name:=[/_.A-Za-z0-9-]+}##AtmostONEglobalsectionisallowed.#Itmustprecedeanyresourcesection.#global{#Bydefaultweloadthemodulewithaminor-countof32.Incaseyou#havemoredevicesinyourconfig,themodulegetsloadedwith#aminor-countthatensuresthatyouhave10minorsspare.#Incase10spareminorsaretoolittleforyou,youcansetthe#minor-countexeplicithere.(Note,incontrasttoDRBD-0.7an#unused,spareminorhasonlyaverylittleoverheadofallocated#memory(asinglepointertobeexact).)##minor-count64;#Theuserdialogcountsanddisplaysthesecondsitwaitedso#far.Youmightwanttodisablethisifyouhavetheconsole#ofyourserverconnectedtoaserialterminalserverwith#limitedloggingcapacity.#TheDialogwillprintthecounteach'dialog-refresh'seconds,#setitto0todisableredrawingcompletely.[default=1]##dialog-refresh5;#5seconds#Youmightdisableoneofdrbdadm'ssanitycheck.#disable-ip-verification;#ParticipateinDRBD'sonlineusagecounterat:ask,yes,no.Defaultisask.Incaseyoudonot#know,setittoask,andfollowtheonscreeninstructionslater.usage-countyes;}##Thecommonsectioncanhaveallthesectionsaresourcecanhavebut#notthehostsection(startedwiththeonkeyword).#Thecommonsectionmustprecedeallresources.#Allresourcesinheritthesettingsfromthecommonsection.#Whereassettingsintheresourceshaveprecedenceoverthecommon#setting.#common{syncer{rate100M;}}##thisneednotber#,youmayusephonyresourcenames,#likeresourceweborresourcemail,too#resourcer0{#transferprotocoltouse.#C:writeIOisreportedascompleted,ifweknowithas#reached_both_localandremoteDISK.#*forcriticaltransactionaldata.#B:writeIOisreportedascompleted,ifithasreached#localDISKandremotebuffercache.#*formostcases.#A:writeIOisreportedascompleted,ifithasreached#localDISKandlocaltcpsendbuffer.(seealsosndbuf-size)#*forhighlatencynetworks##**********#uhm,benchmarkshaveshownthatCisactuallybetterthanB.#thisnoteshalldisappear,whenweareconvincedthatBis#therightchoiceformostcases.#Untilthen,alwaysuseCunlessyouhaveareasonnotto.#--lge#**********#protocolC;handlers{#whatshouldbedoneincasethenodeisprimary,degraded#(=noconnection)andhasinconsistentdata.#pri-on-incon-degr/usr/lib/drbd/notify-pri-on-incon-degr.sh;/usr/lib/drbd/notify-emergency-reboot.sh;echob/proc/sysrq-trigger;reboot-f;#Thenodeiscurrentlyprimary,butlosttheaftersplitbrain#autorecoveryprocedure.Asasconsequenceitshouldgoaway.#pri-lost-after-sb/usr/lib/drbd/notify-pri-lost-after-sb.sh;/usr/lib/drbd/notify-emergency-reboot.sh;echob/proc/sysrq-trigger;reboot-f;#Incaseyouhavesettheon-io-erroroptiontocall-local-io-error,#thisscriptwillgetexecutedincaseofalocalIOerror.Itis#expec
本文标题:MYSQL数据库术改造环境部署方案
链接地址:https://www.777doc.com/doc-6182478 .html