MySQL dual-machine hot backup installation and configuration [figure] _ MySQL

Source: Internet
Author: User
Install and configure MySQL dual-machine hot backup [group chart] bitsCN.com

Mysql dual-host hot backup is often used in linux server lvs load balancing and dual-host hot backup applications. the installation and configuration process is as follows:

1. install MYSQL

# Cp mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz/usr/local/

# Tar zxvf mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz

# Music mysql-standard-4.1.9-pc-linux-gnu-i686 mysql

# Cd mysql

# More INSTALL-BINARY

Check the installation documentation. Note that the installation is mainly in red.

# Groupadd mysql (create a mysql group)

# Useradd-g mysql (create a mysql User and add the user to this group)

# Scripts/mysql_install_db -- user = mysql (execute the database initialization and installation script as a mysql user)

# Chown-R root. (the root permission is the current directory)

# Chown-R mysql data (the mysql permission belongs to the data directory)

# Chgrp-R mysql. (the user and group owner who changed the mysql file/directory are the current directory)

# Bin/mysqld_safe -- user = mysql & (start the mysql database process in the background as a mysql user)

Then we can start the mysql database,

The figure above indicates that the installation is correct.

To make the database more secure, set the database password.

If the mysql database process can be automatically started when the server is started next time, we need to write the/etc/rc. d/rc. local file

Echo "/usr/local/mysql/bin/mysqld_safe -- user = mysql &" >;>;/etc/rc. d/rc. local
  
II. configure MYSQL dual-machine hot standby

The traditional mode uses mysql dual-host mutual backup. as for dual-host hot backup, I searched a lot of excellent posts and did not find the installation configuration document. So one of my ideas came about: when a new database is created, it will be created in/usr/local/mysql/data by default. if you can change the default configuration file my. conf, the database can be specified in a directory. for example, if I create a database on the disk cabinet, the dual-machine hot backup function can be implemented.

At first, I was confused about how to change the configuration file my. conf. I consulted a lot of friends, but none of them succeeded. Later, I heard a yddll friend say, "Hanging the array file system under/usr/local/mysql/data", and suddenly opened the door so that I could see Qingtian through the cloud fog. The principles are clear, and we will start to implement them below.

# Fdisk/dev/sdb

# Reboot

# Mkfs. ext3/dev/sdb1 (convert the array format to ext3 format)

# First, we copy all the files in the/usr/local/mysql/data/directory to another directory. I created one here.

# Mkdir

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.