nginx-tomcat-memcached架构文档说明(转)

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

st1\:*{behavior:url(#ieooui) }

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

架构文档说明

1.     nginx环境

1.1            安装

下载nginx服务包,在此我使用的是nginx1.3.13

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

st1\:*{behavior:url(#ieooui) }

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

主要配置conf目录下的配置文件和使用nginx.exe的服务。
1.2 在cmd中进入nginx.exe所在的目录,输入:start nginx.exe启动nginx服务;nginx.exe –s quit或nginx.exe –s stop 停止nginx服务;nginx.exe
–s reload刷新nginx的配置文件。

1.1           
配置

找到nginx的安装目录:ngin1.3.13/conf/conf文件

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

nginx.conf文件是nginx的核心配置文件。具体配置见下图:

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

2.    
msm环境

2.1           
安装

下载memcached服务及安装包,如图所示:

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

memcached.exe为memcached服务,也是windows服务的一部分,memcached.exe一定要下载和自己电脑的bit数一致,如:32为、64位;其它则为缓存服务器所依赖的JAR文件,其中

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

st1\:*{behavior:url(#ieooui) }

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

是Tomcat7及以上所需要的JAR,如果使用的是Tomact6的版本则下载对应的版本,如:memcached-session-maager-tc7-1.6.3.jar,其他的JAR文件在该地址中都可以对应的找到:
http://code.google.com/p/memcached-session-manager/downloads/list

将memcached.exe放到一个目录下面,如D:\msm\memcached.exe。在cmd中进入到memcached.exe的目录:memcached.exe
–d install安装memcached服务;memcached.exe
–p 11211 –d start启动memcached服务,其中11211是该服务的端口号;memcached.exe –d uninstall 卸载memcached服务。

2.2           
配置

在tomcat的lib目录中加入memcached缓存支持的JAR文件(12个jar)。
在tomcat目录下的content.xml文件,在content标签中加入:

<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n2:localhost:11211"
requestUriIgnorePattern=".*/.(png|gif|jpg|css|js)$"
sessionBackupAsync="false"
sessionBackupTimeout="100"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
copyCollectionsForSerialization="false"/>

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

memcachedNodes属性中的n2表示服务中的节点,可以自定义的,但是不同的memcached服务规定节点不能一样,否则不能实现session共享,不同的服务定义不同的节点,一个memcachedNodes也可以定义多个节点:memcachedNodes=" n2:localhost:11211 n2:192.168.21.**:11211",不同的节点直接用空格或逗号隔开即可。

修改tomcat目录下的server.xml文件,在Engine标签中添加jvmRote属性,jvm的值不能和集群中tomcat中的jvmRote值重复。

tomcat通过在不同的jmv上配置不同的jvmRoute参数,来防止集群的时候sessionid冲突:<Engine name="Catalina"
defaultHost="localhost" jvmRoute="jvm1" />。

注意:jvm值在同一个集群中不能一样,用来标识不同的tomcat服务,在msm集群中的每个tomcat必须要写。

3.    
tomcat环境

3.1每个tomcat的端口不能重复,如图:

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

下图是对tomcat中server.xml文件中的端口解释

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

3.2
实现域名访问tomcat中的项目需要把tomcat默认显示的index.jsp进行更改掉

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

打开index.jsp页面,将里面css部分、body标签部分全部删除,然后在index.jsp内部最后添加:

<script>
        Window.onload=function(){
            Window.loaction=”../dkce/app/index.jsp”;
}
</script>

800x600

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

注意:每个tomcat中的访问端口必须要在防火墙的入站规则里面进行创建,如当前的tomcat的对外端口是8080,则要在入站规则里面创建一个对外的端口。

1.     安装配置与启动项

1.1               将nginx和memcached服务进行安装,然后启动memcached服务。

1.2               配置JDK、环境变量,将项目放入tomcat中,进行配置memcached和域名访问的方式,上面已经详细介绍,启动tomcat。

1.3               配置nginx脚本(conf.xml),配置完成之后进行启动。

1.4               A.如果重启nginx服务不需要重启tomcat服务。B.如果重启tomcat服务,需要重启nginx服务(不是关机重启,是使用命令重启,2秒钟即可完成)。

1.5               如果在tomcat集群中移除其中的一台tomcat服务器,对于整个集群是不受影响的。添加一台tomcat服务器只需在nginx中注册该服务并重启nginx服务即可。在整个集群,无论nginx停止或重启、tomcat停止或重启对memcached服务不受任何影响。

时间: 2024-08-06 03:22:16

nginx-tomcat-memcached架构文档说明(转)的相关文章

keepalive+nginx集群架构文档

1.准备两台机器 A机器:192.168.232.132 B机器:192.168.232.131 A级器作为master,B机器作为backup 2.两台机器都安装:keepalived A机器 [[email protected] ~]# yum install -y keepalived B机器 [[email protected] ~]# yum install -y keepalived 3.两台机器上都安装nginx 若是A.B机器没有装nginx服务,可以直接 yum安装 因为我A机

企业网站架构之Nginx+tomcat+memcached集群

nginx+tomcat+memcached应用 系统环境:RHEL6.4  x64   iptables -F   and selinux is disabled 主机角色:node1 :192.168.0.24 :lnmp环境 tomcat memcached node2 :192.168.0.99 : tomcat memcached 软件下载:在lnmp环境上测试tomcat,使用nginx简单发布jsp jdk-6u32-linux-x64.bin apache-tomcat-7.0.

Rhel6-tomcat+nginx+memcached配置文档

理论基础: User - > web ->nginx  ->tomcat1 ->*.jsp 80          8080 ↓      -> tomcat2 html    -> tomcat3 用户通过web访问网页,默认访问的是80端口,即访问nginx.由于nginx只支持静态网页,如果用户访问的是类似*.jsp的动态网页,需要通过应用服务器tomcat先进行处理.tomcat相当与一个媒介,将动态网页经过处理之后交给nginx,最终返回给用户. nginx后

Nginx+Tomcat+MemCached 集群配置手册

系统实施文档 Nginx+Tomcat+MemCached 集群配置手册 目    录 第1章   概述 1.1   目标 互联网的快速发展带来了互联网系统的高负载和高可用性, 这要求我们在设计系统架构时会应用很多高性能的产品, 本文主要描述互联网架构中门户应用的集群的配置工作,最终用以指导系统实施. 1.2   预期读者 本文档用于指导系统工程师进行系统实施工作,架构师和系统工程师应该通读本文档,选择适当版本用于自己的系统架构. 第2章   产品介绍 2.1   Nginx介绍 Nginx是一

Nginx+Tomcat+Memcached集群Session共享

提供给大家整合实例: http://download.csdn.net/detail/zld1987/9577962 cookie是怎样工作的? 例如,我们创建了一个名字为login的Cookie来包含访问者的信息,创建Cookie时,服务器端的Header如下面所示,这里假设访问者的注册名是"Michael Jordan",同时还对所创建的Cookie的属性如path.domain.expires等进行了指定. Set-Cookie:login=Michael Jordan;path

Nginx + tomcat + Memcached(session共享)

Nginx + tomcat + Memcached(session共享) 实验拓扑 nginx   实现负载 tomcat   实现web功能 memcached 实现会话共享 安装Nginx [[email protected] ~]# yum -y install pcre pcre-devel [[email protected] ~]# tar -zxvf nginx-1.0.5.tar.gz [[email protected] ~]# cd nginx-1.0.5 [[email 

tomcat session会话保持实验-之Nginx+tomcat+memcached

tomcat session会话保持实验-之Nginx+tomcat+memcached 实验要求 1.nginx+tomcat 负载均衡 2.memcached 会话保持 实验拓扑   ip网络规划 Nginxnode2:172.16.76.20 tomcatAnode3:172.16.76.30  memcached tomcatBnode4:172.16.76.40  memcached 基础配置   node2 [[email protected]~]# yum install ngin

Nginx+Tomcat+Memcached负载均衡配置完整流程(多方总结,亲测可用)

Nginx+Tomcat+Memcached负载均衡配置完整流程: 前言: Nginx实现Tomcat的负载均衡和利用memcached实现session共享. 首先配置tomcat,JDK 将jdk,tomcat 放入站点/opt目录中 安装JDK cd /opt chmod 755 jdk-6u45-linux-x64-rpm.bin ./jdk-6u45-linux-x64-rpm.bin java -version      //检验版本 安装Tomcat tar -zxf apache

3g上网卡的驱动程序的自动更新web端架构文档

几年前写的. 看是否有人用得上吧 1   简介 本文档详细描述了基于ASP.NET平台和IIS服务的T-Mobile自动更新系统的实现框架. 本文档主要从技术架构和业务架构两个方面来着手来描述T-Mobile自动更新系统的架构,以使相关人员快速了解产品的架构. 1.1   目的 本文档将从架构方面对T-Mobile自动更新系统进行综合概述,其中会使用用例视图.逻辑视图.部署视图.实施视图等多种不同的架构视图来描述系统的各个方面. 这些描述用于记录并表述已对系统的架构方面做出的重要决策,同时确定系