Discuz forum for NFS mounting in LAMP in CentOS

Source: Internet
Author: User

1. Experiment description

1. Load Balancing through DNS

2. Mount the NFS Network File System for the web server to ensure data synchronization between the two web Servers

3. Lab platform environment

1) Load Balancing Between Two Apache servers

2) A cgi server is mounted to the NFS Network File System for data synchronization.

3) One mysql Server

4) Deploy the DNS server to an Apache server

4. Operating System usage

Three CentOS6.4 and one Centos6.5

All of the above uses CentOS6.4. Today, a newly added Apache server uses CentOS6.5

5. IP Address Allocation

The topology shown in the following figure is displayed.

6. LAM 3 is followed by two other blog posts in this blog:

LAMP: Installation and interconnection of apache, mysql, and php

LAMP 2: Performance Testing of LAMP and installation of xcache for php Acceleration

7. About DNS

The establishment of DNS server is described in detail in two blog posts in this blog.

8. This experiment relies heavily on one of LAMP: Installation and interconnection of apache, mysql, and php. One of LAMP has a very detailed service compilation and installation process, there are three servers in total. Here we will prepare an Apache server for load balancing, so we will not repeat the service construction. Please refer back

Ii. Network Topology

The network topology is only described in the experiment architecture. The specific branches and leaves are not planned.

3. Prepare the DNS server

1. Add Resource Records for shuishui.com. After creating resource records, do not forget to perform the six steps of the DNS server.

2. Perform DNS explanation round robin

In the preceding configuration, www.shuishui.com corresponds to two IP addresses. The specific A record is determined by the rrset-order statement.

This is in/etc/named. an example of the options statement IN the conf file about rrset-order configuration: rrset-order {class IN type A name "www.shuishui.com" order cyclic ;}; this setting will return the responses of A records IN the IN class in a random order, and the IN class will be suffixed with "mail.example.com. Other records are returned as cyclic records.

Rrset-order supports three parameters: fixed, random, and cyclic.
Fixed Multiple A records in the order of configuration files
Random
Cyclic Loop

3. DNS resolution Test

1) test on a linux host

2) test on a windows Host

4. Newly Added Apache server settings (172.16.251.194)

1. Enable httpd-related modules

After Apache httpd 2.4, there has been a dedicated module for FastCGI implementation. This module is mod_proxy_fcgi.so, which is actually used as an extension of the mod_proxy.so module. Therefore, both modules must be loaded.

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

1 vim /etc/httpd24/httpd .conf

2. Configure the Apache server to support fcgi

The VM is not used here, and the central host is used directly, and its DocumentRoot is changed.

ProxyPassMatch. the file request at the end of php is sent to the php-fpm process. The php-fpm must at least know the running directory and URI. Therefore, you can directly go to fcgi: // 172.16.150.150: the two parameters are specified after 9000. The passing of other parameters has been encapsulated by mod_proxy_fcgi.so and does not need to be specified manually.

3. Edit the apache configuration file httpd.

1 # vim /etc/httpd24/httpd.conf

1) Add the following two rows:

AddType application/x-httpd-php. php

AddType application/x-httpd-php-source. phps

2) locate DirectoryIndex index.html

To:

DirectoryIndex index. php index.html

In versions earlier than Apache httpd 2.4, PHP is either run as an Apache module, or a third-party module is added to support PHP-FPM implementation.

V. NFS Network File System Configuration

1. server configuration (php, cgi server)

1) NFS Overview

NFS is short for Network File System, that is, Network File System. An agreement for the use of distributed file systems, developed by Sun, was published on April 9, 1984. The function is to allow different machines and operating systems to share individual data with each other through the network, so that applications can access data on server disks through the network on the client, it is a way to share disk files between Unix-like systems.

The basic principle of NFS is "allow different clients and servers to share the same file system through a group of RPC", which is independent of the operating system, allows different hardware and operating system systems to share files.

NFS depends on the RPC protocol during file transfer or information transfer. Remote Procedure Call (RPC) is a mechanism that enables the client to execute programs in other systems. NFS itself does not provide information transmission protocols and functions, but NFS allows us to share data over the network, because NFS uses some other transmission protocols. These transmission protocols use this RPC function. NFS itself is a program that uses RPC. Or NFS is also an rpc server. Therefore, the RPC service must be started wherever NFS is used, whether it is an nfs server or an nfs client. In this way, the SERVER and CLIENT can implement the corresponding program port through RPC. We can understand the relationship between RPC and NFS in this way: NFS is a file system, while RPC is responsible for information transmission.

2) Installation

NFS installation is simple. You only need to install nfs-utils. Because NFS itself is a kernel module, you can use lsmod to check whether NFS already exists. If not, that's yum!

Three key processes

(1) mountd: a daemon is mounted to authenticate the client source. The server is usually mapped to a local file system through the client, which is as convenient as using a local file system.

(2) nfsd: file read/write

(3) idmapd: id ing Process

3) Configure the server

The configuration of the NFS server is relatively simple. You only need to set it in the corresponding configuration file and then start the NFS server.

Use service nfs start to start the nfs service

Use exportfs-a to export all file systems

1 vim /etc/exports

File System export attributes

① Rw, readable and writable

② Async, asynchronous

③ Sync, synchronization

④ Root_squash: compresses root users and converts root users to nfsnobody users during network access based on imapd.

⑤ No_root_squash, do not compress the root user

⑥ All_squash: compresses all users

7. anonuid and anongid: Specify the UID and GID mapped to anonymous users.

2. Client configuration (two Apache servers)

1) Direct mounting

Install nfs-utils in the same way as installing the server in the client, but you do not need to configure the/etc/exports file and then mount it (create a folder in advance)

2) set your own mounting upon startup

3) test whether the Apache server works properly.

Add the index.php test page to the/www/shuishui.com/directory of the nfs server.

(1) Apache server 172.16.251.93 is working properly

(2) Apache server 172.16.251.194 is working properly

Now, the NFS Network File System is configured. The last step is to install the Forum and test whether it can synchronize data.

6. Test Data Synchronization at the Discuz Forum

1. Install the Forum

First download discuz_x2.5_ SC _gbk.zip on the PHP server and decompress it to get an upload directory. Because permission issues are involved during Discuz installation, the permission is set to 777 for the file.

1) install the Discuz forum on the Apache server 172.16.251.93. Of course, you can install the Discuz forum on the other server.

2) Step 2 of Forum Installation

3) Step 3 of Forum Installation

The third step of Forum installation requires associated database, so we should authorize a user on mysql Server 172.16.251.104 in advance. The authorized user name and password here are called admin, and the database name is ultrax, the Administrator account and password are both set to admin.

On the mysql server, 172.16.251.104, authorize the admin user

The next step is the installation process. The Forum is successfully installed,

2. test that two Apache servers can synchronize data in real time using the NFS Network File System.

1) first post on 172.16.251.194

2) check whether this post exists on another Apache server 172.16.251.93.

Well! Indeed, this post is also posted on the second server, which proves that the two Apache servers share the NFS Network File System.

3) use the domain name to access and check whether this post exists.

Yes, the domain name can also be accessed normally. These two Apache servers are used for Load Balancing Based on DNS round robin, so the results will not be tested here.

This article is from the "nmshuishui blog", please be sure to keep this source http://nmshuishui.blog.51cto.com/1850554/1384418

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.