就業(yè)班(全程班)第十四周作業(yè)
1隐岛、簡述CGI與FASTCGI區(qū)別
現(xiàn)在的CGI基本沒人使用螺垢,不安全以及性能極其低下牵舱,越來越多的使用web內(nèi)置擴(kuò)展串绩、fastCGI。例如微軟iis的ISAPI仆葡,apache的php模塊赏参,nginx的php-cgi志笼。CGI、內(nèi)置模塊把篓、fastcgi這三種性能最好的要屬于fast_cgi速度最快纫溃,但是需要額外的進(jìn)程。解析來看看CGI和FASTCGI有什么不同.
CGI方式介紹:
cgi在2000年或更早的時候用得比較多韧掩,以前web服務(wù)器一般只處理靜態(tài)的請求紊浩,如果碰到一個動態(tài)請求怎么辦呢?web服務(wù)器會根據(jù)這次請求的內(nèi)容疗锐,然后會fork一個新進(jìn)程來運(yùn)行外部程序坊谁, 這個進(jìn)程會把處理完的數(shù)據(jù)返回給web服務(wù)器,最后web服務(wù)器把內(nèi)容發(fā)送給用戶滑臊,剛才fork的進(jìn)程也隨之退出口芍。 如果下次用戶還請求改動態(tài)腳本,那么web服務(wù)器又再次fork一個新進(jìn)程雇卷,周而復(fù)始的進(jìn)行鬓椭。這在處理高并發(fā)訪問時幾乎是不可用的。另外傳統(tǒng)的CGI接口方式安全性也很差关划,現(xiàn)在已經(jīng)很少使用了小染。
web內(nèi)置模塊介紹:
后來出現(xiàn)了一種更高級的方式是, web服務(wù)器可以內(nèi)置perl解釋器或php解釋器贮折。 也就是說這些解釋器做成模塊的方式裤翩,web服務(wù)器會在啟動的時候就啟動這些解釋器。 當(dāng)有新的動態(tài)請求進(jìn)來時调榄,web服務(wù)器就是自己解析這些perl或php腳本踊赠,省得重新fork一個進(jìn)程,效率提高了振峻。
fastcgi方式介紹:
fastcgi的方式是臼疫,web服務(wù)器收到一個請求時择份,他不會重新fork一個進(jìn)程(因為這個進(jìn)程在web服務(wù)器啟動時就開啟了扣孟,而且不會退出),web服務(wù)器直接把內(nèi)容傳遞給這個進(jìn)程(進(jìn)程間通信荣赶,但fastcgi使用了別的方式凤价,tcp方式通信),這個進(jìn)程收到請求后進(jìn)行處理拔创,把結(jié)果返回給web服務(wù)器利诺,最后自己接著等待下一個請求的到來,而不是退出.
fastcgi跟cgi的區(qū)別表格:
舉個例子: 服務(wù)端現(xiàn)在有個10萬個字單詞剩燥, 客戶每次會發(fā)來一個字符串慢逾,問以這個字符串為前綴的單詞有多少個立倍。
那么可以寫一個程序,這個程序會建一棵trie樹侣滩,然后每次用戶請求過來時可以直接到這個trie去查找口注。
但是如果以cgi的方式的話,這次請求結(jié)束后這課trie也就沒了君珠,等下次再啟動該進(jìn)程時寝志,又要新建一棵trie樹,這樣的效率就太低下了策添。
而用fastcgi的方式的話材部,這課trie樹在進(jìn)程啟動時建立,以后就可以直接在trie樹上查詢指定的前綴了唯竹。
2乐导、 編譯安裝基于fastcgi模式的多虛擬主機(jī)的wordpress和discuz的LAMP架構(gòu)
準(zhǔn)備環(huán)境:
準(zhǔn)備軟件版本:
主機(jī)名修改用以區(qū)分
數(shù)據(jù)庫服務(wù)器:
實(shí)現(xiàn)數(shù)據(jù)庫二進(jìn)制安裝(并加上LAMP需要的配置)
websrv服務(wù)器端:
編譯安裝httpd
編譯安裝fastcgi 方式的 php7.3
部署wordpress和discuz
測試性能
準(zhǔn)備環(huán)境:
兩臺主機(jī):
? ? 一臺主機(jī):httpd+php(fastcgi模式)
? ? 一臺主機(jī):mariadb 服務(wù)器
準(zhǔn)備軟件版本:
mariadb-10.2.27-linux-x86_64.tar.gz 通用二進(jìn)制格式
apr-1.7.0.tar.bz2
apr-util-1.6.1.tar.bz2
httpd-2.4.41.tar.gz
php-7.4.0.tar.xz
wordpress-5.9.3-zh_CN.tar.tar.gz
Discuz_X3.4_SC_UTF8_20220131.zip
主機(jī)名修改用以區(qū)分
# 作為httpd和php服務(wù)器使用
[root@centos7 ~]$hostname websrv
[root@centos7 ~]$exit
[root@websrv ~]$
# 作為數(shù)據(jù)庫使用
[root@centos7 ~]$hostname mysql
[root@centos7 ~]$exit
[root@mysql ~]$
數(shù)據(jù)庫服務(wù)器
實(shí)現(xiàn)數(shù)據(jù)庫二進(jìn)制安裝(并加上LAMP需要的配置)
準(zhǔn)備好二進(jìn)制mariadb安裝包
1.準(zhǔn)備好二進(jìn)制mariadb安裝包
[root@centos7 data]$ll
total 449668
-rw-r--r-- 1 root root 460459738 Sep 12 09:08 mariadb-10.2.27-linux-x86_64.tar.gz
2.解壓安裝包
[root@centos7 data]$tar xvf mariadb-10.2.27-linux-x86_64.tar.gz
[root@centos7 data]$ll
total 449668
drwxrwxr-x 12 yang yang? ? ? 282 Sep 10 02:02 mariadb-10.2.27-linux-x86_64
-rw-r--r--? 1 root root 460459738 Sep 12 09:08 mariadb-10.2.27-linux-x86_64.tar.gz
3.把解壓后的數(shù)據(jù)庫目錄移動到usr/local下統(tǒng)一管理
[root@centos7 data]$mv mariadb-10.2.27-linux-x86_64 /usr/local/ # 移動
[root@centos7 local]$ln -s /usr/local/mariadb-10.2.27-linux-x86_64/ /usr/local/mysql? # 創(chuàng)建軟連接
[root@centos7 local]$ll /usr/local/mysql
lrwxrwxrwx 1 root root 40 Dec 15 14:44 /usr/local/mysql -> /usr/local/mariadb-10.2.27-linux-x86_64/
4.創(chuàng)建服務(wù)用戶,并修改mysql目錄下的權(quán)限浸颓。
[root@centos7 data]$useradd -s /sbin/nologin -d /data/mysql -r -u 306 mysql # 創(chuàng)建服務(wù)用戶
[root@centos7 local]$chown -R root.root mysql/*? # 修改為root
[root@centos7 local]$ll mysql/
total 176
drwxrwxr-x? 2 root root? 4096 Aug 14 02:55 bin
-rw-r--r--? 1 root root 17987 Sep? 8 21:25 COPYING
-rw-r--r--? 1 root root? 2354 Sep? 8 21:25 CREDITS
drwxrwxr-x? 3 root root? ? 18 Sep 10 02:02 data
-rw-r--r--? 1 root root? 8245 Sep? 8 21:25 EXCEPTIONS-CLIENT
drwxrwxr-x? 3 root root? ? 19 Sep 10 02:02 include
-rw-r--r--? 1 root root? 8694 Sep? 8 21:25 INSTALL-BINARY
drwxrwxr-x? 5 root root? 335 Aug 14 02:55 lib
drwxrwxr-x? 4 root root? ? 30 Sep 10 02:02 man
drwxrwxr-x 11 root root? 4096 Sep 10 02:02 mysql-test
-rw-r--r--? 1 root root? 2843 Sep? 8 21:25 README.md
-rw-r--r--? 1 root root 19477 Sep? 8 21:25 README-wsrep
drwxrwxr-x? 2 root root? ? 30 Sep 10 02:02 scripts
drwxrwxr-x 32 root root? 4096 Sep 10 02:02 share
drwxrwxr-x? 4 root root? 4096 Sep 10 02:02 sql-bench
drwxrwxr-x? 3 root root? 275 Sep 10 02:02 support-files
-rw-r--r--? 1 root root 86263 Sep? 8 21:25 THIRDPARTY
5.創(chuàng)建數(shù)據(jù)庫
[root@centos7 mysql]$/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysql --user=mysql
Installing MariaDB/MySQL system tables in '/data/mysql' ...
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
# 創(chuàng)建數(shù)據(jù)庫時缺少包(libaio)
[root@centos7 mysql]$yum install libaio -y? # 下載依賴包
[root@centos7 mysql]$/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysql --user=mysql? # 創(chuàng)建數(shù)據(jù)庫(/data下沒有這個目錄會自動創(chuàng)建)
[root@centos7 mysql]$ll /data/
total 449668
-rw-r--r-- 1 root? root 460459738 Sep 12 09:08 mariadb-10.2.27-linux-x86_64.tar.gz
drwx------ 5 mysql root? ? ? 181 Dec 15 14:55 mysql? ? ? # 數(shù)據(jù)庫創(chuàng)建成功
[root@centos7 mysql]$ll /data/mysql/? # 查看用戶和所屬組
total 110620
-rw-rw---- 1 mysql mysql? ? 16384 Dec 15 14:55 aria_log.00000001
-rw-rw---- 1 mysql mysql? ? ? 52 Dec 15 14:55 aria_log_control
-rw-rw---- 1 mysql mysql? ? ? 938 Dec 15 14:55 ib_buffer_pool
-rw-rw---- 1 mysql mysql 12582912 Dec 15 14:55 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Dec 15 14:55 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Dec 15 14:55 ib_logfile1
drwx------ 2 mysql mysql? ? 4096 Dec 15 14:55 mysql
drwx------ 2 mysql mysql? ? ? 20 Dec 15 14:55 performance_schema
drwx------ 2 mysql mysql? ? ? 20 Dec 15 14:55 test
6.準(zhǔn)備配置文件(指明數(shù)據(jù)庫路徑)
[root@centos7 ~]$cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf -b # 找到解壓目錄下的配置文件替換掉/etc下的配置文件并備份
cp: overwrite ‘/etc/my.cnf’? y
# 原系統(tǒng)/etc下就有一個my.cnf的配置文件但是需要改配置
[root@centos7 mysql]$vim /etc/my.cnf
[mysqld]
datadir=/data/mysql? # 加上這一行就夠了 (需要啟用二進(jìn)制日志啊之類的根據(jù)需要啟動)
如果上一步cp沒做直接用的自帶的文件兽叮,注意sock路經(jīng)。(服務(wù)可能起不來是因為啟動過一次之后系統(tǒng)建立了一個sock路徑但是用的是系統(tǒng)自帶的配置文件建立的路徑猾愿。你在拷貝配置文件過去后一定要確保沒有啟動過服務(wù)鹦聪。如果啟動過請重啟電腦或刪掉舊的配置文件建立的sock文件再啟動服務(wù))
7.?制作啟動服務(wù)(類似于centos6的啟動腳本)
[root@centos7 mysql]$cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld # 拷貝目錄下的server啟動腳本到
[root@centos7 mysql]$chkconfig --list? ? # 查看注冊了哪些服務(wù)
Note: This output shows SysV services only and does not include native
? ? ? systemd services. SysV configuration data might be overridden by native
? ? ? systemd configuration.
? ? ? If you want to list systemd services use 'systemctl list-unit-files'.
? ? ? To see services enabled on particular target use
? ? ? 'systemctl list-dependencies [target]'.
netconsole? ? 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network? ? ? ? 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@centos7 mysql]$chkconfig --add mysqld? # 添加服務(wù)
[root@centos7 mysql]$chkconfig --list? # 再次查看
Note: This output shows SysV services only and does not include native
? ? ? systemd services. SysV configuration data might be overridden by native
? ? ? systemd configuration.
? ? ? If you want to list systemd services use 'systemctl list-unit-files'.
? ? ? To see services enabled on particular target use
? ? ? 'systemctl list-dependencies [target]'.
mysqld? ? ? ? 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole? ? 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network? ? ? ? 0:off 1:off 2:on 3:on 4:on 5:on 6:off? # 添加上了
8.添加PATH變量
[root@centos7 ~]$echo "PATH=/usr/local/mysql/bin:$PATH" > /etc/profile.d/mysql.sh
[root@centos7 ~]$. /etc/profile.d/mysql.sh
9.創(chuàng)建部署軟件需要的數(shù)據(jù)庫和用戶并授權(quán)
# 創(chuàng)建數(shù)據(jù)庫
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database discuz;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database? ? ? ? ? |
+--------------------+
| discuz? ? ? ? ? ? |
| information_schema |
| mysql? ? ? ? ? ? ? |
| performance_schema |
| test? ? ? ? ? ? ? |
| wordpress? ? ? ? ? |
+--------------------+
6 rows in set (0.00 sec)
# 創(chuàng)建用戶并授權(quán)
MariaDB [(none)]> grant all on wordpress.* to wordpress@'192.168.39.%' identified by 'taotaobao';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on discuz.* to discuz@'192.168.39.%' identified by 'taotaobao';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> select user,host,password from mysql.user;? # 查看創(chuàng)建的賬戶
+-----------+--------------+-------------------------------------------+
| user? ? ? | host? ? ? ? | password? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
+-----------+--------------+-------------------------------------------+
| root? ? ? | localhost? ? |? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
| root? ? ? | centos7? ? ? |? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
| root? ? ? | 127.0.0.1? ? |? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
| root? ? ? | ::1? ? ? ? ? |? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
|? ? ? ? ? | localhost? ? |? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
|? ? ? ? ? | centos7? ? ? |? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
| wordpress | 192.168.39.% | *114893F4494D9D1D5AE2BCCACDD663C08715DA05 |
| discuz? ? | 192.168.39.% | *114893F4494D9D1D5AE2BCCACDD663C08715DA05 |
+-----------+--------------+-------------------------------------------+
8 rows in set (0.00 sec)
數(shù)據(jù)庫需要的基本配置完畢
websrv服務(wù)器端
websrv端需要的包
[root@centos7 ~]$ll
total 43984
-rw-r--r--? 1 root root? 872238 May 14? 2019 apr-1.7.0.tar.bz2
-rw-r--r--? 1 root root? 428595 May 14? 2019 apr-util-1.6.1.tar.bz2
-rw-r--r--? 1 root root 11800498 Dec 12 14:57 Discuz_X3.4_SC_UTF8_20220131.zip
-rw-r--r--? 1 root root? 9267917 Oct? 8 15:10 httpd-2.4.41.tar.gz
-rw-r--r--? 1 root root 10232208 Dec 14 08:30 php-7.4.0.tar.xz
-rw-r--r--? 1 root root 12423575 Dec 12 14:18 wordpress-5.9.3-zh_CN.targz
編譯安裝httpd
1.解壓httpd和apr包
[root@centos7 data]$ll
total 10324
-rw-r--r-- 1 root root? 872238 May 14? 2019 apr-1.7.0.tar.bz2
-rw-r--r-- 1 root root? 428595 May 14? 2019 apr-util-1.6.1.tar.bz2
-rw-r--r-- 1 root root 9267917 Oct? 8 15:10 httpd-2.4.41.tar.gz
[root@centos7 data]$tar xvf apr-1.7.0.tar.bz2? # 最小化安裝缺少包
tar (child): cannot run bzip2: No such file or directory
tar (child): trying lbzip2
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@centos7 data]$yum install bzip2 # 下載解壓需要的包
# 解壓
[root@centos7 data]$tar xvf apr-1.7.0.tar.bz2
[root@centos7 data]$tar xvf apr-util-1.6.1.tar.bz2
[root@centos7 data]$tar xvf httpd-2.4.41.tar.gz
[root@centos7 data]$ll
total 10336
drwxr-xr-x 27 1001 1001? ? 4096 Apr? 2? 2019 apr-1.7.0
-rw-r--r--? 1 root root? 872238 May 14? 2019 apr-1.7.0.tar.bz2
drwxr-xr-x 20 1001 1001? ? 4096 Oct 18? 2017 apr-util-1.6.1
-rw-r--r--? 1 root root? 428595 May 14? 2019 apr-util-1.6.1.tar.bz2
drwxr-sr-x 11 root? 40? ? 4096 Aug? 9 21:36 httpd-2.4.41
-rw-r--r--? 1 root root 9267917 Oct? 8 15:10 httpd-2.4.41.tar.gz
2.合并三個目錄一起編譯
[root@centos7 data]$mv apr-1.7.0 httpd-2.4.41/srclib/apr
[root@centos7 data]$mv apr-util-1.6.1 httpd-2.4.41/srclib/apr-util
3.下載相關(guān)依賴包
[root@centos7 data]$yum install gcc pcre-devel openssl-devel expat-devel -y
4.進(jìn)入目錄下進(jìn)行編譯安裝
[root@centos7 data]$cd httpd-2.4.41/ # 進(jìn)入目錄
[root@centos7 httpd-2.4.41]$./configure \
> --prefix=/app/httpd24 \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-included-apr \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
[root@centos7 httpd-2.4.41]$make -j 4 && make install? # 制作安裝
5.準(zhǔn)備PATH變量
[root@centos7 httpd-2.4.41]$echo 'PATH=/app/httpd24/bin:$PATH' > /etc/profile.d/lamp.sh # 添加變量
[root@centos7 httpd-2.4.41]$. /etc/profile.d/lamp.sh? # 加載變量
[root@centos7 httpd-2.4.41]$echo $PATH? # 查看變量
/app/httpd24/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
6.創(chuàng)建apache賬戶
# 工作中最好指明UID,UID要統(tǒng)一.
[root@centos7 httpd-2.4.41]$useradd -s /sbin/nologin -r -u 88 apache
7.修改httpd配置文件
[root@centos7 httpd-2.4.41]$vim /app/httpd24/conf/httpd.conf
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.?
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User apache? # 默認(rèn)為daemon監(jiān)管改為apache
Group apache? # 同上
</IfModule>
# 網(wǎng)站主頁面定義為/data/(隨自己需求)
DocumentRoot "/data/"
<Directory "/data/">
8.啟動服務(wù)
[root@centos7 httpd-2.4.41]$apachectl restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:feac:5484%eth0. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start?
[root@centos7 httpd-2.4.41]$ss -ntlup
Netid State? ? ? Recv-Q Send-Q? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Local Address:Port? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Peer Address:Port? ? ? ? ? ? ?
tcp? LISTEN? ? 0? ? ? 128? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *:22? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *:*? ? ? ? ? ? ? ? ? users:(("sshd",pid=6461,fd=3))
tcp? LISTEN? ? 0? ? ? 100? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 127.0.0.1:25? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? *:*? ? ? ? ? ? ? ? ? users:(("master",pid=6581,fd=13))
tcp? LISTEN? ? 0? ? ? 128? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :::80? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? users:(("httpd",pid=49496,fd=4),("httpd",pid=49495,fd=4),("httpd",pid=49494,fd=4),("httpd",pid=49493,fd=4),("httpd",pid=49492,fd=4),("httpd",pid=49491,fd=4))
tcp? LISTEN? ? 0? ? ? 128? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :::22? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? users:(("sshd",pid=6461,fd=4))
tcp? LISTEN? ? 0? ? ? 100? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ::1:25? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? users:(("master",pid=6581,fd=14))
9.修改ServerName配置不在提示
[root@centos7 httpd-2.4.41]$vim /app/httpd24/conf/httpd.conf
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName www.example.com:80? # 這一行取消注釋蒂秘,名字是什么都可以泽本。
[root@centos7 httpd-2.4.41]$apachectl restart? # 不在提示
[root@centos7 httpd-2.4.41]$
10.修改為event模式
[root@centos7 httpd-2.4.41]$vim /app/httpd24/conf/httpd.conf
#? 默認(rèn)centos7為prefork模式,所以需要修改
LoadModule mpm_event_module modules/mod_mpm_event.so? ? # 取消注釋啟用
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so # 加上注釋禁用
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
[root@centos7 httpd-2.4.41]$apachectl restart
11.可以根據(jù)需求調(diào)節(jié)這些配置對應(yīng)生產(chǎn)調(diào)到生產(chǎn)中最大值
[root@centos7 httpd-2.4.41]$vim /app/httpd24/conf/extra/httpd-mpm.conf
# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
#? ? ? ? ? ? ? ? ? ? ? ? before terminating
<IfModule mpm_event_module>
? ? StartServers? ? ? ? ? ? 3
? ? MinSpareThreads? ? ? ? 75
? ? MaxSpareThreads? ? ? ? 250
? ? ThreadsPerChild? ? ? ? 25
? ? MaxRequestWorkers? ? ? 400
? ? MaxConnectionsPerChild? 0
</IfModule>
現(xiàn)在httpd服務(wù)已經(jīng)可以訪問了姻僧!
編譯安裝fastcgi 方式的 php7.4
php7.3和php7.4依賴包稍有差別
#安裝相關(guān)包,依賴EPEL源
#php 7.3 相關(guān)包
yum install gcc libxml2-devel bzip2-devel libmcrypt-devel
#php 7.4 相關(guān)包
yum install gcc libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel
oniguruma-devel
1.安裝依賴包
[root@centos7 data]$yum install gcc libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel oniguruma-devel
2.解壓php編譯安裝包
[root@centos7 data]$tar xvf php-7.4.0.tar.xz
[root@centos7 data]$ll
total 20328
-rw-r--r--? 1 root root? 872238 May 14? 2019 apr-1.7.0.tar.bz2
-rw-r--r--? 1 root root? 428595 May 14? 2019 apr-util-1.6.1.tar.bz2
drwxr-sr-x 12 root? 40? ? 4096 Dec 15 16:14 httpd-2.4.41
-rw-r--r--? 1 root root? 9267917 Oct? 8 15:10 httpd-2.4.41.tar.gz
drwxrwxr-x 16 root root? ? 4096 Nov 27 04:13 php-7.4.0? ? # 解壓完的目錄
-rw-r--r--? 1 root root 10232208 Dec 14 08:30 php-7.4.0.tar.xz
3.進(jìn)入php目錄下進(jìn)行編譯
# 7.4編譯方式
[root@centos7 data]$cd php-7.4.0/
[root@centos7 data]$./configure \
--prefix=/app/php74 \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--with-zlib \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-mbstring \
--enable-xml \
--enable-sockets \
--enable-fpm \
--enable-maintainer-zts \
--disable-fileinfo
[root@centos7 data]$make -j 4 && make install
[root@centos7 php-7.4.0]$/app/php74/bin/php --version? # 查看版本號
PHP 7.4.0 (cli) (built: Dec 15 2019 17:15:08) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies? # 這行是引擎版本
# 7.3編譯方式
./configure --prefix=/app/php73 \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-mbstring \
--enable-xml \
--enable-sockets \
--enable-fpm \
--enable-maintainer-zts \
--disable-fileinfo
4.準(zhǔn)備PATH變量
# 修改之前準(zhǔn)備好的變量
[root@centos7 php-7.4.0]$vim /etc/profile.d/lamp.sh
PATH=/app/httpd24/bin:/app/php/bin/:$PATH? ?
[root@centos7 php-7.4.0]$. /etc/profile.d/lamp.sh
5.準(zhǔn)備php配置文件
[root@centos7 php-7.4.0]$cp php.ini-production /etc/php.ini
6.準(zhǔn)本fastcgi(fpm)主配置文件(改名=啟用)
[root@centos7 php-7.4.0]$cd /app/php74/etc/
[root@centos7 etc]$cp php-fpm.conf.default php-fpm.conf
[root@centos7 etc]$ll
total 16
-rw-r--r-- 1 root root 5357 Dec 15 17:28 php-fpm.conf
-rw-r--r-- 1 root root 5357 Dec 15 17:15 php-fpm.conf.default
drwxr-xr-x 2 root root? 30 Dec 15 17:15 php-fpm.d
7.子配置文件fpm改名
[root@centos7 etc]$cd php-fpm.d/
[root@centos7 php-fpm.d]$ll
total 20
-rw-r--r-- 1 root root 19602 Dec 15 17:15 www.conf.default
[root@centos7 php-fpm.d]$cp www.conf.default www.conf
8.修改fpm子配置文件
[root@centos7 php-fpm.d]$vim www.conf
# 修改為apache规丽,以apache的身份來創(chuàng)建fastcgi的進(jìn)程
user = apache
group = apache
# 開啟狀態(tài)頁
; Default Value: not set
pm.status_path = /status
# 開啟ping測試
; Default Value: not set
ping.path = /ping
9.準(zhǔn)備啟動腳本
# 查找一下啟動腳本
[root@centos7 php74]$updatedb
[root@centos7 php74]$locate php-fpm
/app/php74/etc/php-fpm.conf
/app/php74/etc/php-fpm.conf.default
/app/php74/etc/php-fpm.d
/app/php74/etc/php-fpm.d/www.conf
/app/php74/etc/php-fpm.d/www.conf.default
/app/php74/php/man/man8/php-fpm.8
/app/php74/sbin/php-fpm
/data/php-7.4.0/sapi/fpm/init.d.php-fpm
/data/php-7.4.0/sapi/fpm/init.d.php-fpm.in
/data/php-7.4.0/sapi/fpm/php-fpm
/data/php-7.4.0/sapi/fpm/php-fpm.8
/data/php-7.4.0/sapi/fpm/php-fpm.8.in
/data/php-7.4.0/sapi/fpm/php-fpm.conf
/data/php-7.4.0/sapi/fpm/php-fpm.conf.in
/data/php-7.4.0/sapi/fpm/php-fpm.service
/data/php-7.4.0/sapi/fpm/php-fpm.service.in
# 拷貝過去作為啟動文件
[root@centos7 php74]$cp /data/php-7.4.0/sapi/fpm/php-fpm.service /usr/lib/system
d/system
# 重新加載服務(wù)
[root@centos7 php74]$systemctl daemon-reload
10.修改配置httpd 支持php-fpm
# 啟用代理
#LoadModule remoteip_module modules/mod_remoteip.so
LoadModule proxy_module modules/mod_proxy.so? ? # 啟用
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so? # 啟用
# 添加index.php
<IfModule dir_module>
? ? DirectoryIndex index.php index.html
</IfModule>
# 添加這三行
AddType application/x-httpd-php .php
? ? AddType application/x-httpd-php-source .phps
? ? ProxyRequests Off
# 多虛擬主機(jī)和status啟用
<virtualhost *:80>
servername wordpress.atotaobao.org
documentroot /data/wordpress
<directory /data/wordpress>
require all granted
</directory>
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/wordpress/$1
ProxyPassMatch ^/(status|ping)$ fcgi://127.0.0.1:9000/$1
CustomLog "logs/access_wordpress_log" common
</virtualhost>
<virtualhost *:80>
servername discuz.taotaobao.org
documentroot /data/discuz
<directory /data/discuz/>
require all granted
</directory>
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/discuz/$1
CustomLog "logs/access_discuz_log" common
</virtualhost>
11.創(chuàng)建部署軟件需要的目錄并建立一個測試php文件測試使用
[root@centos7 php74]$mkdir /data/wordpress
[root@centos7 php74]$mkdir /data/discuz
[root@centos7 php74]$vim /data/discuz/test.php
<?php
phpinfo();
?>
[root@centos7 php74]$cp /data/discuz/test.php /data/wordpress/
windows更改host文件
web界面測試
12.準(zhǔn)備opcache加速
查找opcache.so模塊路徑
[root@centos7 wordpress]$locate opcache.so
/app/php74/lib/php/extensions/no-debug-zts-20190902/opcache.so? # 這個是opcache加速模塊
/data/php-7.4.0/ext/opcache/.libs/opcache.so
/data/php-7.4.0/modules/opcache.so
# 這三個文件是一樣的只是在不同目錄里作用不同
[root@centos7 wordpress]$ll /app/php74/lib/php/extensions/no-debug-zts-20190902/opcache.so
-rwxr-xr-x 1 root root 2491984 Dec 15 17:15 /app/php74/lib/php/extensions/no-debug-zts-20190902/opcache.so
[root@centos7 wordpress]$ll /data/php-7.4.0/ext/opcache/.libs/opcache.so
-rwxr-xr-x 1 root root 2491984 Dec 15 17:15 /data/php-7.4.0/ext/opcache/.libs/opcache.so
[root@centos7 wordpress]$ll /data/php-7.4.0/modules/opcache.so
-rwxr-xr-x 1 root root 2491984 Dec 15 17:15 /data/php-7.4.0/modules/opcache.so
準(zhǔn)備加速插件文件(用來加速php處理動態(tài)資源)
[root@centos7 wordpress]$mkdir /etc/php.d/
[root@centos7 wordpress]$vim /etc/php.d/opcache.ini
[opcache]
zend_extension=opcache.so
#zend_extension=/app/php74/lib/php/extensions/no-debug-zts-20190902/opcache.so
opcache.enable=1? # 1 啟用? 0 關(guān)閉
# 路徑以寫全也可以只寫模塊名都可以找到。
[root@centos7 wordpress]$systemctl restart php-fpm.service? # 重啟服務(wù)
部署wordpress和discuz
1.解壓wordpress
[root@centos7 wordpress]$rm -rf /data/wordpress/ # wordpress 不用準(zhǔn)備目錄里面的所有文件都需要
[root@centos7 data]$ll
total 32464
-rw-r--r--? 1 root root? 872238 May 14? 2019 apr-1.7.0.tar.bz2
-rw-r--r--? 1 root root? 428595 May 14? 2019 apr-util-1.6.1.tar.bz2
drwxr-xr-x? 2 root root? ? ? 22 Dec 15 18:23 discuz
drwxr-sr-x 12 root? 40? ? 4096 Dec 15 16:14 httpd-2.4.41
-rw-r--r--? 1 root root? 9267917 Oct? 8 15:10 httpd-2.4.41.tar.gz
drwxrwxr-x 19 root root? ? 4096 Dec 15 17:11 php-7.4.0
-rw-r--r--? 1 root root 10232208 Dec 14 08:30 php-7.4.0.tar.xz
-rw-r--r--? 1 root root 12423575 Dec 12 14:18 wordpress-5.9.3-zh_CN.tar.tar.gz
[root@centos7 data]$tar xvf wordpress-5.3-zh_CN.tar.gz? # 解壓
[root@centos7 data]$ll
total 32468
-rw-r--r--? 1 root root? 872238 May 14? 2019 apr-1.7.0.tar.bz2
-rw-r--r--? 1 root root? 428595 May 14? 2019 apr-util-1.6.1.tar.bz2
drwxr-xr-x? 2 root root? ? ? 22 Dec 15 18:23 discuz
drwxr-sr-x 12 root? 40? ? 4096 Dec 15 16:14 httpd-2.4.41
-rw-r--r--? 1 root root? 9267917 Oct? 8 15:10 httpd-2.4.41.tar.gz
drwxrwxr-x 19 root root? ? 4096 Dec 15 17:11 php-7.4.0
-rw-r--r--? 1 root root 10232208 Dec 14 08:30 php-7.4.0.tar.xz
drwxr-xr-x? 5 1006 1006? ? 4096 Nov 14 09:00 wordpress
-rw-r--r--? 1 root root 12423575 Dec 12 14:18 wordpress-5.9.3-zh_CN.tar.gz
2.解壓discuz
[root@centos7 data]$unzip wordpress-5.9.3-zh_CN.tar.tar.gz # 解壓沒有這個解壓軟件
-bash: unzip: command not found
[root@centos7 data]$yum install unzip? ? # 下載解壓軟件
[root@centos7 ~]$unzip Discuz_X3.4_SC_UTF8_20220131.zip -d /opt? # 指定目錄安裝因為有的東西不能放在網(wǎng)站主頁目錄下
[root@centos7 ~]$rm -f /data/discuz/test.php? # 刪除之前的測試文件
[root@centos7 ~]$mv /opt/upload/* /data/discuz/? # 把upload下的所有文件移動到discuz目錄下
3.修改權(quán)限
[root@centos7 ~]$cd /data/
[root@centos7 data]$chown -R apache.apache discuz/ wordpress
web界面測試wordpress
web界面測試discuz
測試性能
1.找一臺虛擬機(jī)當(dāng)客戶端撇贺,現(xiàn)在客戶端添加主機(jī)頭解析赌莺。
[root@centos ~]# vim /etc/hosts
127.0.0.1? localhost localhost.localdomain localhost4 localhost4.localdomain4
::1? ? ? ? localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.39.7 wordpress.taotaobao.org discuz.taotaobao.org? # 添加這一行就行了
2.使用ab命令測試
# 如果沒有這個命令下載這個包
[root@centos ~]# yum install httpd-tools
[root@centos ~]# ab -c 10 -n 100 http://wordpress.taotaobao.org/? # 測試
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 wordpress.taotaobao.org (be patient)...^[[A..done
Server Software:? ? ? ? Apache/2.4.41
Server Hostname:? ? ? ? wordpress.taotaobao.org
Server Port:? ? ? ? ? ? 80
Document Path:? ? ? ? ? /
Document Length:? ? ? ? 27338 bytes
# 第一次測試
Concurrency Level:? ? ? 10
Time taken for tests:? 1.936 seconds
Complete requests:? ? ? 100
Failed requests:? ? ? ? 0
Write errors:? ? ? ? ? 0
Total transferred:? ? ? 2759700 bytes
HTML transferred:? ? ? 2733800 bytes
Requests per second:? ? 51.66 [#/sec] (mean)? # 主要看這行多測試幾遍取平均值
Time per request:? ? ? 193.561 [ms] (mean)
Time per request:? ? ? 19.356 [ms] (mean, across all concurrent requests)
Transfer rate:? ? ? ? ? 1392.34 [Kbytes/sec] received
# 第二次測試
Concurrency Level:? ? ? 10
Time taken for tests:? 1.117 seconds
Complete requests:? ? ? 100
Failed requests:? ? ? ? 0
Write errors:? ? ? ? ? 0
Total transferred:? ? ? 2759700 bytes
HTML transferred:? ? ? 2733800 bytes
Requests per second:? ? 89.51 [#/sec] (mean)
Time per request:? ? ? 111.724 [ms] (mean)
Time per request:? ? ? 11.172 [ms] (mean, across all concurrent requests)
Transfer rate:? ? ? ? ? 2412.21 [Kbytes/sec] received
# 第三次測試
Concurrency Level:? ? ? 10
Time taken for tests:? 0.840 seconds
Complete requests:? ? ? 100
Failed requests:? ? ? ? 0
Write errors:? ? ? ? ? 0
Total transferred:? ? ? 2759700 bytes
HTML transferred:? ? ? 2733800 bytes
Requests per second:? ? 119.09 [#/sec] (mean)
Time per request:? ? ? 83.967 [ms] (mean)
Time per request:? ? ? 8.397 [ms] (mean, across all concurrent requests)
Transfer rate:? ? ? ? ? 3209.61 [Kbytes/sec] received
3.關(guān)閉opcache加速,測試松嘶。
# websrv服務(wù)端修改
[root@centos7 ~]$vim /etc/php.d/opcache.ini
opcache.enable=0? # 這一項修改為0
[root@centos7 ~]$systemctl restart php-fpm.service # 重啟服務(wù)或重新加載
# 測試第一次
Concurrency Level:? ? ? 10
Time taken for tests:? 3.421 seconds
Complete requests:? ? ? 100
Failed requests:? ? ? ? 0
Write errors:? ? ? ? ? 0
Total transferred:? ? ? 2759700 bytes
HTML transferred:? ? ? 2733800 bytes
Requests per second:? ? 29.23 [#/sec] (mean)
Time per request:? ? ? 342.077 [ms] (mean)
Time per request:? ? ? 34.208 [ms] (mean, across all concurrent requests)
Transfer rate:? ? ? ? ? 787.84 [Kbytes/sec] received
# 測試第二次
Concurrency Level:? ? ? 10
Time taken for tests:? 2.786 seconds
Complete requests:? ? ? 100
Failed requests:? ? ? ? 0
Write errors:? ? ? ? ? 0
Total transferred:? ? ? 2759700 bytes
HTML transferred:? ? ? 2733800 bytes
Requests per second:? ? 35.89 [#/sec] (mean)
Time per request:? ? ? 278.639 [ms] (mean)
Time per request:? ? ? 27.864 [ms] (mean, across all concurrent requests)
Transfer rate:? ? ? ? ? 967.21 [Kbytes/sec] received
# 測試第三次
Concurrency Level:? ? ? 10
Time taken for tests:? 2.806 seconds
Complete requests:? ? ? 100
Failed requests:? ? ? ? 0
Write errors:? ? ? ? ? 0
Total transferred:? ? ? 2759700 bytes
HTML transferred:? ? ? 2733800 bytes
Requests per second:? ? 35.64 [#/sec] (mean)
Time per request:? ? ? 280.607 [ms] (mean)
Time per request:? ? ? 28.061 [ms] (mean, across all concurrent requests)
Transfer rate:? ? ? ? ? 960.43 [Kbytes/sec] received
結(jié)論:加速與不加速性能可能相差三倍
3艘狭、通過loganalyzer展示數(shù)據(jù)庫中的日志
一、安裝mysql
# yum -y install mariadb-server
# systemctl enable --now mariadb && systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
? Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
? Active: active (running) since Sat 2021-12-25 03:56:37 EST; 2min 38s ago
? ? Docs: man:mysqld(8)
? ? ? ? ? https://mariadb.com/kb/en/library/systemd/
? Process: 31604 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCE>
? Process: 31470 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited>
? Process: 31445 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 31573 (mysqld)
? Status: "Taking your SQL requests now..."
? ? Tasks: 30 (limit: 11303)
? Memory: 87.3M
? CGroup: /system.slice/mariadb.service
? ? ? ? ? └─31573 /usr/libexec/mysqld --basedir=/usr
二翠订、安裝rsyslog
# yum -y install rsyslog-mysql
#將sql腳本復(fù)制到數(shù)據(jù)庫服務(wù)器
# scp /usr/share/doc/rsyslog/mysql-createDB.sql 10.0.0.28:/root/
三巢音、配置mysql服務(wù)器
3.1 導(dǎo)入數(shù)據(jù)庫
# mysql -uroot < mysql-createDB.sql
# mysql -e "show databases;"
+--------------------+
| Database? ? ? ? ? |
+--------------------+
| Syslog? ? ? ? ? ? |
| information_schema |
| mysql? ? ? ? ? ? ? |
| performance_schema |
+--------------------+
3.2 創(chuàng)建授權(quán)用戶
# mysql -e "create user rsyslog@'10.0.0.%' identified by '123456';"
# mysql -e "grant all on Syslog.* to 'rsyslog'@'10.0.0.%';"
# mysql -e "select user,host from mysql.user;"
+---------+--------------+
| user? ? | host? ? ? ? |
+---------+--------------+
| rsyslog | 10.0.0.%? ? |
| root? ? | 127.0.0.1? ? |
| root? ? | ::1? ? ? ? ? |
| root? ? | localhost? ? |
| root? ? | mysql-server |
+---------+--------------+
四、配置rsyslog服務(wù)器
4.1 配置日志服務(wù)器將日志發(fā)送至指定數(shù)據(jù)庫
[root@ rsyslog-server ~]#vim /etc/rsyslog.conf
####MODULES####? ? #在 MODULES 語言下面添加
module(load="ommysql")
#在RULES語句塊下面添加
#### RULES ####
#facility.priority :ommysql:DBHOST,DBNAME,DBUSER, PASSWORD
*.info :ommysql:10.0.0.28,Syslog,rsyslog,123456
[root@ rsyslog-server ~]# systemctl restart rsyslog.service
4.2 測試
#在日志服務(wù)器上生成日志
# logger "this is a test log"
#在數(shù)據(jù)庫上查詢到上面的測試日志
$> mysql -e "select count(*) from Syslog.SystemEvents;"
+----------+
| count(*) |
+----------+
|? ? 1907 |
+----------+
# 可以看到測試日記已經(jīng)存到Mysql的Syslog庫中
# mysql -e "select *? from? Syslog.SystemEvents\G" | grep -C10 "this is a test log"
? GenericFileName: NULL
? ? ? ? ? SystemID: NULL
*************************** 1904. row ***************************
? ? ? ? ? ? ? ? ID: 1904
? ? ? ? CustomerID: NULL
? ? ? ? ReceivedAt: 2021-12-25 17:25:29
DeviceReportedTime: 2021-12-25 17:25:29
? ? ? ? ? Facility: 1
? ? ? ? ? Priority: 5
? ? ? ? ? FromHost: reyslog
? ? ? ? ? Message: this is a test log
? ? ? ? NTSeverity: NULL
? ? ? ? Importance: NULL
? ? ? EventSource: NULL
? ? ? ? EventUser: NULL
? ? EventCategory: NULL
? ? ? ? ? EventID: NULL
? EventBinaryData: NULL
? ? ? MaxAvailable: NULL
? ? ? ? CurrUsage: NULL
? ? ? ? ? MinUsage: NULL
五尽超、部署配置LogAnalyzer
5.1 安裝LogAnalyzer
# wget https://download.adiscon.com/loganalyzer/loganalyzer-4.1.10.tar.gz
# tar xvf loganalyzer-4.1.10.tar.gz
# mkdir /var/www/html/log
# mv loganalyzer-4.1.10/src/* /var/www/html/log
5.2 安裝相關(guān)服務(wù)
# yum -y install httpd php-fpm php-mysqlnd php-gd
# systemctl enable --now httpd php-fpm && systemctl status httpd php-fpm
5.3 測試php
php是使用套接字和httpd通訊的官撼,并非監(jiān)聽在9000端口。
需要監(jiān)聽在端口似谁,修改配置文件/etc/php-fpm.d/www.conf傲绣,監(jiān)聽端修改為:listen = 127.0.0.1:9000
# cat > /var/www/html/info.php << EOF
<?php phpinfo() ?>
EOF
# 打開瀏覽器訪問http://10.0.0.38/info.php掠哥,沒問題繼續(xù)下一步操作
六、基于 web 頁面初始化LogAnalyzer
6.1 打開瀏覽器
訪問http://10.0.0.38/log 實(shí)現(xiàn)初始化
6.2 提示缺失配置文件
# touch /var/www/html/log/config.php
# chmod 666 /var/www/html/log/config.php
6.3 重新訪問
6.4 測試
[root@reyslog ~]# logger "this is a test log"
[root@reyslog ~]# logger "this is a newtest log