12 Replies Latest reply on Mar 12, 2014 10:14 AM by viniciusfernandes

    Problem to write data on disk with Infinispan 6.0.0-final

    viniciusfernandes

      I wish to adopt Infinispan 6.0.0-final as database very soon, but I still can not to write data on disk yet. Someone could help me?

        • 1. Re: Problem to write data on disk with Infinispan 6.0.0-final
          mircea.markus

          Can you elaborate on " I still can not to write data on disk yet" ?

          ATM infinispan allows you to overflow data to disk: http://infinispan.org/docs/6.0.x/user_guide/user_guide.html#_persistence

          • 2. Re: Problem to write data on disk with Infinispan 6.0.0-final
            viniciusfernandes

            I have a web application and a component have to access infinispan wich runs on another JVM. So, I coded this:

             

            Configuration config = new ConfigurationBuilder().addServer()

              .host(SERVER_HOST).port(SERVER_PORT).build();

             

            RemoteCacheManager rcm = new RemoteCacheManager(config, true);

            RemoteCache cache = rcm.getCache();

             

            cache.pu(key, value);

             

            Untill now, everything is OK. But, when I shutdown and restart the Infinispan server I lose whole data sent to cache. Thats my problem. I want to instruct the database to write to disk, but have not found how to configure this behavior.

             

            Cheers...

            • 3. Re: Problem to write data on disk with Infinispan 6.0.0-final
              wdfink

              Sounds like you did not add any persistence. There is no persistence configured automaticaly.

              Could you share a simple example what you are doing?

              • 4. Re: Problem to write data on disk with Infinispan 6.0.0-final
                viniciusfernandes

                Until now, I have dedicated me to the Persistence chapter of the documentation, but there is a lot of configurations and does not makes clear where and which file could I do such settings. The one configuration file I have know is the "standalone.xml", but the docs does not specify where can I do that. For instance: I can setting my JBoss7 behavior editing standalone.xml or through manager console on URL by borwser on http://localhost:9990, and I dont found something like it on Infinispan. So, is there a manager console to setting my Infinispan? Is standalone.xml the only file to do that?

                • 5. Re: Problem to write data on disk with Infinispan 6.0.0-final
                  wdfink

                  Could you elaborate what you are doing?

                  I did not understand what you try to achieve? Did you want to configure the cache inside your application or do you run a JBoss server and want to configure the cache from here?

                  • 6. Re: Problem to write data on disk with Infinispan 6.0.0-final
                    viniciusfernandes

                    I downloaded HotRod client service (infinispan-server-6.0.0.Final-bin.zip) and I found a file structure seems like to JBoss7 structure such stanalone, deployment and configuration directories. Well, I started up the server running standalone.bat through command line and everything is OK. I think the Infinispan has some administration panel do to some settings, seems like JBoss7, but I can still not find it. On summarizing I should to do:

                     

                    1) I looking for a admin console or configurations file .xml to make my Infinispan persistente database, not just in memory data.

                    • 7. Re: Problem to write data on disk with Infinispan 6.0.0-final
                      wdfink

                      Ok, you use a infinispan server.

                      That mean you have a server which is based on AS7, but there is no CLI like in AS7. This is different.

                      If you want to have a persistent cache and try to access it remote you should have a look to this quickstart Use JDG remotely through Hotrod

                      Here you find the configuration and access explained step by step.

                      Hope that helps

                      • 8. Re: Problem to write data on disk with Infinispan 6.0.0-final
                        viniciusfernandes

                        OK, I did everything tutorial tell me to do. I defined my datasource like that:

                         

                        <datasource jta="false" jndi-name="java:jboss/datasources/infinispan" pool-name="InfinispanDS" enabled="true" use-ccm="false">

                                            <connection-url>jdbc:postgresql://localhost:5432/infinispan</connection-url>

                                            <driver>postgresql-driver</driver>

                                            <security>

                                                <user-name>postgres</user-name>

                                                <password>xxx</password>

                                            </security>

                        </datasource>

                         

                        and defined my cache as a follow:


                          <local-cache name="teams" start="EAGER" batching="false" >

                               <locking isolation="REPEATABLE_READ" acquire-timeout="20000" concurrency-level="500" striping="false" />

                               <transaction mode="NONE" />

                             <string-keyed-jdbc-store datasource="InfinispanDS" passivation="false" preload="false" purge="false">

                               <string-keyed-table prefix="JDG">

                               <id-column name="id" type="VARCHAR" />

                               <data-column name="datum" type="BINARY" />

                               <timestamp-column name="version" type="BIGINT" />

                               </string-keyed-table>

                               </string-keyed-jdbc-store>

                        </local-cache >

                         

                        I installed postgresql driver as a module like AS7 recommends to do and started up JDG running standalone.bat command line. I made a client do make consume data cached via hot rod protocol and I got it! But I think data inserted on cache through cach.put() method will be inserted on database which was defined on datasource. What I did forget to do?

                         

                        Thks...

                        • 9. Re: Problem to write data on disk with Infinispan 6.0.0-final
                          wdfink

                          First you need to check whether the module is loaded correct, you see a message that the driver is loaded.

                          After that the DS need to be installed.

                          If the cache is initialized the table should be in your DB.

                           

                          Did you see errors? Also you might enable org.infinispan=TRACE to see more information

                           

                          I suppose the <string.keyed....  datasource= will be the issue if I look to my configuration you should use "java:jboss/datasources/infinispan"

                          • 10. Re: Problem to write data on disk with Infinispan 6.0.0-final
                            viniciusfernandes

                            Just one more question: the table was created but data inserted into remote cache object there is not into table. Is there some attribute we forget?

                            • 11. Re: Problem to write data on disk with Infinispan 6.0.0-final
                              wdfink

                              For me this example hotrod-endpoint work. I did not see any problem from your configuration.

                               

                              Maybe you enable TRACE for org.infinispan for the logging subsystem in your configuration to see the SQL's.

                              Also you might try the quickstart and compare it to your's

                              • 12. Re: Problem to write data on disk with Infinispan 6.0.0-final
                                viniciusfernandes

                                Hi Wolf-Dieter, I created a named cache by doing something like that


                                new RemoteCacheManager(config, true).getCache("mycache");


                                and I everything is OK.


                                Thanks a lot...