1. 程式人生 > >tomcat+memcache+nginx

tomcat+memcache+nginx

tomcat

1.安裝jdk

tar zxf jdk-7u79-linux-x64.tar.gz -C /usr/local/

cd /usr/local/

ln -s jdk1.7.0_79/ java

技術分享

vim /etc/profile

技術分享

source /etc/profile

測試

技術分享


2.安裝TOMCAT
tar zxf apache-tomcat-7.0.37.tar.gz -C /usr/local/
cd /usr/local/
ln -s apache-tomcat-7.0.37/ tomcat

cd /usr/local/tomcat/bin
./startup.sh

技術分享

測試

技術分享


3.TOMCAT+NGINX

vim /usr/local/lnmp/nginx/conf/nginx.conf

技術分享

技術分享

nginx -s reload
/etc/init.d/php-fpm start


測試

技術分享

技術分享


4. <T1> <T2> tomcat 和memcache 兩臺虛擬機做相同操作
. \ / .
. X .
. / \ .
<M1> <M2>

* yum install memcached
/etc/init.d/memcached start

技術分享

技術分享

rm -fr memcached-session-manager-tc6-1.6.3.jar

技術分享

* vim /usr/local/tomcat/conf/context.xml ##另一臺主機failoverNodes 改為n2

技術分享

* cd /usr/local/tomcat/bin/ ##重啟Tomcat
./shutdown.sh
./startup.sh


測試
tail -f logs/catalina.out


技術分享技術分享


5.Sticky
* tar -zxf nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d.tar.gz
./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_stub_status_module --add-module=/root/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d.tar.gz
833 ./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_stub_status_module --add-module=/root/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d
make
make install ##安裝nginx和sticky模塊

技術分享
* vim /opt/nginx/conf/nginx.conf

技術分享

技術分享

* ./nginx start


測試

技術分享


tomcat+memcache+nginx