安装编译
CentOS673: 172.16.26.3 Apache httpd 2.4
CentOS672:172.16.26.2 PHP-FPM 5.4
CentOS675:172.16.26.5 Mariadb 5.5
A>. A:Apache,httpd
#安装编译所需的软件,库,头文件
[CentOS673:~]yum install gcc libxml2-devel pcre pcre-devel gd
#安装 apr apr-util
[CentOS673:apr-1.5.2] ./configure --prefix=/usr/local/apr
[CentOS673:apr-1.5.2] make && make install
[CentOS673:apr-util-1.5.2] ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[CentOS673:apr-1.5.2] make && make install
#安装 httpd
[CentOS673:httpd-2.4.10] ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mod-shared=most --enable-mod-so --sysconfdir=/etc/httpd --enable-mpms-shared=all --with-mpm=prefork
[CentOS673:apr-1.5.2] make && make install
#文件配置
#启动 httpd
[CentOS673:~]/usr/local/apache/bin/apachectl –k start
M>.M:mariadb
#安装所需软件
#Cmake 出错时 remove 目录下 CMakeCache.txt 后再 cmake
[CentOS675:~]yum install cmake ncurses-devel
[CentOS675:~]yum install Development\ Tools
#安装 mariadb
[CentOS675:maridb-5.5]cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/maridb
-DMYSQL_DATADIR=/data/maraidb
[CentOS675:mariadb-5.5]make
[CentOS675:mariadb-5.5]make install
#useradd groupadd
[CentOS675:~]groupadd -r -g 37 mysql; useradd -r -g mysql -u 37 mysql
[CentOS675:mariadb-5.5]cd /usr/local/mariadb
[CentOS675:mariadb]./scripts/mysql_install_db --datadir=/data/mariadb --user=mysql
[CentOS675:mariadb]cp support-files/mysql.server /etc/init.d/mysqld
#修/etc/init.d/mysqld datadir=/data/mariadb basedir=/usr/local/mariadb
[CentOS675:mariadb]cp support-files/my-large.cnf /etc/my.cnf
[CentOS675:~] chkconfig --add mysqld
[CentOS675:~] service mysqld start
P>.P:PHP-FPM
#安装编译所需的软件,库,头文件
[CentOS672:~]yum install libxml2-devel pcre pcre-devel libmcrypt-devel gd-devel libjpegdevel libpng-devel
#编译安装 php-fpm
[CentOS672:php-5.4.40] ./configure --prefix=/usr/local/php --sysconfdir=/etc
-with-config-file-path=/etc/php.ini --with-config-file-scan-dir=/etc/php.d --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-mbstring --with-mcrypt --with-mysql --with-mysqli --enable-embedded-mysqli --with-pdo-mysql --with-libxml-dir --enable-zip --enable-mysqlnd
[CentOS672:php-5.4.40]make && make install
[CentOS672:php-5.4.40] cp php.ini-production /etc/php.ini
[CentOS672:php-5.4.40]mv /etc/php-fpm.conf.default /etc/php-fpm.conf
#编译安装 xcache
[CentOS672:xcache]/usr/local/php/phpize –clean
[CentOS672:xcache]/usr/local/php/phpize
[CentOS672:xcache]./configure --enable-xcache --enable-xcache-encoder
--enable-xcache-decoder --with-php-config=/usr/local/php/bin/php-config
--enable-xcache-disassembler
[CentOS672:xcache]make && make install
[CentOS672:xcache]mkdir /etc/php.d;cp xcache.ini /etc/php.d/
#文件配置
#启动 php-fpm
[CentOS672]/usr/local/php/sbin/php-fpm
压力测试:
ab -c $i -n $j $1 |sed -r -e ‘/^$/d‘ -e ‘/^[[:space:]]/d‘ |tail -n +5|head -16|tr -s " "|gawk -F: ‘{ printf("%s\t",$2)}END{print}‘
gawk -F "\t" ‘{for(i=1;i<NF;i++){split($i,a," "); b[i]=a[1]} for (j in b){printf("%s ",b[j])} printf("\n")}‘
和之前测试结果对比:
1. Time Per Request VS
2. Failed Request Percent VS
Time Pre Request:
RPM Allinone<RPM Separate<Source
Failed Request Percent:
RPM Allinone<RPM Separate<Source
结论(以上数据来源于单机 VMware VM 实验结果):
1.单机上,RPM 安装在一起效果更好
2.编译安装的 Failed Request Percent 跳动较大,也许 RMP 参数设置较优
3. RPM Allinone<RPM Separate 可能与网络环境相关,不具备参考性