6 Replies Latest reply on Mar 4, 2016 10:59 AM by Galder Zamarreño

    What are the options of adding cache dynamically?

    Udit Mishra Novice

      We want to add cache dynamically. We know that its not porrible through hotrod client, which I had asked in this question - How to create named cache through hotrod client?

       

      Web console is something which will not suite to our requirements, as we want to automate things.

       

      All we left with the option of ispn-cli,bat script.

       

      I think the steps for adding a new cache, can be written as a batch script, and proper parameters can be supplied to that script at command line, and it can be automated, like when I need to add a new cache, that file should be run, will it work that way? gievn that, our client machines and our cache cluster, they all will be in the same network.

        • 1. Re: What are the options of adding cache dynamically?
          Tristan Tarrant Master

          Yes that is definitely possible. We also plan to introduce a remote java admin client. If you want to whip one up yourself in the meantime, you could take "inspiration" from our remote JCache client code, which does just that: https://github.com/infinispan/infinispan/blob/master/jcache/remote/src/main/java/org/infinispan/jcache/remote/ServerManager.java

          • 2. Re: What are the options of adding cache dynamically?
            Udit Mishra Novice

            That's something really great. Could you please tell me the required jars for using this, we don't use maven so I need that exact jar which should work with version 8.1? I have all the jars for java hot rod client, what do I need additionally?

             

            One more thing, planning to introduce a remote java admin client will be in version 8.2 or later on?

            • 3. Re: What are the options of adding cache dynamically?
              Tristan Tarrant Master

              I'm afraid the list of jars is quite extensive, so you should go for Maven, Gradle or Ivy to prevent your sanity from going out the window:

               

              [INFO] +- org.wildfly.core:wildfly-controller:jar:2.0.5.Final:compile

              [INFO] |  +- org.jboss:jboss-dmr:jar:1.3.0.Final:compile

              [INFO] |  +- org.wildfly.core:wildfly-controller-client:jar:2.0.5.Final:compile

              [INFO] |  |  +- org.wildfly.core:wildfly-protocol:jar:2.0.5.Final:compile

              [INFO] |  |  \- org.jboss.threads:jboss-threads:jar:2.2.1.Final:compile

              [INFO] |  +- org.wildfly.security:wildfly-elytron:jar:1.0.2.Final:compile

              [INFO] |  +- org.wildfly.core:wildfly-core-security:jar:2.0.5.Final:compile

              [INFO] |  |  \- org.wildfly.core:wildfly-core-security-api:jar:2.0.5.Final:compile

              [INFO] |  +- org.wildfly.core:wildfly-version:jar:2.0.5.Final:compile

              [INFO] |  +- org.jboss.modules:jboss-modules:jar:1.5.0.Final:compile

              [INFO] |  +- org.jboss.msc:jboss-msc:jar:1.2.6.Final:compile

              [INFO] |  \- org.jboss:staxmapper:jar:1.2.0.Final:compile

              [INFO] |  +- org.jboss.xnio:xnio-api:jar:3.3.1.Final:compile

              [INFO] |  +- org.jboss.xnio:xnio-nio:jar:3.2.2.Final:compile

              [INFO] |  +- org.jboss.remoting:jboss-remoting:jar:4.0.9.Final:compile

              [INFO] |  +- org.jboss.sasl:jboss-sasl:jar:1.0.4.Final:compile

              • 4. Re: What are the options of adding cache dynamically?
                Udit Mishra Novice

                Ha ha, true but right now, we're using Ant..

                 

                Thank you for the listing.

                • 5. Re: What are the options of adding cache dynamically?
                  Udit Mishra Novice

                  Hello nadirx,

                   

                  I resolved all the dependencies and tried the program given by you in the link. But, still its giving me some error -

                   

                  Caused by: java.lang.IllegalArgumentException: {"outcome" => "failed","failure-description" => "WFLYCTL0030: No resource definition is registered for address [

                      (\"subsystem\" => \"urn:infinispan:server:endpoint:8.0\"),

                      (\"hotrod-connector\" => \"hotrod-connector\")

                  ]","rolled-back" => true}


                  My domain.xml configuration looks something like this -


                  <subsystem xmlns="urn:infinispan:server:core:8.1" default-cache-container="clustered">

                    <cache-container name="clustered" default-cache="default" statistics="true">

                    <transport lock-timeout="60000"/>

                    <distributed-cache name="default" mode="SYNC" segments="20" owners="2" remote-timeout="30000" start="EAGER">

                    <locking acquire-timeout="30000" concurrency-level="1000" striping="false"/>

                    <transaction mode="NONE"/>

                    </distributed-cache>

                    <distributed-cache name="memcachedCache" mode="SYNC" segments="20" owners="2" remote-timeout="30000" start="EAGER">

                    <locking acquire-timeout="30000" concurrency-level="1000" striping="false"/>

                    <transaction mode="NONE"/>

                    </distributed-cache>

                    <distributed-cache name="namedCache" mode="SYNC" start="EAGER"/>

                    <distributed-cache name="transactionalCache" mode="SYNC" start="EAGER">

                    <transaction mode="NON_XA" locking="PESSIMISTIC"/>

                    </distributed-cache>

                    </cache-container>

                  </subsystem>

                  <subsystem xmlns="urn:infinispan:server:endpoint:8.0">

                    <hotrod-connector socket-binding="hotrod" cache-container="clustered">

                    <topology-state-transfer lazy-retrieval="false" lock-timeout="1000" replication-timeout="5000"/>

                    </hotrod-connector>

                    <memcached-connector socket-binding="memcached" cache-container="clustered"/>

                    <rest-connector socket-binding="rest" cache-container="clustered" security-domain="other" auth-method="BASIC"/>

                    <websocket-connector socket-binding="websocket" cache-container="clustered"/>

                  </subsystem>

                   

                  Also, in the java program , just changed these constants -

                   

                  private static final String INFINISPAN_SUBSYSTEM_NAME = "urn:infinispan:server:core:8.1";

                  private static final String INFINISPAN_ENDPOINT_SUBSYSTEM_NAME = "urn:infinispan:server:endpoint:8.0";


                  Kindly tell us where we're going wrong..

                  • 6. Re: What are the options of adding cache dynamically?
                    Galder Zamarreño Master

                    If what you're trying to do is add a new cache, the address shown in the error message looks the wrong one. You should not add anything to the connectors but to an address leading to a cache-container... Again, double check the link Tristan provided.