阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

LAMP+NFS实现多个Web服务器静态资源统一存储

158次阅读
没有评论

共计 29573 个字符,预计需要花费 74 分钟才能阅读完成。

需求分析:

1. 前端需支持更大的访问量,单台 Web 服务器已无法满足需求了,则需扩容 Web 服务器;

2. 虽然动态内容可交由后端的 PHP 服务器执行,但静态页面还需要 Web 服务器自己解析,那是否意味着多台 Web 服务器都需要在各自的系统中都存有一份静态页面数据呢?

其实这样也不是不可以,毕竟文件本地访问,速度还是有优势的,但这却涉及到多台 Web 服务器间内容的一致性问题,这种问题也不可避免;

那么如果能将静态页面集中存放,所有 Web 服务器都来集中地取文件,对于文件的一致性就有了保障,这个集中地就叫做“文件共享服务器”;

文件共享有多种方式,FTP,NFS,Samba 等,而其中 NFS 作为网络文件系统,允许一个系统通过网络共享目录和文件,通过使用 NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件,这种近似访问本地文件系统的架构貌似很符合我们的需求,我们现在就来实现这个需求!

需求实现:

1.web1 充当 http 服务器和 DNS 解析服务器,客户端到 web1 和 web2 的请求,如果是静态资源请求通过 php 主机的 NFS 服务挂载的存储返回结果

2.web1 和 web2 对于客户端动态资源请求都反向代理到后端 php 服务器进行执行后返回结果

3.web1 和 web2 实现 DNS 轮询,客户端访问博客网站是负载均衡的。

4. 建立 wordpress 博客

5. 数据库存储 wordpress 博客的各种数据

实验架构:

 LAMP+NFS 实现多个 Web 服务器静态资源统一存储

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Windows 7 下硬盘安装 Ubuntu 14.10 图文教程 http://www.linuxidc.com/Linux/2014-10/108430.htm

U 盘安装 Ubuntu 14.10 http://www.linuxidc.com/Linux/2014-10/108402.htm

Ubuntu 14.10 正式发布下载 http://www.linuxidc.com/Linux/2014-10/108363.htm

Ubuntu 14.04 LTS 如何升级到 Ubuntu 14.10  http://www.linuxidc.com/Linux/2014-10/108381.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

部署实现

一.DNS服务器在 web1 上的实现

开发环境配置

1
# yum –y groupinstall Development Tools

配置 DNS 服务器:

安装 DNS 服务器软件bind

1
#yum –y install bind

配置 DNS 主配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# vim /etc/named.conf
//
//named.conf
//
//Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// serveras a caching only nameserver (as a localhost DNS resolver only).
//
// See/usr/share/doc/bind*/sample/ for example named configuration files.
//
  
options {
//      listen-on port 53 {127.0.0.1;};
//      listen-on-v6 port 53 {::1;};
        directory       "/var/named";
        dump-file      "/var/named/data/cache_dump.db";
        statistics-file"/var/named/data/named_stats.txt";
        memstatistics-file"/var/named/data/named_mem_stats.txt";
//      allow-query     {localhost;};
        recursion yes;
  
//      dnssec-enable yes;
//      dnssec-validation yes;
//      dnssec-lookaside auto;
  
        /* Path to ISC DLV key */
        /*bindkeys-file"/etc/named.iscdlv.key";
  
        managed-keys-directory"/var/named/dynamic";
        */
};
  
logging {
        channel default_debug {
                file"data/named.run";
                severity dynamic;
        };
};
  
zone"." IN {
        type hint;
        file "named.ca";
};
  
include"/etc/named.rfc1912.zones";
include "/etc/named.root.key";

 

配置主区域文件:只是在文件尾部添加正向区域

1
2
3
4
5
# vim /etc/named.rfc1912.zones
zone"stu31.com" IN {
        type master;
        file "stu31.com.zone";
};

 

配置正向区域解析库文件:

这里让客户端查询 http 服务器时能轮换查询到两台 web 服务器。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# vim/var/named/stu31.com.zone
$TTL 600
$ORIGINstu31.com.
@       IN     SOA     ns.stu31.com.   root.stu31.com. (
                        2014122301
                        1H
                        3M
                        5D
                        6H )
@       IN     NS      ns
        IN     MX  5   mail
ns      IN     A       172.16.31.30
www     IN     A       172.16.31.30
www     IN     A       172.16.31.31
mail    IN      A      172.16.31.30

 配置文件语法检查:

1
2
3
#named-checkzone  stu31.com /var/named/stu31.com.zone 
zonestu31.com/IN: loaded serial 2014122301
OK

 

启动 DNS 服务:

1
2
3
# servicenamed start
Generating/etc/rndc.key:                                 [OK]
Starting named:                                            [OK]

 

测试全部区域解析:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# dig -taxfr stu31.com @172.16.31.30
  
;<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> -taxfr stu31.com @172.16.31.30
;; globaloptions: +cmd
stu31.com.              600     IN     SOA     ns.stu31.com. root.stu31.com.2014122301 3600 180 432000 21600
stu31.com.              600     IN     NS      ns.stu31.com.
stu31.com.              600     IN     MX      5 mail.stu31.com.
mail.stu31.com.         600    IN      A       172.16.31.30
ns.stu31.com.           600    IN      A       172.16.31.30
www.stu31.com.          600     IN     A       172.16.31.30
www.stu31.com.          600     IN     A       172.16.31.31
stu31.com.              600     IN     SOA     ns.stu31.com.root.stu31.com. 2014122301 3600 180 432000 21600
;; Querytime: 1 msec
;;SERVER: 172.16.31.30#53(172.16.31.30)
;; WHEN:Wed Dec 24 02:44:40 2014
;; XFR size: 8 records (messages 1, bytes 210)

DNS服务器安装完毕!这里是最简单的正向区域的实现,果有不清楚的话,我前面的博文有详细介绍。

 

二.      apache服务器在 web1web2上的实现

httpd的安装同时在 web1web2上安装:

DNS 服务器地址指向172.16.31.30

开发环境配置:

1
2
# yum –y groupinstall Development Tools
# yum install -ypcre-devel openssl-devel

 

编译安装apr

1
2
3
4
# tar xf apr-1.5.0.tar.bz2
# cd apr-1.5.0
# ./configure--prefix=/usr/local/apr
# make && make install

 

编译安装apr-util

1
2
3
4
# tar xf apr-util-1.5.3.tar.bz2
# cd apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util--with-apr=/usr/local/apr
# make && make install

 

编译安装httpd-2.4.10

1
2
3
4
# tar xf httpd-2.4.10.tar.bz2
# cd httpd-2.4.10
# ./configure --prefix=/usr/local/apache  --sysconfdir=/etc/httpd24 --enable-so--enable-ssl --enabletc/httpd24 --enable-so --enable-ssl --enable-rewrite--with-z --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-modules=most--enable-mpms-shared=all --with-mpm=event
#make && make install

Apache服务脚本创建:

复制一个系统上原有的 httpd 的脚本更改如下:

#cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

加入系统服务:

1
2
#chkconfig –add httpd24
#chkconfig  httpd24 on

 

启动 httpd 服务:

1
2
3
# servicehttpd24 restart
Stoppinghttpd:                                           [OK]
Startinghttpd:                                           [OK]

 

 

    Web服务器基础部分搭建完成,只需要后续虚拟主机配置与 PHP 结合。

 

三.      MariaDB数据库服务器安装

MariaDB服务器的 DNS 指向172.16.31.30

开发环境配置:

1
2
# yum groupinstall Development Tools
# yum -y install pcre-devel openssl-devel

XFS文件系统支持:

1
# yum install xfsprogs

服务器数据库数据文件存储考虑到安全性,我将创建一个 LVM 进行数据库数据文件的存储,并采用新型文件系统 XFS 来提高数据库服务器的性能。

格式化磁盘:

1
2
#  echo -n -e"n\np\n3\n\n+10G\nt\n3\n8e\n\w\n" |fdisk /dev/sda
# partx -a /dev/sda

创建LVM

1
2
3
# pvcreate/dev/sda3
# vgcreate myvg/dev/sda3
# lvcreate -L 10G -n mylv myvg

创建 xfs 文件系统:

1
2
# mkfs -t xfs /dev/myvg/mylv
# blkid /dev/myvg/mylv

自动挂载,在 /etc/fstab 文件尾部添加:

1
2
# vim /etc/fstab
UUID="ba4e1e6c-3b7f-4f66-95b1-f51f8792288d"  /mydata xfs  defaults     0  0

创建数据库管理用户:

1
# useradd -M -s /sbin/nologin -d /mydata/data -r MySQL

创建数据库数据文件存储目录:

1
# mkdir /mydata/data

并给予 mysql 用户数据库数据文件存储目录管理权限:

1
# chown -R mysql:mysql /mydata/data/

解压数据库二进制源码包:

1
2
# tar xf mariadb-10.0.10-linux-x86_64.tar.gz -C /usr/local/
# cd /usr/local/

 

创建软链接:

1
2
# ln -s mariadb-10.0.10-linux-x86_64/  mysql
# cd mysql/

 

初始化安装MariaDB

1
# scripts/mysql_install_db --user=mysql--datadir=/mydata/data

mariadb配置文件创建及更改,有模版

安装系统的时候,/etc/路径下有一个 my.cnf 的,这里换个路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# mkdir /etc/mysql
# cp support-files/my-huge.cnf /etc/mysql/my.cnf
# vim /etc/mysql/my.cnf
[mysqld]
datadir = /mydata/data
port            = 3306
socket          =/tmp/mysql.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
innodb_file_per_table = on
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

mariadb服务脚本创建

1
2
3
4
5
6
7
8
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld start
Starting MySQL.                                           [OK]
# ls /mydata/data/
aria_log.00000001 ib_logfile0        mysql             mysql.stu31.com.pid
aria_log_control  ib_logfile1       mysql-bin.000001 performance_schema

mysqld服务的一些设置

设置环境变量:

1
2
# vim /etc/profile.d/mysqld.sh
export PATH=/usr/local/mysql/bin:$PATH

加载环境变量:

1
# source /etc/profile.d/mysqld.sh

 

输出 mysql 的头文件至系统头文件路径/usr/include

1
# ln -sv /usr/local/mysql/include /usr/include/mysql

 

输出 mysql 的库文件给系统库查找路径,系统重新加载:

1
2
# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
# ldconfig

测试客户端启动:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.10-MariaDB-log MariaDB Server
  
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
  
Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.
  
MariaDB [(none)]> select version();
+---------------------+
| version()           |
+---------------------+
| 10.0.10-MariaDB-log |
+---------------------+
1 row in set (0.00 sec)
  
MariaDB [(none)]> \q
Bye

给数据库设置一个密码。

 
1
2
3
# mysqladmin -u root password
New password:
Confirm new password:

MariaDB安装完毕,只是基本的数据库环境,后面还需要数据库与博客网站结合 

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-12/110943p2.htm

四.PHP服务器上安装基于 FastCGI 的实现

PHP服务器的 DNS 设置成172.16.31.30

开发环境配置:

1
2
# yumgroupinstall Development Tools
#yum install  –y pcre-devel openssl-devellibxml2-devel php-gd freetype-devel mbstring

 

 编译安装php-5.6.4

1
2
3
#tar xf php-5.6.4.tar.xz -C /usr/src/
# cd/usr/src/php-5.6.4/
#./configure --prefix=/usr/local/php --with-MySQL=mysqlnd--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --with-gd --enable-xml --enable-sockets --enable-fpm--with-mcrypt --with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts

安装:

1
#make&& make install

PHP 服务器提供配置文件:

1
#cp php.ini-production /etc/php.ini

php 提供 Sys 启动控制脚本,加入开机启动。

1
2
3
4
5
6
# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
# chmod +x /etc/rc.d/init.d/php-fpm
# chkconfig --list php-fpm
service php-fpm supports chkconfig, but is not referenced in anyrunlevel (run 'chkconfig --add php-fpm')
# chkconfig --add php-fpm
# chkconfig php-fpm on

php-fpm 提供配置文件,编辑 php-fpm 配置文件,修改监听端口,默认是127.0.0.1

1
2
3
4
5
6
7
8
# cp /usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
# vim /usr/local/php/etc/php-fpm.conf
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8
pid = /usr/local/php5/var/run/php-fpm.pid
listen = 172.16.31.22:9000

 

启动 php-fpm,检查php 监听端口。

1
2
3
4
# service php-fpm start
Starting php-fpm  done
# ss -tunl |grep 9000
tcp    LISTEN     0     128         172.16.31.22:9000                  *:*

环境变量设置:

1
2
3
4
5
6
7
# vim /etc/profile.d/php.sh
export PATH=/usr/local/php/bin:$PATH
# source /etc/profile.d/php.sh
# php -v
PHP 5.4.26 (cli) (built: Dec 21 2014 01:53:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

 

PHP部分配置完成,基本的 php 服务器环境,后面需要与 web 服务器结合。

 

 

五.      PHP服务器上启用 NFS 服务

创建一个目录或者提供一个特定的文件系统;亦可以参考上面的为数据库数据文件存储创建的特定文件系统:

# mkdir /web

创建 wordpress 博客的网站存放目录,我们将其共享出去让 web 服务器使用:

#mkdir /web/blog

查看 NFS 软件是否安装:

1
2
# rpm -qanfs-utils
nfs-utils-1.2.3-54.el6.x86_64

NFS服务的配置文件为 /etc/exports,这个文件是NFS 的主要配置文件,不过系统并没有默认值,所以这个文件不一定会存在,可能要使用 vim 手动建立,然后在文件里面写入配置内容。

1
2
# cat /etc/exports
/web/blog 172.16.31.30(rw,async,no_root_squash)172.16.31.31(rw,async,no_root_squash)

# 配置共享目录为可读写,客户端 root 用户权限不压缩

/etc/exports文件内容格式:

<输出目录 > [ 客户端 1 选项(访问权限 , 用户映射 , 其他)] [客户端 2 选项(访问权限 , 用户映射 , 其他)]

开启 nfs 服务:

1
2
3
4
5
6
7
8
9
10
11
[root@php ~]# service nfs restart
Shutting down NFS daemon:                                  [OK]
Shutting down NFS mountd:                                  [OK]
Shutting down NFS quotas:                                  [OK]
Shutting down NFS services:                                [OK]
Shutting down RPC idmapd:                                  [OK]
Starting NFS services:                                     [OK]
Starting NFS quotas:                                       [OK]
Starting NFS mountd:                                       [OK]
Starting NFS daemon:                                       [OK]
Starting RPC idmapd:                                       [OK]

 

查看本地 NFS 文件系统共享的目录:

1
2
3
# showmount -e 172.16.31.32
Export list for 172.16.31.32:
/web/blog 172.16.31.31,172.16.31.30

 

NFS文件系统建立完成。

 

六.      web1web2上挂载 NFS 文件系统到本地目录

NFS客户端配置

这里的客户端就是前端的 2Web服务器,先挂载共享目录,然后测试其读写功能

在客户机上执行 mount 命令 , 它向服务器上的端口映射器发出一个 RPC 调用来获得服

务器上安装守护程序的端口号。客户和端口映射器交互既可以使用 TCP 也可以使用 UDP, 但一般使用UDP

NFS 文件系统挂载到 web 服务器上

我们现在 web 服务器上查看 NFS 文件系统共享的目录:

1
2
3
# showmount -e172.16.31.32
Export list for172.16.31.32:
/web/blog172.16.31.31,172.16.31.30

我们先在 web 服务器上创建本地目录:/web/blog

1
[root@web1 ~]#mkdir /web/blog -pv

挂载 NFS 共享的文件目录到本地:

可以使用临时挂载:

1
[root@web1 ~]#mount -t nfs 172.16.31.32:/web/blog /web/blog

也可使用开机系统自动挂载:

1
2
[root@web1 ~]#vim /etc/fstab
172.16.31.32:/web/blog  /web/blog               nfs     defaults,_netdev 0 0

这里的 _netdev 选项是为了防止远程 NFS 服务器关闭后本地系统不能启动

挂载完成后查看挂载是否成功:

[root@web1 ~]#mount

/dev/mapper/vg0-rooton / type ext4 (rw)

proc on /proctype proc (rw)

sysfs on /systype sysfs (rw)

devpts on/dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on/dev/shm type tmpfs (rw)

/dev/sda1 on/boot type ext4 (rw)

/dev/mapper/vg0-usron /usr type ext4 (rw)

/dev/mapper/vg0-varon /var type ext4 (rw)

none on/proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on/var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

172.16.31.32:/web/blog on/web/blog type nfs (rw,vers=4,addr=172.16.31.32,clientaddr=172.16.31.30)

 

 

七.      安装 wordpress 博客系统

1. 配置 web 服务器的虚拟主机支持:

开启 FastCGI 模块和 PHP 支持及开启虚拟主机。

#vim /etc/httpd24/httpd.conf

LoadModuleproxy_module modules/mod_proxy.so

LoadModuleproxy_fcgi_modulemodules/mod_proxy_fcgi.so

<IfModuledir_module>

    DirectoryIndex index.php index.html

</IfModule>

AddTypeapplication/x-compress .Z

AddType application/x-gzip.gz .tgz

AddTypeapplication/x-httpd-php .php

AddTypeapplication/x-httpd-php-source .phps

Include/etc/httpd24/extra/httpd-vhosts.conf

配置虚拟主机配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#vim/etc/httpd24/extra/httpd-vhosts.conf
<VirtualHost 172.16.31.30:80>
DocumentRoot"/web/blog"
ServerName www.stu31.com
ProxyRequests Off
ProxyPassMatch^/(.*\.php)$ fcgi://172.16.31.32:9000/www/blog/$1
ErrorLog"/web/blog/logs/error_log"
CustomLog"/web/blog/logs/access_log" common
<Directory"/web/blog/logs">
    Options none
    AllowOverride none
    Require all granted
</Directory>
</VirtualHost>

注意:

A. 需要在 nfs 共享文件目录中创建日志文件目录logs

#mkdir/web/blog/logs/

B.web服务器的静态资源请求是到 nfs 共享文件目录 /web/blog 中返回结果,而涉及到动态资源的请求是反向代理到 php 服务器上的网站目录 /www/blog 中执行后返回结果。

C. 前端 2web服务器都需要配置好虚拟主机。

 

2. 在 NFS 共享服务器上安装 wordpress 博客系统

php 服务器上创建动态资源存放目录:

#mkdir  /www/blog

解压 wordpress 博客程序:

# unzip wordpress-3.2.1-zh_CN.zip

移动程序到 NFS 文件共享目录:

# mv wordpress/* /web/blog/

 

3. 配置 wordpress 博客系统与数据库结合

创建 wordpress 的配置文件:

1
2
#cd /web/blog
# cp wp-config-sample.php wp-config.php

写入数据库名称,用户名,密码及数据库服务器 IP 地址:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#vim wp-config.php
// **MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/**WordPress 数据库的名称 */
define('DB_NAME','wpdb');
  
/** MySQL 数据库用户名 */
define('DB_USER','wpadmin');
  
/** MySQL 数据库密码 */
define('DB_PASSWORD','Oracle');
  
/** MySQL 主机 */
define('DB_HOST','172.16.31.33');
  
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET','utf8');
  
/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

 

切换到数据库服务器,在数据库添加库,授权,添加授权密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@mysqlmysql]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.0.10-MariaDB-log MariaDB Server
  
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
  
Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.
  
MariaDB [(none)]> create schema wpdb;
Query OK, 1 row affected (0.04 sec)
  
MariaDB [(none)]> grant all on wpdb.* to 'wpadmin'@'172.16.%.%'identified by 'oracle';
Query OK, 0 rows affected (0.05 sec)
  
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
  
MariaDB [(none)]> \q
Bye

 

4. 重新启动 httpd 服务

1
2
3
# servicehttpd24 restart 
Stoppinghttpd:                                           [OK]
Startinghttpd:                                           [OK]

 

八.      实现测试

我们通过浏览器访问博客网站,我这里是一个在虚拟机上访问,一个在实体机上访问:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

上图的访问是在 web1 完成的

下图的访问是在 web2 完成的

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

结果非常完美哦!o(∩_∩)o

需求分析:

1. 前端需支持更大的访问量,单台 Web 服务器已无法满足需求了,则需扩容 Web 服务器;

2. 虽然动态内容可交由后端的 PHP 服务器执行,但静态页面还需要 Web 服务器自己解析,那是否意味着多台 Web 服务器都需要在各自的系统中都存有一份静态页面数据呢?

其实这样也不是不可以,毕竟文件本地访问,速度还是有优势的,但这却涉及到多台 Web 服务器间内容的一致性问题,这种问题也不可避免;

那么如果能将静态页面集中存放,所有 Web 服务器都来集中地取文件,对于文件的一致性就有了保障,这个集中地就叫做“文件共享服务器”;

文件共享有多种方式,FTP,NFS,Samba 等,而其中 NFS 作为网络文件系统,允许一个系统通过网络共享目录和文件,通过使用 NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件,这种近似访问本地文件系统的架构貌似很符合我们的需求,我们现在就来实现这个需求!

需求实现:

1.web1 充当 http 服务器和 DNS 解析服务器,客户端到 web1 和 web2 的请求,如果是静态资源请求通过 php 主机的 NFS 服务挂载的存储返回结果

2.web1 和 web2 对于客户端动态资源请求都反向代理到后端 php 服务器进行执行后返回结果

3.web1 和 web2 实现 DNS 轮询,客户端访问博客网站是负载均衡的。

4. 建立 wordpress 博客

5. 数据库存储 wordpress 博客的各种数据

实验架构:

 LAMP+NFS 实现多个 Web 服务器静态资源统一存储

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Windows 7 下硬盘安装 Ubuntu 14.10 图文教程 http://www.linuxidc.com/Linux/2014-10/108430.htm

U 盘安装 Ubuntu 14.10 http://www.linuxidc.com/Linux/2014-10/108402.htm

Ubuntu 14.10 正式发布下载 http://www.linuxidc.com/Linux/2014-10/108363.htm

Ubuntu 14.04 LTS 如何升级到 Ubuntu 14.10  http://www.linuxidc.com/Linux/2014-10/108381.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

部署实现

一.DNS服务器在 web1 上的实现

开发环境配置

1
# yum –y groupinstall Development Tools

配置 DNS 服务器:

安装 DNS 服务器软件bind

1
#yum –y install bind

配置 DNS 主配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# vim /etc/named.conf
//
//named.conf
//
//Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// serveras a caching only nameserver (as a localhost DNS resolver only).
//
// See/usr/share/doc/bind*/sample/ for example named configuration files.
//
  
options {
//      listen-on port 53 {127.0.0.1;};
//      listen-on-v6 port 53 {::1;};
        directory       "/var/named";
        dump-file      "/var/named/data/cache_dump.db";
        statistics-file"/var/named/data/named_stats.txt";
        memstatistics-file"/var/named/data/named_mem_stats.txt";
//      allow-query     {localhost;};
        recursion yes;
  
//      dnssec-enable yes;
//      dnssec-validation yes;
//      dnssec-lookaside auto;
  
        /* Path to ISC DLV key */
        /*bindkeys-file"/etc/named.iscdlv.key";
  
        managed-keys-directory"/var/named/dynamic";
        */
};
  
logging {
        channel default_debug {
                file"data/named.run";
                severity dynamic;
        };
};
  
zone"." IN {
        type hint;
        file "named.ca";
};
  
include"/etc/named.rfc1912.zones";
include "/etc/named.root.key";

 

配置主区域文件:只是在文件尾部添加正向区域

1
2
3
4
5
# vim /etc/named.rfc1912.zones
zone"stu31.com" IN {
        type master;
        file "stu31.com.zone";
};

 

配置正向区域解析库文件:

这里让客户端查询 http 服务器时能轮换查询到两台 web 服务器。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# vim/var/named/stu31.com.zone
$TTL 600
$ORIGINstu31.com.
@       IN     SOA     ns.stu31.com.   root.stu31.com. (
                        2014122301
                        1H
                        3M
                        5D
                        6H )
@       IN     NS      ns
        IN     MX  5   mail
ns      IN     A       172.16.31.30
www     IN     A       172.16.31.30
www     IN     A       172.16.31.31
mail    IN      A      172.16.31.30

 配置文件语法检查:

1
2
3
#named-checkzone  stu31.com /var/named/stu31.com.zone 
zonestu31.com/IN: loaded serial 2014122301
OK

 

启动 DNS 服务:

1
2
3
# servicenamed start
Generating/etc/rndc.key:                                 [OK]
Starting named:                                            [OK]

 

测试全部区域解析:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# dig -taxfr stu31.com @172.16.31.30
  
;<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> -taxfr stu31.com @172.16.31.30
;; globaloptions: +cmd
stu31.com.              600     IN     SOA     ns.stu31.com. root.stu31.com.2014122301 3600 180 432000 21600
stu31.com.              600     IN     NS      ns.stu31.com.
stu31.com.              600     IN     MX      5 mail.stu31.com.
mail.stu31.com.         600    IN      A       172.16.31.30
ns.stu31.com.           600    IN      A       172.16.31.30
www.stu31.com.          600     IN     A       172.16.31.30
www.stu31.com.          600     IN     A       172.16.31.31
stu31.com.              600     IN     SOA     ns.stu31.com.root.stu31.com. 2014122301 3600 180 432000 21600
;; Querytime: 1 msec
;;SERVER: 172.16.31.30#53(172.16.31.30)
;; WHEN:Wed Dec 24 02:44:40 2014
;; XFR size: 8 records (messages 1, bytes 210)

DNS服务器安装完毕!这里是最简单的正向区域的实现,果有不清楚的话,我前面的博文有详细介绍。

 

二.      apache服务器在 web1web2上的实现

httpd的安装同时在 web1web2上安装:

DNS 服务器地址指向172.16.31.30

开发环境配置:

1
2
# yum –y groupinstall Development Tools
# yum install -ypcre-devel openssl-devel

 

编译安装apr

1
2
3
4
# tar xf apr-1.5.0.tar.bz2
# cd apr-1.5.0
# ./configure--prefix=/usr/local/apr
# make && make install

 

编译安装apr-util

1
2
3
4
# tar xf apr-util-1.5.3.tar.bz2
# cd apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util--with-apr=/usr/local/apr
# make && make install

 

编译安装httpd-2.4.10

1
2
3
4
# tar xf httpd-2.4.10.tar.bz2
# cd httpd-2.4.10
# ./configure --prefix=/usr/local/apache  --sysconfdir=/etc/httpd24 --enable-so--enable-ssl --enabletc/httpd24 --enable-so --enable-ssl --enable-rewrite--with-z --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-modules=most--enable-mpms-shared=all --with-mpm=event
#make && make install

Apache服务脚本创建:

复制一个系统上原有的 httpd 的脚本更改如下:

#cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

加入系统服务:

1
2
#chkconfig –add httpd24
#chkconfig  httpd24 on

 

启动 httpd 服务:

1
2
3
# servicehttpd24 restart
Stoppinghttpd:                                           [OK]
Startinghttpd:                                           [OK]

 

 

    Web服务器基础部分搭建完成,只需要后续虚拟主机配置与 PHP 结合。

 

三.      MariaDB数据库服务器安装

MariaDB服务器的 DNS 指向172.16.31.30

开发环境配置:

1
2
# yum groupinstall Development Tools
# yum -y install pcre-devel openssl-devel

XFS文件系统支持:

1
# yum install xfsprogs

服务器数据库数据文件存储考虑到安全性,我将创建一个 LVM 进行数据库数据文件的存储,并采用新型文件系统 XFS 来提高数据库服务器的性能。

格式化磁盘:

1
2
#  echo -n -e"n\np\n3\n\n+10G\nt\n3\n8e\n\w\n" |fdisk /dev/sda
# partx -a /dev/sda

创建LVM

1
2
3
# pvcreate/dev/sda3
# vgcreate myvg/dev/sda3
# lvcreate -L 10G -n mylv myvg

创建 xfs 文件系统:

1
2
# mkfs -t xfs /dev/myvg/mylv
# blkid /dev/myvg/mylv

自动挂载,在 /etc/fstab 文件尾部添加:

1
2
# vim /etc/fstab
UUID="ba4e1e6c-3b7f-4f66-95b1-f51f8792288d"  /mydata xfs  defaults     0  0

创建数据库管理用户:

1
# useradd -M -s /sbin/nologin -d /mydata/data -r MySQL

创建数据库数据文件存储目录:

1
# mkdir /mydata/data

并给予 mysql 用户数据库数据文件存储目录管理权限:

1
# chown -R mysql:mysql /mydata/data/

解压数据库二进制源码包:

1
2
# tar xf mariadb-10.0.10-linux-x86_64.tar.gz -C /usr/local/
# cd /usr/local/

 

创建软链接:

1
2
# ln -s mariadb-10.0.10-linux-x86_64/  mysql
# cd mysql/

 

初始化安装MariaDB

1
# scripts/mysql_install_db --user=mysql--datadir=/mydata/data

mariadb配置文件创建及更改,有模版

安装系统的时候,/etc/路径下有一个 my.cnf 的,这里换个路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# mkdir /etc/mysql
# cp support-files/my-huge.cnf /etc/mysql/my.cnf
# vim /etc/mysql/my.cnf
[mysqld]
datadir = /mydata/data
port            = 3306
socket          =/tmp/mysql.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
innodb_file_per_table = on
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

mariadb服务脚本创建

1
2
3
4
5
6
7
8
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld start
Starting MySQL.                                           [OK]
# ls /mydata/data/
aria_log.00000001 ib_logfile0        mysql             mysql.stu31.com.pid
aria_log_control  ib_logfile1       mysql-bin.000001 performance_schema

mysqld服务的一些设置

设置环境变量:

1
2
# vim /etc/profile.d/mysqld.sh
export PATH=/usr/local/mysql/bin:$PATH

加载环境变量:

1
# source /etc/profile.d/mysqld.sh

 

输出 mysql 的头文件至系统头文件路径/usr/include

1
# ln -sv /usr/local/mysql/include /usr/include/mysql

 

输出 mysql 的库文件给系统库查找路径,系统重新加载:

1
2
# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
# ldconfig

测试客户端启动:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.10-MariaDB-log MariaDB Server
  
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
  
Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.
  
MariaDB [(none)]> select version();
+---------------------+
| version()           |
+---------------------+
| 10.0.10-MariaDB-log |
+---------------------+
1 row in set (0.00 sec)
  
MariaDB [(none)]> \q
Bye

给数据库设置一个密码。

 
1
2
3
# mysqladmin -u root password
New password:
Confirm new password:

MariaDB安装完毕,只是基本的数据库环境,后面还需要数据库与博客网站结合 

更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-12/110943p2.htm

. 我们在此基础上安装 Drupal 网站

实现创建 drupal 网站:

DNS服务器需要添加域名解析:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@web1 ~]# vim/var/named/stu31.com.zone
$TTL 600
$ORIGIN stu31.com.
@      IN      SOA     ns.stu31.com.   root.stu31.com. (
                        2014122302
                        1H
                        3M
                        5D
                        6H )
@      IN      NS      ns
       IN      MX  5  mail
ns     IN      A       172.16.31.30
www    IN      A       172.16.31.30
www    IN      A       172.16.31.31
web    IN      A       172.16.31.30
web    IN      A       172.16.31.31
mail   IN      A       172.16.31.30

 

重启 named 服务:

1
2
3
[root@web1 ~]# service named restart
Stopping named:                                            [OK]
Starting named:                                           [OK]

 

测试解析:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@web2 ~]# dig -t A web.stu31.com@172.16.31.30
  
; <<>> DiG9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> -t A web.stu31.com@172.16.31.30
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY,status: NOERROR, id: 60232
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2,AUTHORITY: 1, ADDITIONAL: 1
  
;; QUESTION SECTION:
;web.stu31.com.                 IN      A
  
;; ANSWER SECTION:
web.stu31.com.          600     IN     A       172.16.31.30
web.stu31.com.          600     IN     A       172.16.31.31
  
;; AUTHORITY SECTION:
stu31.com.              600     IN     NS      ns.stu31.com.
  
;; ADDITIONAL SECTION:
ns.stu31.com.           600     IN     A       172.16.31.30
  
;; Query time: 4 msec
;; SERVER: 172.16.31.30#53(172.16.31.30)
;; WHEN: Wed Dec 24 08:16:36 2014
;; MSG SIZE rcvd: 96

 

 

php 服务器上创建 NFS 文件目录共享,以存放 drupal 网站的静态资源:

1
2
3
4
5
6
7
[root@php ~]# mkdir /web/drupal
[root@php ~]# showmount -e 172.16.31.32
Export list for 172.16.31.32:
/web/blog 172.16.31.31,172.16.31.30
[root@php ~]# vim /etc/exports
/web/blog 172.16.31.30(rw,async,no_root_squash)172.16.31.31(rw,async,no_root_squash)
/web/drupal 172.16.31.30(rw,async,no_root_squash) 172.16.31.31(rw,async,no_root_squash)

 

重启 NFS 共享文件系统:

1
2
3
4
5
6
7
8
9
10
11
[root@php drupal]# service nfs restart
Shutting down NFS daemon:                                  [OK]
Shutting down NFS mountd:                                  [OK]
Shutting down NFS quotas:                                  [OK]
Shutting down NFS services:                                [OK]
Shutting down RPC idmapd:                                  [OK]
Starting NFS services:                                     [OK]
Starting NFS quotas:                                       [OK]
Starting NFS mountd:                                       [OK]
Starting NFS daemon:                                       [OK]
Starting RPC idmapd:                                       [OK]

 

NFS 共享服务器端查看共享的文件目录:

1
2
3
4
[root@php drupal]# showmount -e172.16.31.32
Export list for 172.16.31.32:
/web/drupal 172.16.31.31,172.16.31.30
/web/blog  172.16.31.31,172.16.31.30

 

准备好 drupal 程序包:包含中文语言包

1
2
3
[root@php ~]# ll
-rw-r--r-- 1 root root  3229858 Dec 22 08:21drupal-7.34.tar.gz
-rw-r--r-- 1 root root   582727 Dec 21 21:48drupal-7.34.zh-hans.po

 

解压程序包:

1
2
3
4
5
[root@php ~]# tar xf drupal-7.34.tar.gz
[root@php ~]# mv drupal-7.34/* /web/drupal/
[root@php ~]# cd /web/drupal/
[root@php drupal]# cp sites/default/default.settings.phpsites/default/settings.php
[root@php drupal]# chmod a+w sites/default/

 

将中文语言包放置到指定目录:

1
[root@php drupal]# cp/root/drupal-7.34.zh-hans.po profiles/standard/translations/

 

创建 drupal 动态资源存放目录,并且将 drupal 网站目录复制一份到动态资源存放目录:

1
2
[root@php drupal]# mkdir /www/drupal
[root@php drupal]# cp -a * /www/drupal/

 

下面配置 NFS 客户端,将 NFS 服务器共享的 drupal 网站目录映射到 web 服务器:

 

切换到 web 服务器:

 

我们需要创建网站目录:

[root@web1 ~]# mkdir /web/drupal

 

实现自动挂载:

[root@web1 ~]# vim /etc/fstab

172.16.31.32:/web/drupal  /web/drupal          nfs    defaults,_netdev 0 0

[root@web1 ~]# mount -a

[root@web1 ~]# mount

/dev/mapper/vg0-root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts(rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/sda1 on /boot type ext4 (rw)

/dev/mapper/vg0-usr on /usr type ext4 (rw)

/dev/mapper/vg0-var on /var type ext4 (rw)

none on /proc/sys/fs/binfmt_misc typebinfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs typerpc_pipefs (rw)

172.16.31.32:/web/blog on /web/blog typenfs (rw,vers=4,addr=172.16.31.32,clientaddr=172.16.31.30)

172.16.31.32:/web/drupal on /web/drupaltype nfs (rw,vers=4,addr=172.16.31.32,clientaddr=172.16.31.30)

 

web2服务器做同样的操作即可。

[root@web2 ~]# ls /web/drupal/

authorize.php  index.php          INSTALL.txt      profiles    themes

CHANGELOG.txt  INSTALL.MySQL.txt  LICENSE.txt      README.txt  update.php

COPYRIGHT.txt  INSTALL.pgsql.txt  MAINTAINERS.txt  robots.txt UPGRADE.txt

cron.php      install.php        misc            scripts    web.config

includes      INSTALL.sqlite.txt  modules          sites      xmlrpc.php

PHP服务器上 NFS 共享文件内的网站的内容就挂载到本地了!!!

 

 

web1服务器的虚拟主机配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@web1 ~]# vim/etc/httpd24/extra/httpd-vhosts.conf
<VirtualHost 172.16.31.30:80>
   DocumentRoot "/web/drupal"
   ServerName web.stu31.com
   ProxyRequests Off
   ProxyPassMatch ^/(.*\.php)$ fcgi://172.16.31.32:9000/www/drupal/$1
   ErrorLog "/web/drupal/logs/drupal-error_log"
   CustomLog "/web/drupal/logs/drupal-access_log" common
   <Directory "/web/drupal">
       Options none
       AllowOverride none
       Require all granted
   </Directory>
</VirtualHost>

 

测试配置文件语法:

1
2
3
4
[root@web1 ~]# httpd -t
(2)No such file or directory: AH02291:Cannot access directory '/web/drupal/logs/' for error log of vhost defined at/etc/httpd24/extra/httpd-vhosts.conf:38
(2)No such file or directory: AH02291:Cannot access directory '/web/blog/logs/' for error log of vhost defined at/etc/httpd24/extra/httpd-vhosts.conf:24
AH00014: Configuration check failed

提示的错误是日志文件目录未创建!创建日志目录:

1
2
3
[root@web1 ~]# mkdir /web/drupal/logs
[root@web1 ~]# httpd -t             
Syntax OK

 

web2的虚拟主机配置:注意只需要改变一下虚拟主机的地址即可了!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@web2 ~]# mkdir /web/drupal
<VirtualHost 172.16.31.31:80>
   DocumentRoot "/web/drupal"
   ServerName web.stu31.com
   ProxyRequests Off
   ProxyPassMatch ^/(.*\.php)$ fcgi://172.16.31.32:9000/www/drupal/$1
   ErrorLog "/web/drupal/logs/drupal-error_log"
   CustomLog "/web/drupal/logs/drupal-access_log" common
   <Directory "/web/drupal">
       Options none
       AllowOverride none
       Require all granted
   </Directory>
</VirtualHost>

 

虚拟主机配置完成!

 

切换到数据库服务器为 drupal 网站创建数据库及数据库管理用户及密码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[root@mysql ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 10.0.10-MariaDB-log MariaDBServer
  
Copyright (c) 2000, 2014, Oracle, SkySQL Aband others.
  
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
  
MariaDB [(none)]> create databasedrupal;
Query OK, 1 row affected (0.00 sec)
  
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| drupal             |
| information_schema |
| mysql              |
| performance_schema |
| test               |
| wpdb               |
+--------------------+
6 rows in set (0.02 sec)
  
MariaDB [(none)]> grant all on drupal.*to 'drupal'@'172.16.%.%' identified by 'oracle';
Query OK, 0 rows affected (0.03 sec)
  
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.01 sec)
  
MariaDB [(none)]> \q
Bye

 

重启 httpd 服务:

1
2
3
4
5
6
7
[root@web1 ~]# service httpd24 restart
Stopping httpd:                                           [OK]
Starting httpd:                                           [OK]
  
[root@web2 ~]# service httpd24 restart
Stopping httpd:                                           [OK]
Starting httpd:                                           [OK]

 

 

开始去客户端安装drupal

输入 web.stu31.com 访问 drupal 网站:

选择标准安装:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

选择简体中文:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

检查安装条件是否通过:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

出现不可写,需要对 sites 目录赋予写权限:

需要同时更改 NFS 共享目录和 php 服务器本地的 /www/drupal 目录:

1
2
[root@php ~]# chmod -R a+w/web/drupal/sites/
[root@php ~]# chmod -R a+w /www/drupal/sites/

 

再次刷新安装成功进入下一步:

设置数据库,填入我们在上面设置的数据库名称和用户名及密码

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

安装模块:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

设置网站:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

完成安装:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

进入网站首页:

LAMP+NFS 实现多个 Web 服务器静态资源统一存储

安装完成后将 sites/default/settings.php 的权限更改为只读权限,考虑到安全:

1
2
[root@php ~]# chmod 444/web/drupal/sites/default/settings.php
[root@php ~]# chmod 444/www/drupal/sites/default/settings.php

到这里 drupal 网站安装就完成了!!!

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计29573字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中