2020-09-22 第十七周

1豆混、部署分離的LAMP甲馋,部署到二臺服務(wù)器上,php加載xcache模塊
兩臺主機 172.16.100.46 172.16.100.47
在172.16.100.46上安裝
apache+php

[root@localhost ~]# yum -y install php httpd php-mysql
[root@localhost wordpress]# setfacl  -Ru:apache:rwx /var/www/html/wordpress

在172.16.100.47

[root@localhost ~]# yum install mariadb-server -y
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.65-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on wpdb.* to wpuser@'172.16.100.%' identified by 'centos';
Query OK, 0 rows affected (0.00 sec)

安裝加載xcache模塊 適用于PHP5

https://github.com/lighttpd/xcache/archive/3.2.0.tar.gz 下載源碼包
yum -y install php-devel  gcc   配置編譯環(huán)境
tar xf xcache-3.2.0.tar.gz   
[root@localhost xcache-3.2.0]# phpize --clean && phpize   生成編譯腳本
[root@localhost xcache-3.2.0]# ./configure --enable-xcache
[root@localhost xcache-3.2.0]# make && make install
[root@localhost xcache-3.2.0]# cp xcache.ini /etc/php.d/
[root@localhost xcache-3.2.0]# systemctl restart httpd.service
對比:
沒加載前
[root@localhost ~]#ab -c10 -n 100 http://172.16.100.46/wordpress/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.100.46 (be patient).....done


Server Software:        Apache/2.4.6
Server Hostname:        172.16.100.46
Server Port:            80

Document Path:          /wordpress/
Document Length:        11173 bytes

Concurrency Level:      10
Time taken for tests:   14.143 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1144100 bytes
HTML transferred:       1117300 bytes
Requests per second:    7.07 [#/sec] (mean)
Time per request:       1414.339 [ms] (mean)
Time per request:       141.434 [ms] (mean, across all concurrent requests)
Transfer rate:          79.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:   631 1275 223.9   1244    1976
Waiting:      602 1167 223.8   1132    1944
Total:        631 1275 223.8   1244    1976

Percentage of the requests served within a certain time (ms)
  50%   1244
  66%   1296
  75%   1381
  80%   1414
  90%   1549
  95%   1694
  98%   1960
  99%   1976
 100%   1976 (longest request)
加載后
[root@localhost ~]#ab -c10 -n 100 http://172.16.100.46/wordpress/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.100.46 (be patient).....done


Server Software:        Apache/2.4.6
Server Hostname:        172.16.100.46
Server Port:            80

Document Path:          /wordpress/
Document Length:        11173 bytes

Concurrency Level:      10
Time taken for tests:   5.331 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1144100 bytes
HTML transferred:       1117300 bytes
Requests per second:    18.76 [#/sec] (mean)
Time per request:       533.052 [ms] (mean)
Time per request:       53.305 [ms] (mean, across all concurrent requests)
Transfer rate:          209.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       1
Processing:   206  477  90.5    487     672
Waiting:      192  415  81.8    425     588
Total:        206  477  90.4    487     672

Percentage of the requests served within a certain time (ms)
  50%    487
  66%    510
  75%    540
  80%    553
  90%    579
  95%    622
  98%    647
  99%    672
 100%    672 (longest request)

2眼耀、部署wordpress論壇蚯舱,并實現(xiàn)正常訪問登錄論壇改化。

兩臺主機 172.16.100.46 172.16.100.47
在172.16.100.46上安裝
apache+php

[root@localhost ~]# yum -y install php httpd php-mysql
wordpress下載 https://cn.wordpress.org/download/releases/
[root@localhost data]# tar xvf wordpress-5.0.3-zh_CN.tar.gz 
[root@localhost wordpress]# setfacl  -Ru:apache:rwx /var/www/html/wordpress
收回權(quán)限:
 [root@localhost wordpress]# setfacl -b /var/www/html/wordpress

在172.16.100.47

[root@localhost ~]# yum install mariadb-server -y
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.65-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on wpdb.* to wpuser@'172.16.100.%' identified by 'centos';
Query OK, 0 rows affected (0.00 sec)

測試


image.png

image.png

image.png

image.png

image.png

3、收集apache訪問日志枉昏,并實現(xiàn)圖形化展示陈肛。
3臺測試機

rsyslog服務(wù)器上安裝mysql模塊相關(guān)的程序包

[root@localhost ~]#yum install rsyslog-mysql.x86_64 -y
[root@localhost ~]# rpm -ql rsyslog-mysql
/usr/lib64/rsyslog/ommysql.so
/usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
[root@localhost ~]# scp /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql 172.16.100.47:/data

創(chuàng)建數(shù)據(jù)庫和表

[root@localhost ~]# mysql < /data/mysql-createDB.sql 
[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 68
Server version: 10.2.23-MariaDB-log MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| Syslog             |
| discuz             |
| information_schema |
| mysql              |
| performance_schema |
| test               |
| wordpress          |
+--------------------+
7 rows in set (0.00 sec)

MariaDB [(none)]> use Syslog
Database changed
MariaDB [Syslog]> show tables;
+------------------------+
| Tables_in_Syslog       |
+------------------------+
| SystemEvents           |
| SystemEventsProperties |
+------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> grant all on Syslog.* to loguser@'172.16.100.%' identified by 'centos';
Query OK, 0 rows affected (0.00 sec)

更改rsyslog.conf 配置文件

[root@localhost ~]#vim /etc/rsyslog.conf 
$ModLoad ommysql
*.info;mail.none;authpriv.none;cron.none                :ommysql:172.16.100.47,Syslog,loguser,centos
[root@localhost ~]#systemctl restart rsyslog

搭建lap

yum install httpd php php-mysql php-gd
安裝loganalyzer
[root@localhost logs]# tar xvf loganalyzer-4.1.7.tar.gz
[root@localhost loganalyzer-4.1.7]# ls
ChangeLog  contrib  COPYING  doc  INSTALL  src
[root@localhost loganalyzer-4.1.7]# mv src /var/www/html/logs
[root@localhost loganalyzer-4.1.7]# cd /var/www/html/logs
[root@localhost logs]# touch config.php
[root@localhost logs]# chmod 666 config.php
[root@localhost logs]# systemctl start httpd

視圖化如下

image.png

image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市兄裂,隨后出現(xiàn)的幾起案子句旱,更是在濱河造成了極大的恐慌,老刑警劉巖晰奖,帶你破解...
    沈念sama閱讀 222,590評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件谈撒,死亡現(xiàn)場離奇詭異,居然都是意外死亡匾南,警方通過查閱死者的電腦和手機啃匿,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,157評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來午衰,“玉大人立宜,你說我怎么就攤上這事冒萄。” “怎么了橙数?”我有些...
    開封第一講書人閱讀 169,301評論 0 362
  • 文/不壞的土叔 我叫張陵尊流,是天一觀的道長。 經(jīng)常有香客問我灯帮,道長崖技,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,078評論 1 300
  • 正文 為了忘掉前任钟哥,我火速辦了婚禮迎献,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘腻贰。我一直安慰自己吁恍,他們只是感情好,可當我...
    茶點故事閱讀 69,082評論 6 398
  • 文/花漫 我一把揭開白布播演。 她就那樣靜靜地躺著冀瓦,像睡著了一般。 火紅的嫁衣襯著肌膚如雪写烤。 梳的紋絲不亂的頭發(fā)上翼闽,一...
    開封第一講書人閱讀 52,682評論 1 312
  • 那天,我揣著相機與錄音洲炊,去河邊找鬼感局。 笑死,一個胖子當著我的面吹牛暂衡,可吹牛的內(nèi)容都是我干的询微。 我是一名探鬼主播,決...
    沈念sama閱讀 41,155評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼古徒,長吁一口氣:“原來是場噩夢啊……” “哼拓提!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起隧膘,我...
    開封第一講書人閱讀 40,098評論 0 277
  • 序言:老撾萬榮一對情侶失蹤代态,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后疹吃,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體蹦疑,經(jīng)...
    沈念sama閱讀 46,638評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,701評論 3 342
  • 正文 我和宋清朗相戀三年萨驶,在試婚紗的時候發(fā)現(xiàn)自己被綠了歉摧。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,852評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖叁温,靈堂內(nèi)的尸體忽然破棺而出再悼,到底是詐尸還是另有隱情,我是刑警寧澤膝但,帶...
    沈念sama閱讀 36,520評論 5 351
  • 正文 年R本政府宣布冲九,位于F島的核電站,受9級特大地震影響跟束,放射性物質(zhì)發(fā)生泄漏莺奸。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 42,181評論 3 335
  • 文/蒙蒙 一冀宴、第九天 我趴在偏房一處隱蔽的房頂上張望灭贷。 院中可真熱鬧,春花似錦略贮、人聲如沸甚疟。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,674評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽古拴。三九已至,卻和暖如春真友,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背紧帕。 一陣腳步聲響...
    開封第一講書人閱讀 33,788評論 1 274
  • 我被黑心中介騙來泰國打工盔然, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人是嗜。 一個月前我還...
    沈念sama閱讀 49,279評論 3 379
  • 正文 我出身青樓愈案,卻偏偏與公主長得像,于是被迫代替她去往敵國和親鹅搪。 傳聞我的和親對象是個殘疾皇子站绪,可洞房花燭夜當晚...
    茶點故事閱讀 45,851評論 2 361