High-availability cluster heartbeat v2--based on CRM for MySQL high availability cluster (not finished)

Source: Internet
Author: User

Experiment Description:

This experiment is based on Heartbeat CRM, which realizes high availability to MySQL service, and does not have high available MySQL data.

Unfinished: The Specify mount option fails when using Hb_gui to configure Mount NFS.

MySQL data and configuration files placed on NFS shared storage

The mysql configuration file is specified using--default-extra-file

MySQL user has read and write access to the NFS share, and the ID number of the NFS server and MySQL server is the same

On the NFS server

1 modifying hostname

# vim/etc/sysconfig/network

# hostname Nfs.hiyang.com


2 Automatic mount on boot

# mkdir/data/mysql-p

# Vim/etc/fstab

Add the next line to enable automatic mounting of the boot

/dev/myvg/lvtest/data/mysql ext3 defaults,acl 0 0

Read Fstab file

# mount-a


3 modifying information for MySQL users

3.1 Modifying Group IDs

# groupmod-g 3306 MySQL

3.2 Modify User ID, do not log in, specify home directory

# usermod-u 3306-g 3306-s/sbin/nologin-d/data/mysql/mysql

3.3 Viewing MySQL user information

# ID MySQL

uid=3306 (MySQL) gid=3306 (MySQL) groups=3306 (MySQL)

# finger MySQL

Login:mysql Name:mysql Server

Directory:/data/mysql/ Shell:/sbin/nologin

Never logged in.

3.4 Modifying the owners and groups of MySQL data directories

# chown-r mysql.mysql/data/MySQL


4 NFS Shared Directory

# Vim/etc/exports

/data/mysql 192.168.8.0/24 (rw,no_root_squash)

If there is no no_root_squash, MySQL is initialized with the root user, the NFS shared file cannot be accessed, MySQL initialization cannot be completed


# Exportfs-arv

Exporting 192.168.8.0/24:/data/mysql

Because the previous heartbeat is already running, stop heartbeat first

# SSH node2.hiyang.com "service Heartbeat Stop"

# Service Heartbeat Stop


On the Node1.

1 Creating a home directory for MySQL

# mkdir/data/


2 Modifying MySQL user information

# groupmod-g 3306 MySQL

# usermod-u 3306-g 3306-s/sbin/nologin-d/data/mysql


3 Mounting

# mount-nfs-o nolock,nfsverrs=3 192.168.8.111:/data//data/

# ls-ld/data/mysql/

Drwxr-xr-x 3 mysql mysql 4096 June 11:46/data/mysql/#用户映射成了本地的mysql


4 using binary format MySQL, initialize

# Tar XF mysql-5.5.49-linux2.6-x86_64.tar.gz-c/usr/local/

# CD /usr/local/

# LN-SV mysql-5.5.49-linux2.6-x86_64 MySQL

# CD MySQL

# Chown-r Root.mysql./

#./scripts/mysql_install_db--user=mysql--datadir=/data/mysql/

4.1 Viewing the initialized data

# ls/data/mysql/-L

Total 12

drwx------2 MySQL root 4096 June 13:45 MySQL

drwx------2 MySQL mysql 4096 June 13:45 Performance_schema

drwx------2 MySQL root 4096 June 13:45 test


4.2 MySQL configuration file

# CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF

# vim /etc/my.cnf

DataDir =/data/mysql

innodb_file_per_table = 1

4.3 MySQL service script

# CP Support-files/mysql.server/etc/init.d/mysqld


5 starting MySQL

# service Mysqld Start OK

#/usr/local/mysql/bin/mysql OK

Create Database,tables OK


6 Uninstalling the NFS shared directory

# umount/data/mysql/


7 Copying configuration files and service scripts to Node2

# scp/etc/my.cnf node2.hiyang.com:/etc/

# Scp/etc/init.d/mysqld NODE2.HIYANG.COM:/ETC/INIT.D

On the Node2.

1 The MySQL user is created the same as in Node1, and the data Directory/data/properties are the same as Node1


2 Mounting NFS Shared directory

# Mount-nfs-o Nolock,nfsverrs=3 192.168.8.111:/data/mysql/data/


3 using binary format mysql, here without initialization did not scatter the data

# Tar XF mysql-5.5.49-linux2.6-x86_64.tar.gz-c/usr/local/

# CD /usr/local/

# LN-SV mysql-5.5.49-linux2.6-x86_64 MySQL

# CD MySQL

# Chown-r Root.mysql./

The configuration file and service scripts have been copied, so you can start MySQL.


4 starting MySQL

# service Mysqld Start OK

#/usr/local/mysql/bin/mysql OK

Create Database,tables OK

Create the resource IP filesystem in the group Mysqld

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/83/5C/wKiom1dxKibjsg4XAABIKDRzLIY381.png "border=" 0 " Style= "font-size:10.5pt;line-height:1.5;" height= "136"/>


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/83/5B/wKioL1dxKieSegXIAACdxoU_OV4847.png "border=" 0 " Style= "font-size:10.5pt;line-height:1.5;" height= "457"/>


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/83/5C/wKiom1dxKieShBojAAClwjiaC-8522.png "border=" 0 " height= "448"/>


Error when specifying options


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/83/5B/wKioL1dxKieyR-DBAACBXgYaggs251.png "border=" 0 " height= "395"/>



From for notes (Wiz)



This article is from the "Hiyang" blog, make sure to keep this source http://hiyang.blog.51cto.com/10728919/1793443

High-availability cluster heartbeat v2--based on CRM for MySQL high availability cluster (not finished)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.