社区
下载资源悬赏专区
帖子详情
用Memcached 实现简单Session Cache Server下载
weixin_39820835
2019-11-02 07:30:16
Session Cache Server 及Tomcat集群架构之二:用Memcached 实现简单Session Cache Server
相关下载链接:
//download.csdn.net/download/myloon/2683537?utm_source=bbsseo
...全文
3
回复
打赏
收藏
用Memcached 实现简单Session Cache Server下载
Session Cache Server 及Tomcat集群架构之二:用Memcached 实现简单Session Cache Server 相关下载链接://download.csdn.net/download/myloon/2683537?utm_source=bbsseo
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
用
Mem
cache
d
实现
简单
Session
Cache
Server
Session
Cache
Server
及Tomcat集群架构之二:用
Mem
cache
d
实现
简单
Session
Cache
Server
tomcat8 + nginx +
mem
cache
d
+ cas
实现
负载均衡的配置包
1,tomcat8的配置: 1.1修改tomcat8.x/conf/context.xml的配置如下:
WEB-INF/web.xml
${catalina.base}/conf/web.xml
cacheMaxSize="100000" />
mem
cache
dNodes="n1:127.0.0.1:11211" username="root" password="" sticky="false"
session
BackupAsync="false" lockingMode="uriPattern:/path1|/path2" requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
session
BackupTimeout="18000" transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory" copyCollectionsForSerialization="false" />
1.2添加
mem
cache
d
如下依赖的jar包到tomcat8.x/lib/: asm-5.1.jar couchbase-client-1.4.12.jar javolution-5.5.1.jar kryo-4.0.0.jar kryo-serializers-0.38.jar
mem
cache
d
-
session
-manager-2.0.0.jar
mem
cache
d
-
session
-manager-tc8-2.0.0.jar minlog-1.3.jar msm-javolution-serializer-2.0.0.jar msm-kryo-serializer-2.0.0.jar msm-xstream-serializer-2.0.0.jar objenesis-2.1.jar reflectasm-1.09.jar spy
mem
cache
d
-2.12.1.jar 2,nginx的配置: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; sendfile on; tcp_nopush on; tcp_nodelay on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; #设定负载均衡的服务器列表 upstream 127.0.0.1 { #设定负载均衡的服务器列表 #ip_hash; #同一机器在多网情况下,路由切换,ip可能不同 #weigth参数表示权值,权值越高被分配到的几率越大
server
127.0.0.1:8085 weight=1 max_fails=20 fail_timeout=600s;
server
127.0.0.1:8086 weight=1 max_fails=20 fail_timeout=600s; } map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server
{ listen 80;
server
_name localhost; charset UTF-8; #设定本虚拟主机的访问日志 access_log logs/host.access.log main; #对 "/" 所有应用启用负载均衡 location / { proxy_pass http://127.0.0.1; #保留用户真实信息 proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; index index.html index.htm index.aspx; } #对 "/Dossm3RabbitMQConsumer/" 启用负载均衡 location /Dossm3RabbitMQConsumer/ { proxy_pass http://localhost:8086; #保留用户真实信息 proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; index index.html index.htm index.aspx; } } # another virtual host using mix of IP-, name-, and port-based configuration # #
server
{ # listen 8000; # listen somename:8080; #
server
_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS
server
# #
server
{ # listen 443 ssl; #
server
_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_
session
_
cache
shared:SSL:1m; # ssl_
session
_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_
server
_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } 3,cas的配置(): 3.1 修改/CAS/WEB-INF/spring-configuration/ticketRegistry.xml
Configuration for the default TicketRegistry which stores the tickets in-memory and cleans them out as specified intervals.
servers="127.0.0.1:11211" p:protocol="BINARY" p:locatorType="ARRAY_MOD" p:failureMode="Redistribute" p:transcoder-ref="serialTranscoder">
3.2 添加cas和
mem
cache
d
整合的如下依赖jar包到/CAS/WEB-INF/lib: cas-
server
-integration-
mem
cache
d
-4.0.0.jar mockito-core-2.1.0-RC.1.jar spy
mem
cache
d
-2.11.2.jar 参考CAS官方配置:https://apereo.github.io/cas/4.2.x/installation/
Mem
cache
d
-Ticket-Registry.html
第3周 3WEB技术-tomcat 会话同步.html
tomcat会话保持的三种方法 (1)
session
sticky(贴) 基于hash 和cookie 来
实现
会话保持,
简单
的负载均衡算法 基于source_ip(源地址hash) nginx: ip_hash 、 haproxy: source 、 lvs: sh (2)
session
cluster:delta
session
manager 基于tomcat集群会话保持 分析:tomcat自身带的机制
session
cluster,基于组播的方式,一个tomcat 被用户登录访问,记录
session
;通过组播给集群中的其他机器复制一份;那么当用户再次访问时,每个机器都有
session
会话记录;从而
实现
了会话保持 (3)
session
server
:redis(store),
mem
cache
d
(
cache
) 共享存储 分析:新建立一个存放各个tomcat
session
记录的
server
,每台tomcat服务器都将自己的
session
记录在这个服务器中,用户再次访问,每台tomcat 都从这个
server
中获取;
实现
会话保持
Ubuntu
server
11.04安装mem
cache
及php使用mem
cache
来存储
session
的方法
本文实例讲述了Ubuntu
server
11.04安装mem
cache
及php使用mem
cache
来存储
session
的方法。分享给大家供大家参考,具体如下: 1、首先安装mem
cache
服务端: sudo apt-get install
mem
cache
d
安装完成后系统 自动启动了
mem
cache
d
服务占用11211端口 如需重新配置11211端口的服务 需要关闭已开启的
mem
cache
d
服务 手动启动:
mem
cache
d
-d -m 128 -p 11211 -u mem
cache
这里需要说明一下
mem
cache
d
服务的启动参数: -p 监听的端口 -l 连接的IP地址,
Session
Cache
Server
及Tomcat集群架构之二:用
Mem
cache
d
实现
简单
Session
Cache
Server
Session
Cache
Server
及Tomcat集群架构,用
Mem
cache
d
实现
简单
Session
Cache
Server
下载资源悬赏专区
12,777
社区成员
12,305,057
社区内容
发帖
与我相关
我的任务
下载资源悬赏专区
CSDN 下载资源悬赏专区
复制链接
扫一扫
分享
社区描述
CSDN 下载资源悬赏专区
其他
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章