測試環境為:rehdat Linux 9.0
hostname eth0 eth1
MySQL5 192.168.0.50/24 10.4.66.35/24
MySQL6 192.168.0.60/24 10.4.66.36/24
heartbeat interface eth0, with crosscab
service ip 10.4.66.88/24, by eth1, default gateway 10.4.66.2
共享存儲采用NAS服務器,數據訪問地址為10.4.66.251:/data
在服務器本地的掛在目錄也是/data
1. 安裝MySQL5.0,安裝到默認目錄
清除准備安裝MySQL的服務器上Linux自帶的MySQL-server,
[root@c0101 bin]# rpm -e MySQL-server
[root@c0101 bin]# rpm -qa|grep MySQL
MySQL-3.23.54a-11
[root@c0101 bin]# userdel MySQL
[root@c0101 bin]# mv /etc/my.cnf /etc/my.cnf.bak
(1)首先在第一台服務器(HA系統的主節點服務器),
開始安裝
1056 useradd MySQL
1057 tar xzvf MySQL-max-5.0.18-Linux-i686-glibc23.tar.gz
1059 mv mysql-max-5.0.18-Linux-i686-glibc23 /usr/local/MySQL
1060 cd /usr/local/MySQL
1088 chown -R root .
1089 chown -R MySQL ./data/
1090 chgrp -R MySQL .
設置數據路徑,把數據庫數據文件放在共享的NFS目錄下(NAS服務器),
PID和innioDB文件要放到服務器本地目錄上,才能正常啟動、停止服務:
1125 vi /etc/my.cnf
[MySQLd]
#Where to install a database data
datadir=/data/MySQLdata
#Where to install a innoDB engine
innodb_data_home_dir = /usr/local/MySQL/data
innodb_log_group_home_dir= /usr/local/MySQL/data
innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
1106 cp ./support-files/MySQL.server /etc/rc.d/init.d/
vi /etc/rc.d/init.d/MySQL.server
編譯第222開始的相關的兩行,把PID文件放在服務器本地目錄上:
pid_file=/usr/local/mysql/data/MySQLmanager-`/bin/hostname`.pid
server_pid_file=/usr/local/MySQL/data/`/bin/hostname`.pid
安裝MySQL的基本數據庫:
1123 mount 10.4.66.251:/data /data
1124 mkdir /data/MySQLdata
1127 ./scripts/mysql_install_db --user=MySQL
1145 chown -R mysql.mysql /data/MySQLdata/