I. Solution Analysis: we have built three servers, two for the Web server and one for the MySQL Data Server. Two Web servers directly connect the received data requests to the underlying MySQL server. Store all the data on the MySQL server. Here we use Wordpress, the most popular personal blog site, as our
I. Solution Analysis:
We have built three servers, two for the Web server and one for the MySQL Data Server. Two Web servers directly connect the received data requests to the underlying MySQL server. Store all the data on the MySQL server.
Here we use Wordpress, the most popular personal blog site, as our testing website.
II. Implementation Method:
We adopt a practical nfs sharing mechanism to share data on the Mysql server directly to two Web servers. when data is accessed through the Web serverPhpFind the Mysql database on another host.
Iii. Implementation Method:
1. Configure the Mysql server:
First, we need to configure the location of the yum installation source.
Then make sure that all important development kits have been successfully installed. They are:
"DevelopmentTooLs"
"DevelopmentLibraries"
"LegacySoftware Development"
"X SoftwareDevelopment"
"MySQLDatabase"
"WebServer"
Create a mysql user and group for mysql:
- GroupaDd-G 3306 mysql
- Useradd-U 3306-g mysql-M-s/sbin/nologin mysql
Do not forget to disable selinux on any host.
- Serenforce 0
Create a directory for storing data and mount the configured logical volume to the top (/mydata)
And grant it mysql permissions:
- Chown-R mysql: mysql/mydata
Download mysql-5.5.15-linux2.6-i686.tar.gzExtractTo/usr/local
Tarxf mysql-5.5.15-linux2.6-i686.tar.gz-C/usr/local
Create a link directory to make the simple directory name our working directory:
- Cd/Usr/local
- Ln-Sv mysql-5.5.15-linux2.6.i686 mysql
Change the owner Group of the mysql directory to the mysql user and mysql group.
- Cd mysql
- Chown-R mysql: mysql.
Initialize Mysql
- Scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data
Mysql cannot be started at this time.
Change owner to root user
- Chown-R root.
Prepare scripts for mysql to start the required services
- Cp SuPport-FileS/mysql. server/etc/init. d/mysqld
Add to service queue
- Chkconfig-- Add mysqld
Start startup
- Chkconfig mysqld on
At this time, an error will be reported if it is started. By default, mysql will find the data directory under its installation directory as its data directory.
Prepare the main configuration file for it
- Cp support-files/my-large.cnf/etc/my. cnf
Edit this file and give it a datadir directory
- Vim/etc/my. cnf
- Add: datadir =/mydata/data
- And set thread_coNcUrrency = change to the number of CPU cores x 2.
In this case, the instance can be started normally.
- Service mysqld start
If a startup error occurs, go to/mydata/data/localhost. localdomain. err to view the error message.
At this time, we have not fully prepared Mysql. We also need to prepare its library file and header file.
Import file:
- Vim/etc/ld. so. conf. d/mysql. conf
- Add:/usr/local/mysql/lib
-
Ldconfig
-
Use ldconfig to reload
Import the header file, PATH environment variable:
- Ln-sv/usr/local/mysql/include/usr/include/mysql
- Vim/etc/profile
- Write: PATH = $ PATH:/usr/local/mysql/bin
So far, all of our Mysql has been installed and can be officially started:
- Servicemysqld restart