mysql(5.077)+hearbeat+drbd+centOS6.4_x86_64

=========安装drbd、heartbeat================================================================
[root@TestDB1 ~]# rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
[root@TestDB1 ~]#yum -y install drbd84 kmod-drbd84


[root@TestDB1 ~]#rpm -Uvh ftp://mirror.switch.ch/pool/1/mirror/scientificlinux/6rolling/i386/os/Packages/epel-release-6-5.noarch.rpm 
[root@TestDB1 ~]# yum --enablerepo=epel install heartbeat
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
解决办法:
vi /etc/yum.repos.d/epel.repo
1)把第6行改成enabled=0 我不不想用这个源来更新系统
2)
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
改为
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch


[root@TestDB1 ~]# rpm -qa |grep drbd
kmod-drbd84-8.4.2-1.el6_3.elrepo.x86_64
drbd84-utils-8.4.2-1.el6.elrepo.x86_64
[root@TestDB1 ~]#  rpm -qa |grep heartbeat
heartbeat-libs-3.0.4-1.el6.x86_64
heartbeat-3.0.4-1.el6.x86_64


Config drbd for both machines
# vi /etc/drbd.conf 
Config heartbeat for both machines
[root@TestDB1 ha.d]#  cp /usr/share/doc/heartbeat-3.0.4/ha.cf /etc/ha.d/
[root@TestDB1 ha.d]# cp /usr/share/doc/heartbeat-3.0.4/authkeys /etc/ha.d/
[root@TestDB1 ha.d]# cp /usr/share/doc/heartbeat-3.0.4/haresources /etc/ha.d/
[root@TestDB1 ha.d]# vi ha.cf
[root@TestDB1 ha.d]# vi authkeys 
#lvremove /dev/VG001/LV_DB
#lvcreate -l 1308 -n LV_DB VG001  
#drbdadm create-md all      
#/etc/init.d/drbd start
#drbdadm -- --overwrite-data-of-peer primary r0   (只在主节点操作)   
Or # drbdsetup /dev/drbd0 primary -o 
#mkfs.ext3 /dev/drbd0 
#mount /dev/drbd0 /DB




=====================安装mysql========================================
 yum -y install gcc
 
 yum -y install gcc-c++ 
 
tar xzvf mysql-5.0.77.tar.gz
[root@TestDB1 mysql-5.0.77]# yum -y install ncurses-devel
./configure --prefix=/usr/local/mysql
make
==============
错误1:
/depcomp: line 571: exec: g++: not found
解决办法: yum -y install gcc-c++ 
错误2:
../include/my_global.h:991: error: redeclaration of C++ built-in type ‘bool’
make[2]: *** [my_new.o] Error 1
make[2]: Leaving directory `/root/mysql-5.0.77/mysys'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/mysql-5.0.77'
make: *** [all] Error 2
解决办法:重新configure
==================
make install


将mysql命令加入path变量
vi /etc/profile.d/mysql.sh


export PATH=$PATH:/usr/local/mysql/bin/:/usr/local/mysql/libexec


#source mysql.sh
====================安装mysql 结束========================================
将JDC上/etc/init.d/mysqld  复制过来
cp -rf /usr/local/mysql/bin/* /usr/bin/
mkdir  /DB/binlog
将“D:\chengang\09 TMSP\JDC\DB schema change\SJDC_DB系统环境备份”下mysql 都放到/etc/init.d/,权限如下
[root@TestDB1 data]# ll /etc/init.d/mysqld
-rwxr--r-- 1 root root 4528 Jul 12 10:47 /etc/init.d/mysqld
[root@TestDB1 ~]# vi /etc/my.cnf (mysql 配置文件)


=====================恢复DB数据物理文件======================
#从backup server上远程copy文件到server上
nohup rsync -avuz TMSP_BACKUP@10.80.28.34::backup/backup-20130602130002_mysql/data /DB 
or
10 20 26 6 * rsync -avuz TMSP_BACKUP@10.80.28.34::backup/backup-20130602130002_mysql/data /DB > /DB/rsync.log 


#改文件权限
chown -R mysql.mysql /DB/data
=================本地备份测试恢复DB物理文件======================
备份DB
tar cvpzf mysql.tgz ./ --exclude=ibdata1 --exclude=ib_logfile0 --exclude=ib_logfile1  --exclude=mysql
恢复DB
tar xvpfz mysql.tgz -C ./
==================通过heartbeat启动mysql====================
#ln -s /etc/init.d/mysqld /etc/ha.d/resource.d/mysqld
[root@TestDB1 data]# /etc/init.d/heartbeat start
错误1:
Starting High-Availability services: INFO:  Resource is stopped
 Heartbeat failure [rc=6]. Failed.


heartbeat[2400]: 2013/07/12_10:53:53 ERROR: Bad permissions on keyfile [/etc/ha.d//authkeys], 600 recommended.
heartbeat[2400]: 2013/07/12_10:53:53 ERROR: Authentication configuration error.
heartbeat[2400]: 2013/07/12_10:53:53 ERROR: Configuration error, heartbeat not started.
解决办法:
#chmod 600 /etc/ha.d/authkeys


错误2:
/usr/libexec/mysqld: Can't change dir to '/DB/data/' (Errcode: 13)
130711  5:54:23 [ERROR] Aborting
解决办法:
关闭SElinux不重启系统的方法
Redhat系统,修改/etc/sysconfig/selinux文件:


#SELINUX=enforcing
SELINUX=disabled


重启生效,如果不想重启,用命令
setenforce 0


错误3: [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
解决办法:
  #cd /DB/
  #rm -rf data
  #/usr/bin/mysql_install_db 
  instead of running service mysqld start or service mysqld restart try running:
=========确认开机启动===========
chkconfig drbd on
chkconfig heartbeat on
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值