手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 7部署LAMP+xcache(module模式)

[日期:2016-07-19] 来源:Linux社区  作者:maweijun [字体:大 中 小]

10、测试结果没有问题那么我们的LAMP环境部署ok可,接下来我们就在两个虚拟主机上分别部署下软件应用
首先我们部署WordPress在第一个wp.linuxidc.com虚拟主机上
 
[root@linuxidc ~]# unzip phpMyAdmin-4.0.5-all-languages.zip 
[root@linuxidc ~]# cp -r wordpress /data/www1/vhost1/
[root@linuxidc wordpress]# cp wp-config-sample.php wp-config.php 
 
[root@linuxidc wordpress]# vim wp-config.php
/** WordPress数据库的名称 */
define('DB_NAME', 'wpdb');
 
/** MySQL数据库用户名 */
define('DB_USER', 'test');
 
/** MySQL数据库密码 */
define('DB_PASSWORD', 'test');
 
/** MySQL主机 */
define('DB_HOST', '192.168.1.104');

CentOS 7部署LAMP+xcache(module模式)

11、ok接下来我们不部署phpMyadmin到pma.linuxidc.com这个虚拟主机上
 [root@linuxidc ~]# mv phpMyAdmin-4.0.5-all-languages /data/www2/vhost2/
[root@linuxidc libraries]# cd phpMyAdmin-4.0.5-all-languages/libraries/
[root@linuxidc libraries]# vim config.default.php 
$cfg['blowfish_secret'] = 'W1rBVqdwufYEiymPTfOsUQ';
$cfg['Servers'][$i]['host'] = '192.168.1.104';
$cfg['Servers'][$i]['user'] = 'test';
$cfg['Servers'][$i]['password'] = 'test';

12、接下来我们访问下看看怎么样,其实会包错缺少php-mbstring这个包,那么我们安装下就可以了
[root@linuxidc ~]# yum -y install php-mbstring 
[root@linuxidc ~]# systemctl reload httpd

13、当上这做完了后,我们可以登录到系统了,但是么有权限创建表等,所有在授权下就ok了
MariaDB [(none)]> grant all on *.* to 'test'@'192.168.%.%' identified by 'test';

CentOS 7部署LAMP+xcache(module模式)

14、现在我们LAMP平台部署软件就到此结束了,但是们网站压力测试怎么样呢??下面我们测试下看看:
Document Path:          /wordpress
Document Length:        453 bytes
 
Concurrency Level:      100
Time taken for tests:  3.756 seconds
Complete requests:      1000
Failed requests:        0
Write errors:          0
Total transferred:      679000 bytes
HTML transferred:      453000 bytes
Requests per second:    266.28 [#/sec] (mean)
Time per request:      375.551 [ms] (mean)
Time per request:      3.756 [ms] (mean, across all concurrent requests)
Transfer rate:          176.56 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median  max
Connect:        3  123 316.7    11    1151
Processing:    4  51 131.4    11    2272
Waiting:        4  45 111.4    11    2272
Total:          9  174 350.8    30    3399
 
Percentage of the requests served within a certain time (ms)
  50%    30
  66%    39
  75%    47
  80%    223
  90%  1015
  95%  1030
  98%  1223
  99%  1228
 100%  3399 (longest request)

15、我们就下来就安装下xcache来加速php,然后测试下看是否能提升访问速度呢!
[root@linuxidc ~]# yum list | grep  php-xcache 
php-xcache.x86_64                      3.1.1-1.el7                    epel   
 
[root@linuxidc ~]# yum -y install php-xcache 
 
[root@linuxidc ~]# cd  /etc/php.d/
[root@linuxidc php.d]# ls
curl.ini  fileinfo.ini  json.ini  mbstring.ini  mysqli.ini  mysql.ini  pdo.ini 
pdo_mysql.ini  pdo_sqlite.ini  phar.ini  sqlite3.ini  xcache.ini  zip.ini
###安装后生成xcache.ini文件
而且我们php测试页面中也可以看到有xcache加载
 
[root@linuxidc ~]# vim /etc/php.d/xcache.ini 
xcache.size  =              300M  ####修改下缓存的大小

16、我们现在做下测试看看情况吧:
Document Path:          /wordpress
Document Length:        453 bytes
 
Concurrency Level:      100
Time taken for tests:  2.133 seconds ##所有请求处理完成花费时间
Complete requests:      1000  ##完成请求数
Failed requests:        0  ##失败数
Write errors:          0
Total transferred:      679000 bytes
HTML transferred:      453000 bytes
Requests per second:    468.82 [#/sec] (mean) ##每秒请求数的吞吐
Time per request:      213.303 [ms] (mean) ###服务器收到请求响应页面花费时间
Time per request:      2.133 [ms] (mean, across all concurrent requests)#并发每个消耗时间
Transfer rate:          310.87 [Kbytes/sec] received ###平均每秒流量
 
Connection Times (ms)
              min  mean[+/-sd] median  max
Connect:        4  68 225.0    15    1014
Processing:    4  56  95.2    20    470
Waiting:        4  55  95.5    19    470
Total:          9  124 259.4    38    1432
 
Percentage of the requests served within a certain time (ms)
  50%    38
  66%    44
  75%    49
  80%    54
  90%    256
  95%  1015
  98%  1224
  99%  1228
 100%  1432 (longest request)

新手上路有不对的地方请多多指正,谢谢!

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-07/133337.htm

linux
相关资讯       lamp  RPM包部署LAMP 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款