现在用两台机器运行通过nginx做集群,登陆后,把一台机器down掉完了再刷新但是变成了未登陆状态。但是我放在session中的用户信息又可以取到。请问您这是什么原因呢
[main]
#Session管理器,关闭定时校验机制,持久化环境下会非常耗内存
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionValidationSchedulerEnabled = false
sessionManager.sessionIdUrlRewritingEnabled = false
sessionManager.deleteInvalidSessions = true
#带缓存的SessionDAO
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager
# use R.UU32(), 原生的是UUID,比较长
sessionIdGenerator = org.nutz.integration.shiro.UU32SessionIdGenerator
securityManager.sessionManager.sessionDAO.sessionIdGenerator = $sessionIdGenerator
#记住我
rememberMeCookie = org.apache.shiro.web.servlet.SimpleCookie
rememberMeCookie.name=remember
rememberMeCookie.maxAge = 604800
rememberMeCookie.httpOnly = true
rememberMeManager = org.apache.shiro.web.mgt.CookieRememberMeManager
rememberMeManager.cookie = $rememberMeCookie
# 2层缓存配置
jedisAgent = org.nutz.integration.jedis.JedisAgent
#cacheManager_ehcache = org.apache.shiro.cache.ehcache.EhCacheManager
#cacheManager_ehcache.cacheManagerConfigFile=classpath:ehcache.xml
cacheManager_redis = org.nutz.plugins.cache.impl.redis.RedisCacheManager
cacheManager_redis.mode=kv
cacheManager_redis.debug=true
cacheManager_redis.ttl=1800
cacheManager = org.nutz.plugins.cache.impl.lcache.LCacheManager
#cacheManager.level1 = $cacheManager_ehcache
cacheManager.level2 = $cacheManager_redis
cacheManager.jedisAgent = $jedisAgent
securityManager.cacheManager = $cacheManager
#securityManager.rememberMeManager = $rememberMeManager
# realm声明
nutzdao_realm = com.hxd.shiro.realm.UserRealm
# cookie, nutzcn使用超长时间的cookie,所以下面的timeout都很长
sessionIdCookie=org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name=sid
sessionIdCookie.maxAge=1800000
sessionIdCookie.httpOnly=true
sessionManager.sessionIdCookie=$sessionIdCookie
sessionManager.sessionIdCookieEnabled=true
sessionManager.globalSessionTimeout=1800000
authc = org.nutz.integration.shiro.SimpleAuthenticationFilter
authc.loginUrl = /login
perms.loginUrl = /login
roles.loginUrl = /login
user.loginUrl = /login
rest.loginUrl = /login
logout.redirectUrl= /login
[urls]
/static/* = anon, noSessionCreation
/druid/* = anon, noSessionCreation
/style/* = anon, noSessionCreation
/member/V1.0/* = anon
/wx/member/V1.0/* = anon
/investTender = authc
/realName = authc
/member/** = authc
/wx/member/** = authc
/wx/investTender = authc
/member/logout = logout
/wx/member/logout = logout
这是我的shiro.ini文件配置
<ehcache monitoring="autodetect" dynamicConfig="true" name="hxcf">
<diskStore path="D:/shiro-ehcache"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
/>
<cache name="shiro-activeSessionCache"
maxElementsInMemory="10000"
overflowToDisk="true"
eternal="true"
timeToLiveSeconds="0"
timeToIdleSeconds="0"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="600"/>
</ehcache>
这是我的ehcache.xml
不管我把一级缓存注释掉还是开启都无用。