-
1. Re: How to create named cache through hotrod client?
nadirx Feb 1, 2016 2:31 AM (in response to udit-mishra-5113a21a)1 of 1 people found this helpfulWe don't yet have a fully-fledged client for doing this (but we will be adding it).
The supported way to do this is by using the management interface for the server: either the web console or the CLI.
Supposing you are using domain mode, here's how you can create a new cache based on an existing named configuration:
$ ./bin/ispn-cli.sh You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands. [disconnected /] connect [domain@localhost:9990 /] cd profile=clustered/subsystem=datagrid-infinispan/cache-container=clustered [domain@localhost:9990 cache-container=clustered] ./distributed-cache=mycache:add(configuration=default) { "outcome" => "success", "result" => undefined, "server-groups" => {"main-server-group" => {"host" => {"master" => { "server-one" => {"response" => {"outcome" => "success"}}, "server-two" => {"response" => {"outcome" => "success"}} }}}} }
The above commands has created a new distributed cache named 'mycache' using the named 'default' configuration on all nodes.
In standalone mode, the initial path is slightly different (the subsystem is at the root, not under the profile), but you will have to invoke the operation on all nodes.
-
2. Re: How to create named cache through hotrod client?
udit-mishra-5113a21a Feb 1, 2016 3:01 AM (in response to nadirx)Hello nadirx ,
I have followed the same steps, and yes it worked perfectly. I could see the new cache in the management console. Also, I saw a console message -
[Server:CollaborateServerOne] 13:15:38,931 INFO [org.jboss.as.clustering.infinispan] (MSC service thread 1-8) DGISPN0001: Started uditcache cache from CollaborateCacheContainer container
However, the domain.xml file which was there in my editor, did not get refresh. Even after closing and opening it again, did not make any change into it. That led me to the other suspicion that will that cache be available when I will restart my server. Then I restarted my server and it was not there. I'am afraid if it works like this or am I missing something?
-
3. Re: How to create named cache through hotrod client?
nadirx Feb 1, 2016 3:11 AM (in response to udit-mishra-5113a21a)Changes made to the domain configuration are persisted as soon as they are committed successfully. I've just tried locally it and it worked.
-
4. Re: How to create named cache through hotrod client?
udit-mishra-5113a21a Feb 1, 2016 4:25 AM (in response to nadirx)Alright, but its not working in my case. Till the server was up, I could do client operations with that newly created cache, but as soon as I restarted it, it got wiped out. I assume there is something wrong. Could you please tell me what should I do? Or what could be the possible reason behind this unexpected behavior?
-
5. Re: How to create named cache through hotrod client?
nadirx Feb 1, 2016 4:27 AM (in response to udit-mishra-5113a21a)Are you running in Windows ?
-
6. Re: How to create named cache through hotrod client?
nadirx Feb 1, 2016 4:37 AM (in response to nadirx)Windows has weird file locking: if you keep the file open in the editor it probably blocked the server from writing back the changes. Let me verify with ctomc who works on WildFly and is an expert Windows user, who can confirm or not my hunch.
-
7. Re: How to create named cache through hotrod client?
udit-mishra-5113a21a Feb 1, 2016 5:02 AM (in response to nadirx)I closed the editor and did the above mentioned steps. but it says failed along with the message that - System boot is in process; execution of remote management operation is currently not available.
-
8. Re: How to create named cache through hotrod client?
nadirx Feb 1, 2016 5:15 AM (in response to udit-mishra-5113a21a)All of the servers in the server group must be in their RUNNING mode.
-
9. Re: How to create named cache through hotrod client?
udit-mishra-5113a21a Feb 1, 2016 5:35 AM (in response to nadirx)nadirx I restarted everything. It gave me success message, but the main problem is still there, cache which was created does not persist.I opened the domain.xml file after shutting down the server, but no information was written in that file under <cache-container> element, which was expected. I hope if ctomc can help me out.
-
10. Re: How to create named cache through hotrod client?
galder.zamarreno Feb 8, 2016 8:49 AM (in response to udit-mishra-5113a21a)We have also created a remote JSR-107 implementation which uses underneath the Hot Rod client. One of the requirements of JCache is the ability of create caches remotely. We implemented this feature taking advantage of the remote JBoss/Wildfly management client. This class contains the logic to achieve that.
Also, I don't know about the persistence issues that you're having.
-
11. Re: How to create named cache through hotrod client?
ctomc Feb 9, 2016 10:49 AM (in response to udit-mishra-5113a21a)Udit Mishra wrote:
NadirX I restarted everything. It gave me success message, but the main problem is still there, cache which was created does not persist.I opened the domain.xml file after shutting down the server, but no information was written in that file under <cache-container> element, which was expected. I hope if ctomc can help me out.
Hey guys, sorry for late reply on this.
Windows file locking shouldn't have anything to do with what you are seeing, if problem would be file lock because of having said file open in some broken editor (that does exclusive file open) you should see some error / warning in console.log/server.log of domain controller.
maybe try with different file editor (notepad++ for example) if that would help. otherwise check if some antivirus software isn't preventing something.