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

                    How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                    Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?