Cluster LVS-DR app WordPress (shared background MySQL storage)

Source: Internet
Author: User
Tags install php install wordpress mysql command line phpmyadmin wordpress database

In the previous blog, a Linux server cluster with LVS-DR mode was deployed, and the use of it was described in this blog post, and the experiment was done by deploying WordPress in the cluster.

First, the deployment of experimental environment

First deploy the cluster, you can refer to the previous blog post deployment Lvs-dr method Deployment LVS-DR cluster: http://11142243.blog.51cto.com/11132243/1974868

Then, because WordPress uses the database, and here we need to ensure that regardless of which server the dispatcher assigns to us, we can access the same data, so we need to add a server to be responsible for the MySQL service. Add a server to the LVS-DR model built in the previous blog, IP configuration information:

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201710/24/e2bc4e1e90682b11b64fb4796d5635be.png-wh_500x0-wm_3 -wmp_4-s_1425371088.png "title=" Tim20171024130914.png "alt=" E2bc4e1e90682b11b64fb4796d5635be.png-wh_ "/>

Install the MySQL service and client on the MySQL server and create a WordPress account that can be accessed by a 172.16.0.0/16 network segment:

~]# yum-y install MySQL Mysql-server

After the installation is complete, start the MySQL service:

~]# Service mysqld Start

After starting the service, use the "MySQL" command directly into the MySQL command line mode (just installed, no password):

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/24/92cf20f62bece72301a75e507edd223d.png-wh_500x0-wm_3 -wmp_4-s_2087077194.png "title=" Tim20171024131255.png "alt=" 92cf20f62bece72301a75e507edd223d.png-wh_ "/>

In command-line mode, use the following command to create a wordpress database and WordPress users and give them remote login permissions:

mysql> create user ' wordpress ' @ ' 172.16.%.% ' identified by ' 123456 ';mysql> CREATE DATABASE wordpress;mysql> Grant all privileges the wordpress.* to WordPress;

After performing the above actions, you can remotely connect to this MySQL server as a Web server:

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/c1968b76e689ce4934ad41c87bf759ca.png-wh_500x0-wm_3 -wmp_4-s_1606124073.png "title=" Tim20171024131649.png "alt=" C1968b76e689ce4934ad41c87bf759ca.png-wh_ "/>

Command:

~]# mysql-u wordpress-h 172.16.128.16-p

Second, install WordPress

First install the necessary software for WordPress on both servers

~]# tar zxf wordpress-4.8.1-zh_cn.tar.gz-c/var/www/html/~]# yum-y install php php-mysql mysql #mysql安装用来测试是否能远程连 Connect to the database server

After the installation is complete, the two servers are accessed directly through the browser and the screen is successful:

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/24/f538bc5634d2694fff8b76cd2446b178.png-wh_500x0-wm_3 -wmp_4-s_2868415163.png "title=" Tim20171024125829.png "alt=" F538bc5634d2694fff8b76cd2446b178.png-wh_ "/>

Then modify the wordpress configuration file, the database name and other information to change:

~]# cp/var/www/html/wordpress/wp-config{-sample,}.php~]# vim/var/www/html/wordpress/wp-config.php

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/24/3cdd1fc2e6352b61185b336eb8827fb2.png-wh_500x0-wm_3 -wmp_4-s_3876061908.png "style=" Float:none; "title=" Tim20171024132407.png "alt=" 3cdd1fc2e6352b61185b336eb8827fb2.png-wh_ "/>

You can see the screen by direct access to the browser:

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/24/15ecbfd355c260b260d8bb47da3b2489.png-wh_500x0-wm_3 -wmp_4-s_3992924615.png "style=" Float:none; "title=" Tim20171024132732.png "alt=" 15ecbfd355c260b260d8bb47da3b2489.png-wh_ "/>

To access the scheduler, you can also see:

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/24/b4156feb23495e25b4589b7bdcc6e50c.png-wh_500x0-wm_3 -wmp_4-s_2351442120.png "title=" Tim20171024132949.png "alt=" B4156feb23495e25b4589b7bdcc6e50c.png-wh_ "/>

After filling in some information here, you can enter the WordPress main interface.

Third, testing

After entering the main interface, we can post a blog in which the name is test1:

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/24/4d20841250e5b50679ecd6713a697fe9.png-wh_500x0-wm_3 -wmp_4-s_2220324708.png "title=" Tim20171024143347.png "alt=" 4d20841250e5b50679ecd6713a697fe9.png-wh_ "/>

But which server is working for us? You can view it on the scheduler by following this command:

~]# watch-n 0.2 Ipvsadm-ln # "-n" after how many seconds to view once

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/24/0969eea1d110e51344b937d95483094d.png-wh_500x0-wm_3 -wmp_4-s_3903013654.png "title=" Tim20171024143417.png "alt=" 0969eea1d110e51344b937d95483094d.png-wh_ "/>

Activeconn is the number of connections currently in effect, you can see that when we refresh the page, the number of the two servers to switch back and forth, but such a switch back and forth will cause some problems, so we can add a delay option, Having an IP access to the scheduler can only access the same server for a period of time (see the previous blog for a specific way). We can also install phpMyAdmin on the MySQL server to view the database, the command is as follows (refer to the original blog for details):

[[Email protected] ~]# tar zxf phpmyadmin-3.5.4-all-languages.tar.gz-c/var/www/html/[[email protected] ~]# mv/var/www/ Html/{phpmyadmin-3.5.4-all-languages,phpmyadmin}[[email protected] ~]# service httpd startmysql> Grant all Privileges on wordpress.* to ' WordPress ' @ ' localhost ' identified by ' 123456 ';

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/24/4b2a79cec7059a9028bbff20082fd5ea.png-wh_500x0-wm_3 -wmp_4-s_2687512072.png "title=" Tim20171024145717.png "alt=" 4b2a79cec7059a9028bbff20082fd5ea.png-wh_ "/>


Cluster LVS-DR app WordPress (shared background MySQL storage)

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.