Hazelcast Spring Session pass node instanceHazelcast Spring Session SubZero(Kryo) EntryBackupProcessorImpl NullPointerException issueHazelcast MapStoreConfig ignoredHazelcast HTTP session replication doesn't replicate anythingDiscovering Hazelcast instance in a Spring Boot eco-systemfacing issues with hazelcast backup - sync backup not workingHazelcast: how data is partitioned when using Cluster Groups?Hazelcast Session Replciation With Spring BootHazelcast configuration - instance with mismatching network config is able to form join the clusterSpring boot + spring security + hazelcast session replication could not make it workPayara - Hazelcast cluster node picks the wrong network interfaceHazelcast Spring Session SubZero(Kryo) EntryBackupProcessorImpl NullPointerException issue

Class Action - which options I have?

Two monoidal structures and copowering

How do I find the solutions of the following equation?

How do I rename a Linux host without needing to reboot for the rename to take effect?

How does buying out courses with grant money work?

How did Arya survive the stabbing?

How do scammers retract money, while you can’t?

Implement the Thanos sorting algorithm

Is there a korbon needed for conversion?

How can a function with a hole (removable discontinuity) equal a function with no hole?

Large drywall patch supports

Why not increase contact surface when reentering the atmosphere?

How do I go from 300 unfinished/half written blog posts, to published posts?

Anatomically Correct Strange Women In Ponds Distributing Swords

Is there a good way to store credentials outside of a password manager?

A particular customize with green line and letters for subfloat

Crossing the line between justified force and brutality

Lay out the Carpet

Sequence of Tenses: Translating the subjunctive

How do I extract a value from a time formatted value in excel?

Integer addition + constant, is it a group?

Roman Numeral Treatment of Suspensions

How to write papers efficiently when English isn't my first language?

Type int? vs type int



Hazelcast Spring Session pass node instance


Hazelcast Spring Session SubZero(Kryo) EntryBackupProcessorImpl NullPointerException issueHazelcast MapStoreConfig ignoredHazelcast HTTP session replication doesn't replicate anythingDiscovering Hazelcast instance in a Spring Boot eco-systemfacing issues with hazelcast backup - sync backup not workingHazelcast: how data is partitioned when using Cluster Groups?Hazelcast Session Replciation With Spring BootHazelcast configuration - instance with mismatching network config is able to form join the clusterSpring boot + spring security + hazelcast session replication could not make it workPayara - Hazelcast cluster node picks the wrong network interfaceHazelcast Spring Session SubZero(Kryo) EntryBackupProcessorImpl NullPointerException issue













0















Trying to configure Spring Session using Hazelcast. It works okay out of the box using this doc - but it uses default hazelcast node. In my case I am running several nodes(those are in different clusters) on the same JVM, and I need use particular hazelcast instance to store my session. I haven't find much information, how to configure it(pass hazelcast instance nameor instance itself).



Will appreciate any help.










share|improve this question




























    0















    Trying to configure Spring Session using Hazelcast. It works okay out of the box using this doc - but it uses default hazelcast node. In my case I am running several nodes(those are in different clusters) on the same JVM, and I need use particular hazelcast instance to store my session. I haven't find much information, how to configure it(pass hazelcast instance nameor instance itself).



    Will appreciate any help.










    share|improve this question


























      0












      0








      0








      Trying to configure Spring Session using Hazelcast. It works okay out of the box using this doc - but it uses default hazelcast node. In my case I am running several nodes(those are in different clusters) on the same JVM, and I need use particular hazelcast instance to store my session. I haven't find much information, how to configure it(pass hazelcast instance nameor instance itself).



      Will appreciate any help.










      share|improve this question
















      Trying to configure Spring Session using Hazelcast. It works okay out of the box using this doc - but it uses default hazelcast node. In my case I am running several nodes(those are in different clusters) on the same JVM, and I need use particular hazelcast instance to store my session. I haven't find much information, how to configure it(pass hazelcast instance nameor instance itself).



      Will appreciate any help.







      hazelcast spring-session






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 20 at 16:16







      Oleg Kuts

















      asked Mar 20 at 14:55









      Oleg KutsOleg Kuts

      369721




      369721






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Session storage is sharded across the available nodes. You can't chose which node hosts any particular session. Further, if Hazelcast needs to rebalance the shards, sessions may get moved from one node to another.



          The instance-name parameter just dictates whether to try to find an existing connection to the cluster or whether to start a new connnection.



          Perhaps the question is why do you need to control which node hosts which session?






          share|improve this answer























          • I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

            – Oleg Kuts
            Mar 20 at 16:24











          • I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

            – Oleg Kuts
            Mar 20 at 16:24


















          0














          Next code let me to configure Spring Session to use particular node, instead of default one. Only question I have is how to configure session time to live. hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600) sets only max inactive time, not time to live.



          @Configuration
          @EnableSpringHttpSession
          public class HazelcastSessionConfig

          @Bean//default
          public HazelcastInstance hazelcastInstance()
          Config config = new Config();
          config.setInstanceName("cache-node");
          config.getGroupConfig().setName("cluster-1");
          return Hazelcast.newHazelcastInstance(config);


          @Bean//Node I need to use
          public HazelcastInstance hazelcastSessionInstance()

          Config config = new Config();
          config.setInstanceName("session-node");
          config.getGroupConfig().setName("cluster-2");
          MapAttributeConfig attributeConfig = new MapAttributeConfig()
          .setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
          .setExtractor(PrincipalNameExtractor.class.getName());


          final MapConfig mapConfig = config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME);
          mapConfig
          .addMapAttributeConfig(attributeConfig)
          .addMapIndexConfig(new MapIndexConfig(
          HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));

          return Hazelcast.newHazelcastInstance(config);



          @Bean//Pass node here
          public HazelcastSessionRepository sessionRepository(HazelcastInstance hazelcastSessionInstance)
          final HazelcastSessionRepository hazelcastSessionRepository = new HazelcastSessionRepository(hazelcastSessionInstance);
          hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600);
          return hazelcastSessionRepository;








          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55263815%2fhazelcast-spring-session-pass-node-instance%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Session storage is sharded across the available nodes. You can't chose which node hosts any particular session. Further, if Hazelcast needs to rebalance the shards, sessions may get moved from one node to another.



            The instance-name parameter just dictates whether to try to find an existing connection to the cluster or whether to start a new connnection.



            Perhaps the question is why do you need to control which node hosts which session?






            share|improve this answer























            • I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

              – Oleg Kuts
              Mar 20 at 16:24











            • I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

              – Oleg Kuts
              Mar 20 at 16:24















            0














            Session storage is sharded across the available nodes. You can't chose which node hosts any particular session. Further, if Hazelcast needs to rebalance the shards, sessions may get moved from one node to another.



            The instance-name parameter just dictates whether to try to find an existing connection to the cluster or whether to start a new connnection.



            Perhaps the question is why do you need to control which node hosts which session?






            share|improve this answer























            • I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

              – Oleg Kuts
              Mar 20 at 16:24











            • I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

              – Oleg Kuts
              Mar 20 at 16:24













            0












            0








            0







            Session storage is sharded across the available nodes. You can't chose which node hosts any particular session. Further, if Hazelcast needs to rebalance the shards, sessions may get moved from one node to another.



            The instance-name parameter just dictates whether to try to find an existing connection to the cluster or whether to start a new connnection.



            Perhaps the question is why do you need to control which node hosts which session?






            share|improve this answer













            Session storage is sharded across the available nodes. You can't chose which node hosts any particular session. Further, if Hazelcast needs to rebalance the shards, sessions may get moved from one node to another.



            The instance-name parameter just dictates whether to try to find an existing connection to the cluster or whether to start a new connnection.



            Perhaps the question is why do you need to control which node hosts which session?







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 20 at 15:55









            Neil StevensonNeil Stevenson

            1,517410




            1,517410












            • I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

              – Oleg Kuts
              Mar 20 at 16:24











            • I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

              – Oleg Kuts
              Mar 20 at 16:24

















            • I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

              – Oleg Kuts
              Mar 20 at 16:24











            • I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

              – Oleg Kuts
              Mar 20 at 16:24
















            I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

            – Oleg Kuts
            Mar 20 at 16:24





            I should have mentioned those nodes are in different clusters(groups), but running same JVM. I will have several instances of app, and two clusters. The reason I need two clusters is - one cluster will be used for distributed cache(both service and second level), another - for distributed session only. The reason I am doing so is that for nodes in first cluster I will be using Kryo(SubZero), and I have faced issue running Kryo with distributed session. So as a workaround i was going to create separate cluster for session. For that purpose I need to tell SpringSession to use particular node.

            – Oleg Kuts
            Mar 20 at 16:24













            I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

            – Oleg Kuts
            Mar 20 at 16:24





            I described my issue with Kryo and Spring Session here stackoverflow.com/questions/55262028/…

            – Oleg Kuts
            Mar 20 at 16:24













            0














            Next code let me to configure Spring Session to use particular node, instead of default one. Only question I have is how to configure session time to live. hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600) sets only max inactive time, not time to live.



            @Configuration
            @EnableSpringHttpSession
            public class HazelcastSessionConfig

            @Bean//default
            public HazelcastInstance hazelcastInstance()
            Config config = new Config();
            config.setInstanceName("cache-node");
            config.getGroupConfig().setName("cluster-1");
            return Hazelcast.newHazelcastInstance(config);


            @Bean//Node I need to use
            public HazelcastInstance hazelcastSessionInstance()

            Config config = new Config();
            config.setInstanceName("session-node");
            config.getGroupConfig().setName("cluster-2");
            MapAttributeConfig attributeConfig = new MapAttributeConfig()
            .setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
            .setExtractor(PrincipalNameExtractor.class.getName());


            final MapConfig mapConfig = config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME);
            mapConfig
            .addMapAttributeConfig(attributeConfig)
            .addMapIndexConfig(new MapIndexConfig(
            HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));

            return Hazelcast.newHazelcastInstance(config);



            @Bean//Pass node here
            public HazelcastSessionRepository sessionRepository(HazelcastInstance hazelcastSessionInstance)
            final HazelcastSessionRepository hazelcastSessionRepository = new HazelcastSessionRepository(hazelcastSessionInstance);
            hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600);
            return hazelcastSessionRepository;








            share|improve this answer





























              0














              Next code let me to configure Spring Session to use particular node, instead of default one. Only question I have is how to configure session time to live. hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600) sets only max inactive time, not time to live.



              @Configuration
              @EnableSpringHttpSession
              public class HazelcastSessionConfig

              @Bean//default
              public HazelcastInstance hazelcastInstance()
              Config config = new Config();
              config.setInstanceName("cache-node");
              config.getGroupConfig().setName("cluster-1");
              return Hazelcast.newHazelcastInstance(config);


              @Bean//Node I need to use
              public HazelcastInstance hazelcastSessionInstance()

              Config config = new Config();
              config.setInstanceName("session-node");
              config.getGroupConfig().setName("cluster-2");
              MapAttributeConfig attributeConfig = new MapAttributeConfig()
              .setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
              .setExtractor(PrincipalNameExtractor.class.getName());


              final MapConfig mapConfig = config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME);
              mapConfig
              .addMapAttributeConfig(attributeConfig)
              .addMapIndexConfig(new MapIndexConfig(
              HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));

              return Hazelcast.newHazelcastInstance(config);



              @Bean//Pass node here
              public HazelcastSessionRepository sessionRepository(HazelcastInstance hazelcastSessionInstance)
              final HazelcastSessionRepository hazelcastSessionRepository = new HazelcastSessionRepository(hazelcastSessionInstance);
              hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600);
              return hazelcastSessionRepository;








              share|improve this answer



























                0












                0








                0







                Next code let me to configure Spring Session to use particular node, instead of default one. Only question I have is how to configure session time to live. hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600) sets only max inactive time, not time to live.



                @Configuration
                @EnableSpringHttpSession
                public class HazelcastSessionConfig

                @Bean//default
                public HazelcastInstance hazelcastInstance()
                Config config = new Config();
                config.setInstanceName("cache-node");
                config.getGroupConfig().setName("cluster-1");
                return Hazelcast.newHazelcastInstance(config);


                @Bean//Node I need to use
                public HazelcastInstance hazelcastSessionInstance()

                Config config = new Config();
                config.setInstanceName("session-node");
                config.getGroupConfig().setName("cluster-2");
                MapAttributeConfig attributeConfig = new MapAttributeConfig()
                .setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
                .setExtractor(PrincipalNameExtractor.class.getName());


                final MapConfig mapConfig = config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME);
                mapConfig
                .addMapAttributeConfig(attributeConfig)
                .addMapIndexConfig(new MapIndexConfig(
                HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));

                return Hazelcast.newHazelcastInstance(config);



                @Bean//Pass node here
                public HazelcastSessionRepository sessionRepository(HazelcastInstance hazelcastSessionInstance)
                final HazelcastSessionRepository hazelcastSessionRepository = new HazelcastSessionRepository(hazelcastSessionInstance);
                hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600);
                return hazelcastSessionRepository;








                share|improve this answer















                Next code let me to configure Spring Session to use particular node, instead of default one. Only question I have is how to configure session time to live. hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600) sets only max inactive time, not time to live.



                @Configuration
                @EnableSpringHttpSession
                public class HazelcastSessionConfig

                @Bean//default
                public HazelcastInstance hazelcastInstance()
                Config config = new Config();
                config.setInstanceName("cache-node");
                config.getGroupConfig().setName("cluster-1");
                return Hazelcast.newHazelcastInstance(config);


                @Bean//Node I need to use
                public HazelcastInstance hazelcastSessionInstance()

                Config config = new Config();
                config.setInstanceName("session-node");
                config.getGroupConfig().setName("cluster-2");
                MapAttributeConfig attributeConfig = new MapAttributeConfig()
                .setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
                .setExtractor(PrincipalNameExtractor.class.getName());


                final MapConfig mapConfig = config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME);
                mapConfig
                .addMapAttributeConfig(attributeConfig)
                .addMapIndexConfig(new MapIndexConfig(
                HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));

                return Hazelcast.newHazelcastInstance(config);



                @Bean//Pass node here
                public HazelcastSessionRepository sessionRepository(HazelcastInstance hazelcastSessionInstance)
                final HazelcastSessionRepository hazelcastSessionRepository = new HazelcastSessionRepository(hazelcastSessionInstance);
                hazelcastSessionRepository.setDefaultMaxInactiveInterval(3600);
                return hazelcastSessionRepository;









                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 21 at 16:03

























                answered Mar 21 at 15:57









                Oleg KutsOleg Kuts

                369721




                369721



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55263815%2fhazelcast-spring-session-pass-node-instance%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript