MySQL dual-machine hot backup installation and configuration are often used in linux server lvs load balancing and dual-machine 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# mv mysql-standard-4.1.9-pc-linux-gnu-i686 mysql# cd mysql# more INSTALL-BINARY
# Groupadd mysql (create a mysql group) # useradd-g mysql (create a mysql User and add the user to the 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 is 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 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-p/bak/mysql_data
# Cd/usr/local/mysql/data/
# Cp-a */bak/mysql_data
# Mount/dev/sdb1.
# Mount/dev/sdb1/usr/local/mysql/data/
# Note: When you start the mysql process, it will encounter an error because/usr/local/mysql/data/is empty, therefore, we need to copy the backup file and directory back to the original location.
# Cd/bak/mysql_data
# Cp-a */usr/local/mysql/data/
# The mysql database can be started now, but an error will be prompted when the database is created. I am confused for a lot of time here. The directory property has not been changed.
# Stop the database and run the command/usr/local/mysql/bin/mysqladmin-uroot-p123456 shutdown.
# Cd/usr/local/mysql/
# Chown-R mysql data (this will work)
# Start the mysql database process again,/usr/local/mysql/bin/mysqld_safe -- user = mysql &
# Create database squall;
# When you press enter, the system will prompt that the database is successful, and the auxiliary machine will also mount/dev/sdb1. show databases will see the squall database created on the host.
The above is MySQL's dual-machine hot backup installation and configuration _ MySQL content. For more information, please follow the PHP Chinese network (www.php1.cn )!