mysql(5.077)+hearbeat+drbd+centOS6.4_x86_64
2013-07-12 18:52
447 查看
=========安装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
[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
相关文章推荐
- CentOS-6.4-x86_64 下安装mysql5.6
- CentOS-6.4-x86_64-minimal Nginx编译和安装
- CentOS 6.4 x86_64 部署 nginx 服务器实现点播功能
- CentOS 6.4 x86_64 安装GCC 4.7.3
- node.js源码包安装 centos6.4 x86_64
- node.js v0.10.31二进制包安装(centos6.4 x86_64)
- (7) linux 编译并安装mysql-5.6.15.tar.gz ---> CentOS-6.6-x86_64 + mysql-5.6.15.tar.gz
- CentOS 6.4 x86_64 最小化安装---基础优化总结
- 详解CentOS 6.5中安装mysql 5.7.16 linux glibc2.5 x86 64(推荐)
- CentOS-6.4-minimal版中安装MongoDB-x86_64-3.0.2
- centos 6.4 x86_64 Icinga1.9安装
- CentOS-6.5-x86_64-minimal 搭建mysql-5.6.29
- centos 6.4 x86_64 yum安装 xen 4.2.2
- Oracle学习笔记安装篇之在CentOS 6.4 x86_64下安装Oracle11gR2
- CentOS-6.4-x86_64-bin-DVD1安装
- centos6.4-x86-64系统更新系统自带Apache Http Server
- CentOS-6.4-x86_64-bin-DVD1
- CentOS6.5下安装mysql-5.7.18-linux-glibc2.5-x86_64
- RHEL 6.4使用CentOS 6.4 yum源更新-x86_64的脚本