Use the NFS shared file system to implement the server load balancer environment

Source: Internet
Author: User
Experiment environment: 1. build an environment to simulate the normal running of server1 Discuz Forum LNMP. the installation process is not discussed in this article, if you are interested, please refer to another blog in this article. 1. create a mysql User for Discuz running # mysql-urootmysqlCREATEDATABASEdiscuz; // create a database in the discuzmysqlGRANTALLONdis experiment environment:
650) this. width = 650; "src =" http://upload.server110.com/image/20130924/1632453V6-0.png "/>

I. set up an environment to simulate server1's normal run of the Discuz Forum
The specific installation process of LNMP is not discussed in this article. if you are interested, please refer to another blog in this article.

1. create a Discuz instance MysqlUser
# Mysql-u root
Mysql> CREATE DATABASE Discuz; // Create a database Discuz
Mysql> grant all on discuz. * TO discuz@192.168.56.102IDENTIFIED BY "discuz"; // Create a mysql User discuz, give ownership of the discuz database, and set the password TO discuz
Mysql> flush priileges; // refresh the authorization table
Mysql> quit // exit

2. install Discuz
# Unzip Discuz_X2.5_ SC _UTF8.zip-d/usr/src/
# Mv/usr/src/upload/*/usr/html/
Access 192.168.56.102 through a browser to start the installation process. you need to grant the write permission to the corresponding file during the installation process. here we do not provide the steps one by one. The settings on the settings database page are as follows:
650) this. width = 650; "src =" http://upload.server110.com/image/20130924/163245I49-1.png "/>

3. create a user for the test Forum

650) this. width = 650; "src =" http://upload.server110.com/image/20130924/163245IU-2.png "/>

2. share/usr/html Directory through NFS in server1
The specific installation process of NFS is not covered in this article. if you are interested, please refer to another blog, here only the specific implementation process is given # vim/etc/exports // edit the configuration file to add the following line of content
/Usr/html 192.168.56.103 (rw)
# Exprotfs-rav // export the shared directory

3. build and test the platform on server 2

1. build LNMP

2. mount the shared directory of server1 to The Local NginxHome directory
# Rm-rf/usr/html/* // delete the file generated by installing nginx
# Mount-t nfs 192.168.56.102:/usr/html

3. create a mysql User discuz on server1 to allow connection through 192.168.56.103
Note: this operation is performed on server 1.
# Mysql-u root
Mysql> grant all on discu. * TO discuz@192.168.56.103IDENTIFIED BY "discuz ";
Mysql> flush privileges;
Mysql> quit

4. start nginx and test whether the forum can be opened through server2.
Access server2 through a browser for testing

650) this. width = 650; "src =" http://upload.server110.com/image/20130924/16324543G-3.png "/>

5. test whether the user registered on server 1 can successfully log on to server 2.

650) this. width = 650; "src =" http://upload.server110.com/image/20130924/16324521A-4.png "/>

IV. Summary
1. this method can be implemented eventually. Server load balancerBut it also increases the burden on the server1 Nic, so it is best to use dual Nic, communication between servers through a separate Nic

2, through repeated tests found that discuz access mysql using user @ IP to access, for example, in this experiment environment on the server1 discuz access mysql through discuz@192.168.56.102 users, and sever2 is to access mysql through the discuz@192.168.56.103, all to do 2 on mysql this authorization will not be connected to mysql was rejected

3. this installation uses the LNMP platform to install Discuz, which obviously feels like a special card. it is better to run smoothly on LAMP. no reason is found yet.
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.