[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Tomcat session management with Redisson
From:       Herb Burnswell <herbert.burnswell () gmail ! com>
Date:       2019-02-25 6:48:17
Message-ID: CAOuzmw6=BTmqh4Fa6ECbWNkO8+BcxYeNp9EdZhz-v3_4VoTYsg () mail ! gmail ! com
[Download RAW message or body]


On Mon, Feb 18, 2019 at 11:13 AM Harpreet Sandhu <happyenb@gmail.com> wrote:

> If you want to go with redis in HA environment. You should opt redis
> sentinel over master-slave architecture.
> 

Thanks Harpreet.  I did switch to using the sentinel configuration as I
have:

sentinel 1  -------------- sentinel 2 ---------------- sentinel 3

redis master ----------- redis slave

However, the application says it cannot connect to the sentinel servers:

INFO   | jvm 1    | main    | 2019/02/18 15:23:11.722 |
[localhost-startStop-1] WARN
org.redisson.connection.SentinelConnectionManager - Can't connect to
sentinel server. Unable to connect to: node1:26379
INFO   | jvm 1    | main    | 2019/02/18 15:23:11.722 |
[localhost-startStop-1] WARN
org.redisson.connection.SentinelConnectionManager - Can't connect to
sentinel server. Unable to connect to: node2:26379
INFO   | jvm 1    | main    | 2019/02/18 15:23:11.722 |
[localhost-startStop-1] WARN
org.redisson.connection.SentinelConnectionManager - Can't connect to
sentinel server. Unable to connect to: node3:26379

I posted a question on the redis-db google group as I thought it may not be
appropriate for this Tomcat User Group:

https://groups.google.com/forum/#!topic/redis-db/-mTTnahSgZo

If you have experience with the Tomcat --> Sentinel connectivity, I'd be
grateful for any guidance..

thanks,

HB



> On Tue 19 Feb, 2019, 12:29 AM Herb Burnswell <herbert.burnswell@gmail.com
> wrote:
> 
> > On Fri, Feb 15, 2019 at 12:21 PM Christopher Schultz <
> > chris@christopherschultz.net> wrote:
> > 
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA256
> > > 
> > > Herb,
> > > 
> > > On 2/14/19 12:41, Herb Burnswell wrote:
> > > > Tomcat 8.5.23 RHEL   7.5
> > > > 
> > > > We are looking to set up session management via Redisson to offload
> > > > the CPU consumption of using Tomcat's built in clustering session
> > > > management.  We have CPU licensing limits and need to conserve as
> > > > much CPU as possible.
> > > 
> > > Dumb question: aren't you just going to move the CPU cycles to another
> > > system?
> > > 
> > 
> > Thanks for the reply.  Short answer, yes.  But that is the idea.  We can
> > only use 2 CPU's per application node (3 nodes) with our licensing
> > structure so we do not want to take cycles away from the application to
> > manage sessions.
> > 
> > 
> > > Another dumb question: do you actually need clustering?
> > > 
> > 
> > If I'm using the term correctly, yes.  The idea would be for HA
> > functionality; If users were connected to node 3 and the node failed for
> > some reason, their session would be picked up by node 1 or 2
> > uninterrupted.  Sorry if I confused the intent.
> > 
> > 
> > > 
> > > > I have never set up a configuration this way, however I have Redis
> > > > set up and running as 1 Master, 1 Slave.  I seemingly just need to
> > > > point our application to it.  I have read this doc on how to:
> > > > 
> > > > https://github.com/redisson/redisson/tree/master/redisson-tomcat
> > > > 
> > > > It seems pretty straight forward except for the redisson.conf
> > > > configuration:
> > > > 
> > > > Add RedissonSessionManager into tomcat/conf/context.xml
> > > > 
> > > > <Manager className="org.redisson.tomcat.RedissonSessionManager"
> > > > configPath="${catalina.base}/redisson.conf" readMode="REDIS"
> > > > updateMode="DEFAULT"/>
> > > 
> > > I would do this in the application's context.xml file instead of the
> > > global/default one. That means modifying the application's
> > > META-INF/context.xml file, or, if you deploy via files from outside
> > > your WAR/dir application, then conf/[engine]/[hostname]/[appname].xml.
> > > 
> > 
> > Yes, this is requiring the editing a application specific xml file.
> > 
> > 
> > > 
> > > > I am more familiar with YAML so plan on configuring the
> > > > redisson.conf as such.  I have read the referenced configuration
> > > > wiki page:
> > > > 
> > > > https://github.com/redisson/redisson/wiki/2.-Configuration
> > > > 
> > > > However, it has a great deal of options and I'm not sure what is
> > > > and is not needed.
> > > > 
> > > > I am reaching out here on the Tomcat user group to see if anyone
> > > > else is using Redisson for session management and if maybe I can
> > > > get some guidance on a basic redisson.conf configuration.  I'd also
> > > > be interested in comments on if there are better options or things
> > > > to watch out for.
> > > 
> > > I don't have any experience with either Redis or Redisson, but what is
> > > wrong with the default/sample configuration you have provided above?
> > > 
> > 
> > I have through much trial and error been using this config:
> > 
> > {
> > "masterSlaveServersConfig":{
> > "idleConnectionTimeout":10000,
> > "connectTimeout":10000,
> > "timeout":3000,
> > "retryAttempts":3,
> > "retryInterval":1500,
> > "failedSlaveReconnectionInterval":3000,
> > "failedSlaveCheckInterval":60000,
> > "password":"<master_pass>",
> > "subscriptionsPerConnection":5,
> > "clientName":true,
> > "subscriptionConnectionMinimumIdleSize":1,
> > "subscriptionConnectionPoolSize":50,
> > "slaveConnectionMinimumIdleSize":32,
> > "slaveConnectionPoolSize":64,
> > "masterConnectionMinimumIdleSize":32,
> > "masterConnectionPoolSize":64,
> > "readMode":"SLAVE",
> > "subscriptionMode":"SLAVE",
> > "slaveAddresses":[
> > "<slave.example.com:6379"
> > ],
> > "masterAddress":"<master.example.com>:6379",
> > "database":0
> > },
> > "threads":0,
> > "nettyThreads":0,
> > "transportMode":"NIO"
> > }
> > 
> > However, I am getting a couple exceptions and am not sure what might be
> the
> > issue:
> > 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 | Feb 18, 2019
> > 10:09:33 AM org.apache.catalina.core.StandardContext startInternal
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 | SEVERE: The
> session
> > manager failed to start
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |
> > org.apache.catalina.LifecycleException: Failed to start component
> > [org.redisson.tomcat.RedissonSessionManager[]]
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5224)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > java.util.concurrent.FutureTask.run(FutureTask.java:266)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > java.lang.Thread.run(Thread.java:748)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 | Caused by:
> > org.apache.catalina.LifecycleException: java.lang.NullPointerException
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.tomcat.RedissonSessionManager.buildClient(RedissonSessionManager.java:279)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.tomcat.RedissonSessionManager.startInternal(RedissonSessionManager.java:209)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         ... 8
> more
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 | Caused by:
> > java.lang.NullPointerException
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > io.netty.util.NetUtil.isValidIpV4Address(NetUtil.java:648)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> io.netty.util.NetUtil.createByteArrayFromIpAddressString(NetUtil.java:368)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > org.redisson.client.RedisClient.resolveAddr(RedisClient.java:172)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.connection.MasterSlaveEntry.addSlave(MasterSlaveEntry.java:303)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.connection.MasterSlaveEntry.addSlave(MasterSlaveEntry.java:345)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.connection.MasterSlaveEntry.initSlaveBalancer(MasterSlaveEntry.java:102)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.connection.MasterSlaveConnectionManager.createMasterSlaveEntry(MasterSlaveConnectionManager.java:372)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.connection.MasterSlaveConnectionManager.initSingleEntry(MasterSlaveConnectionManager.java:346)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.connection.MasterSlaveConnectionManager.<init>(MasterSlaveConnectionManager.java:161)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.config.ConfigSupport.createConnectionManager(ConfigSupport.java:225)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > org.redisson.Redisson.<init>(Redisson.java:121)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > org.redisson.Redisson.create(Redisson.java:164)
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         at
> > 
> > 
> org.redisson.tomcat.RedissonSessionManager.buildClient(RedissonSessionManager.java:277)
> 
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |         ... 10
> more
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 |
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 | Feb 18, 2019
> > 10:09:33 AM org.apache.catalina.core.StandardContext startInternal
> > INFO   | jvm 1    | main    | 2019/02/18 10:09:33.068 | SEVERE: Context
> []
> > startup failed due to previous errors
> > 
> > 
> > 
> > 
> > > 
> > > - -chris
> > > -----BEGIN PGP SIGNATURE-----
> > > Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
> > > 
> > > iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlxnHysACgkQHPApP6U8
> > > pFhkyRAAhq0Rw6laOS4mUAgtjWhCW8tvsrfvWmUtQKu0TTmdDuoL1OUEYBiAl45l
> > > TBF7sxjtd8Olk9gEqGdzD9srZUF1y9/ajzok4KGZrfDEHKnoqoXPQaRFTT7tWpH6
> > > 76uOj2KHzaTdgtz6qVdGdJKJ97VY0pMy/+4AMPwO/I3tygah1MfIGqKjbJ1zZr0O
> > > ZT0CRBgRb2pUn5nZTtXyozL0J+3MIRGPC35il86Wb+Wkjw4ks3S+gxTe3Cl7MCO7
> > > wfu8WAI+gKEapdC0Aj9esu/HueYMGgdj3GYvTJCivqg9TGtPpgMaEe09o1VjfMmV
> > > JZu4aCjaDq82ZxLlIKFLKkDhlgYhFhnLVYXN1H+2SdITabprpWw+KDdx55jVE3yt
> > > W+ZQR/dFqDVvp5uKU1u/2BZACjXn3bRrkvif4bKQJuWpFBoXT6fBJ/37eYuiS58n
> > > 7omBRJoGzpcKCOjij1GhwtePKibo9EBm+r/RsGZnxTQHnHKslCwp+TcS5nZFmw9H
> > > Y1O0jtIyhcMp7o1mAsuErKK6OSu7bREe+4NrgwJ7OCSXU42keU/fXK2Z8u/MAJE1
> > > uRDyqSk+VbNxP+MCbShr89QD6XVAFoKnVk5QDdEiUZ5asxCbhl5UADNi9P3Nzasr
> > > fK7ae3S8kD98k1P2OvguPqnwbUpHd7tVrlwOrs/8LF8w+PeSJWU=
> > > =XhoF
> > > -----END PGP SIGNATURE-----
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > 
> > > 
> > 
> 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic