HeartBeat + CRM + MYSQLD + NFS High Available Mysql Services

Test environment:

< p> OS: rhel6 p>

web1: 192.168.1.111 MariaDB Heartbeat hb_gui

web2: 192.168.1.112 MariaDB Heartbeat

web3: 192.168.1.114 NFS (shared storage)

VIP: 192.168.1.150

PS: In web1 and web 2 Configure mysql and heartbeat services, configure shared storage on web3;


One, first configure shared storage on web3

1. Create a shared storage directory

#mkdir /mydata

#vim /etc/exports

/mydata 192.168.1.0/24( rw,no_root_squash)

2. Re-export the file system

#exp ortfs -rav

3. Create a mysql user mysql group on web3

#groupadd -r -g 306 mysql

#useradd -r -u 306 -g mysql mysql

#setfacl -mu:mysql:rwx /mydata/

Two, on web1 and web2 Operation

1. Mount the shared directory on web3 to see if it has read and write permissions< /span>

# mkdir / mydata

#Mount -t nfs 172.16.100.9:/mydata /mydata

#touch a

#rm -rf a

2. Create a mysql user mysql group on web1 and web2

#groupadd -r -g 306 mysql

#useradd -r -u 306- g mysql mysql

3. Test to see if mysql users can read and write in the /mydata directory

#su-mysql

#cd /mydata

#touch a

#ls -a

#rm -rf a

< p>#exit

4. Install MariaDB (web1)

#scp mariadb-10.0.21-linux-x86_64.tar.gz web2.luochen.com:/root

#tar xf mariadb-10.0.21-linux-x86_64.tar.gz -C /usr/local/ p>

#cd /mydata

#mkdir data binlogs

#chown -R mysql.mysql data binlogs/

#ll

5. Create directory links and modify file directory owners and all groups

#cd /usr/local

#ln -sv mariadb-10.0.21-linux-x8 6_64 mysql

#cd mysql/

#chown -R root.mysql ./*

#scripts/mysql_install_db –user=mysql –datadir=/mydata/data/

6. Provide configuration files and service scripts

#mkdir /etc/mysql

#cp support-files/my-large.cnf /etc/mysql/my.cnf

#vim /etc/mysql/my.cnf

datadir = /mydata/data

< span style="font-family:'Microsoft YaHei','Microsoft YaHei';font-size:14px;color:rgb(0,0,0);"> innodb_file_per_table = ON

< p> log-bin=/mydata/binlogs/ master-bin

#cp support-files/mysql.server /etc/rc.d/init.d/mysqld

#chkconfig –add mysqld

#chkconfig mysqld off

#service mysqld start

< span style="fo nt-family:'Microsoft YaHei','Microsoft YaHei';font-size:14px;color:rgb(0,0,0);"> 7. Create a test database

#/usr/local/ mysql/bin/msql

MariaDB [(none)]> CREATE DATABASE student;

MarisDB [(none)]> SHOW DATABASES;

MariaDB [(none)]> \q

< span style="font-family:'Microsoft YaHei','Microsoft YaHei';font-size:14px;color:rgb(0,0,0);"> 8. Stop mysql service

#service mysqld stop

Three, install MariaDB on web2 (no initialization required)

#tar xf mariadb-10.0.21-linux-x86_64.tar.gz -C /usr/local/

#cd /usr /local

#ln -sv mariadb-10.0.21-linux-x86_64 mysql

#cd mysql/

#chown -R root.mysql ./* (No initialization required)


< span style="font-family:'Microsoft YaHei','Microsoft YaHei';font-size:14px;color:rgb(0,0,0);">#mkdir /etc/mysql

#scp /etc/mysql/my.cnf web2.luochen.com: /etc/mysql/ (copy the configuration file in web1 to web2)

#cp support-files/mysql.server /etc/rc.d/init.d/mysqld

#chkconfig –add mysqld

#chkconfig mysqld off

#service mysqld start

See if the database created on web1 exists on web2

#/usr/local/mysql /bin/msql

MariaDB [(none)]> SHOW DATABASES;

MarisDB [(none)]> SHOW BINARY LOGS;

MariaDB [(none)]> \q

Stop the service (before crm configuration)

#service mysqld stop

< p>Three, uninstall the mounted NFS on web1 and web2

# umount /mydata

four, modify the /etc/exports file

#vim /etc/exports

/mydata 192.168.1.0/24(rw)

Five, configure MySQL to implement highly available resource groups (mysql_ip, mysql_store, msqld) in hb_gui

First configure the stonith device to avoid contention for mysql shared storage resources< /p>

Add stonith resources

650) this.width=650;” src=”/wp-content/uploadshttp:/img.voidcn. com/vcimg/static/loading.png” title=”3.png” alt=”wKiom1YkxFPiCVXqAALmtQ2HVTE422.jpg” data-src=”http://s3.51cto.com/wyfs02/M01/74/A5/wKiom1YkxFPiCVXqAALmtQ2HV “> Add mysqlserver resource group

add mysql_ip

Add mysql_store

Add mysqld

Start the mysqlserver resource group

Add a remote test user (web2) on the node running the mysqld service

Switch mysql service running node (web1)

Check if mysqld is running on web1

View Does the database created on web3 exist?


PS: That’s it. . . . Take a break

Leave a Comment

Your email address will not be published.