此内容没有您所选择的语言版本。
27.3. CLI Commands
			Unless specified otherwise, all listed commands for the JBoss Data Grid CLIs can be used with both the Library Mode and Server Mode CLIs. Specifically, the 
deny (see Section 27.3.8, “The deny Command”), grant (see Section 27.3.14, “The grant Command”), and roles (see Section 27.3.19, “The roles command”) commands are only available on the Server Mode CLI.
		27.3.1. The abort Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
abort command aborts a running batch initiated using the start command. Batching must be enabled for the specified cache. The following is a usage example:
	[jmx://localhost:12000/MyCacheManager/namedCache]> start [jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> abort [jmx://localhost:12000/MyCacheManager/namedCache]> get a null
[jmx://localhost:12000/MyCacheManager/namedCache]> start
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> abort
[jmx://localhost:12000/MyCacheManager/namedCache]> get a
null
27.3.2. The begin Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
begin command starts a transaction. This command requires transactions enabled for the cache it targets. An example of this command's usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> begin [jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> put b b [jmx://localhost:12000/MyCacheManager/namedCache]> commit
[jmx://localhost:12000/MyCacheManager/namedCache]> begin
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put b b
[jmx://localhost:12000/MyCacheManager/namedCache]> commit
27.3.3. The cache Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
cache command specifies the default cache used for all subsequent operations. If invoked without any parameters, it shows the currently selected cache. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> cache ___defaultcache [jmx://localhost:12000/MyCacheManager/___defaultcache]> cache ___defaultcache [jmx://localhost:12000/MyCacheManager/___defaultcache]>
[jmx://localhost:12000/MyCacheManager/namedCache]> cache ___defaultcache
[jmx://localhost:12000/MyCacheManager/___defaultcache]> cache
___defaultcache
[jmx://localhost:12000/MyCacheManager/___defaultcache]>
27.3.4. The clearcache Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
clearcache command clears all content from the cache. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> clearcache [jmx://localhost:12000/MyCacheManager/namedCache]> get a null
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> clearcache
[jmx://localhost:12000/MyCacheManager/namedCache]> get a
null
27.3.5. The commit Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
commit command commits changes to an ongoing transaction. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> begin [jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> put b b [jmx://localhost:12000/MyCacheManager/namedCache]> commit
[jmx://localhost:12000/MyCacheManager/namedCache]> begin
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put b b
[jmx://localhost:12000/MyCacheManager/namedCache]> commit
27.3.6. The container Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
container command selects the default cache container (cache manager). When invoked without any parameters, it lists all available containers. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> container MyCacheManager OtherCacheManager [jmx://localhost:12000/MyCacheManager/namedCache]> container OtherCacheManager [jmx://localhost:12000/OtherCacheManager/]>
[jmx://localhost:12000/MyCacheManager/namedCache]> container
MyCacheManager OtherCacheManager
[jmx://localhost:12000/MyCacheManager/namedCache]> container OtherCacheManager
[jmx://localhost:12000/OtherCacheManager/]>
27.3.7. The create Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
create command creates a new cache based on the configuration of an existing cache definition. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> create newCache like namedCache [jmx://localhost:12000/MyCacheManager/namedCache]> cache newCache [jmx://localhost:12000/MyCacheManager/newCache]>
[jmx://localhost:12000/MyCacheManager/namedCache]> create newCache like namedCache
[jmx://localhost:12000/MyCacheManager/namedCache]> cache newCache
[jmx://localhost:12000/MyCacheManager/newCache]>
27.3.8. The deny Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		When authorization is enabled and the role mapper has been configured to be the ClusterRoleMapper, principal to role mappings are stored within the cluster registry (a replicated cache available to all nodes). The 
deny command can be used to deny roles previously assigned to a principal:
	[remoting://localhost:9999]> deny supervisor to user1
[remoting://localhost:9999]> deny supervisor to user1
Note
			The 
deny command is only available to the JBoss Data Grid Server Mode CLI.
		27.3.9. The disconnect Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
disconnect command disconnects the currently active connection, which allows the CLI to connect to another instance. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> disconnect [disconnected//]
[jmx://localhost:12000/MyCacheManager/namedCache]> disconnect
[disconnected//]
27.3.10. The encoding Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
encoding command sets a default codec to use when reading and writing entries to and from a cache. If invoked with no arguments, the currently selected codec is displayed. An example of its usage is as follows:
	27.3.11. The end Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
end command ends a running batch initiated using the start command. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> start [jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> end [jmx://localhost:12000/MyCacheManager/namedCache]> get a a
[jmx://localhost:12000/MyCacheManager/namedCache]> start
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> end
[jmx://localhost:12000/MyCacheManager/namedCache]> get a
a
27.3.12. The evict Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
evict command evicts an entry associated with a specific key from the cache. An example of it usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> evict a
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> evict a
27.3.13. The get Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
get command shows the value associated with a specified key. For primitive types and Strings, the get command prints the default representation. For other objects, a JSON representation of the object is printed. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> get a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> get a
a
27.3.14. The grant Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		When authorization is enabled and the role mapper has been configured to be the 
ClusterRoleMapper, the principal to role mappings are stored within the cluster registry (a replicated cache available to all nodes). The grant command can be used to grant new roles to a principal as follows:
	[remoting://localhost:9999]> grant supervisor to user1
[remoting://localhost:9999]> grant supervisor to user1
Note
			The 
grant command is only available to the JBoss Data Grid Server Mode CLI.
		27.3.15. The info Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
info command displays the configuration of a selected cache or container. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> info
GlobalConfiguration{asyncListenerExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@98add58}, asyncTransportExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@7bc9c14c}, evictionScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@7ab1a411}, replicationQueueScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@248a9705}, globalJmxStatistics=GlobalJmxStatisticsConfiguration{allowDuplicateDomains=true, enabled=true, jmxDomain='jboss.infinispan', mBeanServerLookup=org.jboss.as.clustering.infinispan.MBeanServerProvider@6c0dc01, cacheManagerName='local', properties={}}, transport=TransportConfiguration{clusterName='ISPN', machineId='null', rackId='null', siteId='null', strictPeerToPeer=false, distributedSyncTimeout=240000, transport=null, nodeName='null', properties={}}, serialization=SerializationConfiguration{advancedExternalizers={1100=org.infinispan.server.core.CacheValue$Externalizer@5fabc91d, 1101=org.infinispan.server.memcached.MemcachedValue$Externalizer@720bffd, 1104=org.infinispan.server.hotrod.ServerAddress$Externalizer@771c7eb2}, marshaller=org.infinispan.marshall.VersionAwareMarshaller@6fc21535, version=52, classResolver=org.jboss.marshalling.ModularClassResolver@2efe83e5}, shutdown=ShutdownConfiguration{hookBehavior=DONT_REGISTER}, modules={}, site=SiteConfiguration{localSite='null'}}
[jmx://localhost:12000/MyCacheManager/namedCache]> info
GlobalConfiguration{asyncListenerExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@98add58}, asyncTransportExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@7bc9c14c}, evictionScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@7ab1a411}, replicationQueueScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@248a9705}, globalJmxStatistics=GlobalJmxStatisticsConfiguration{allowDuplicateDomains=true, enabled=true, jmxDomain='jboss.infinispan', mBeanServerLookup=org.jboss.as.clustering.infinispan.MBeanServerProvider@6c0dc01, cacheManagerName='local', properties={}}, transport=TransportConfiguration{clusterName='ISPN', machineId='null', rackId='null', siteId='null', strictPeerToPeer=false, distributedSyncTimeout=240000, transport=null, nodeName='null', properties={}}, serialization=SerializationConfiguration{advancedExternalizers={1100=org.infinispan.server.core.CacheValue$Externalizer@5fabc91d, 1101=org.infinispan.server.memcached.MemcachedValue$Externalizer@720bffd, 1104=org.infinispan.server.hotrod.ServerAddress$Externalizer@771c7eb2}, marshaller=org.infinispan.marshall.VersionAwareMarshaller@6fc21535, version=52, classResolver=org.jboss.marshalling.ModularClassResolver@2efe83e5}, shutdown=ShutdownConfiguration{hookBehavior=DONT_REGISTER}, modules={}, site=SiteConfiguration{localSite='null'}}
27.3.16. The locate Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
locate command displays the physical location of a specified entry in a distributed cluster. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> locate a [host/node1,host/node2]
[jmx://localhost:12000/MyCacheManager/namedCache]> locate a
[host/node1,host/node2]
27.3.17. The put Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
put command inserts an entry into the cache. If a mapping exists for a key, the put command overwrites the old value. The CLI allows control over the type of data used to store the key and value. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put b 100
[jmx://localhost:12000/MyCacheManager/namedCache]> put c 4139l
[jmx://localhost:12000/MyCacheManager/namedCache]> put d true
[jmx://localhost:12000/MyCacheManager/namedCache]> put e { "package.MyClass": {"i": 5, "x": null, "b": true } }
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put b 100
[jmx://localhost:12000/MyCacheManager/namedCache]> put c 4139l
[jmx://localhost:12000/MyCacheManager/namedCache]> put d true
[jmx://localhost:12000/MyCacheManager/namedCache]> put e { "package.MyClass": {"i": 5, "x": null, "b": true } }
		Optionally, the 
put can specify a life span and maximum idle time value as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> put a a expires 10s [jmx://localhost:12000/MyCacheManager/namedCache]> put a a expires 10m maxidle 1m
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a expires 10s
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a expires 10m maxidle 1m
27.3.18. The replace Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
replace command replaces an existing entry in the cache with a specified new value. An example of its usage is as follows:
	27.3.19. The roles command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		When authorization is enabled and the role mapper has been configured to be the 
ClusterRoleMapper, the principal to role mappings are stored within the cluster registry (a replicated cache available to all nodes). The roles command can be used to list the roles associated to a specific user, or to all users if one is not given:
	[remoting://localhost:9999]> roles user1 [supervisor, reader]
[remoting://localhost:9999]> roles user1
[supervisor, reader]
Note
			The 
roles command is only available to the JBoss Data Grid Server Mode CLI.
		27.3.20. The rollback Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
rollback command rolls back any changes made by an ongoing transaction. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> begin [jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> put b b [jmx://localhost:12000/MyCacheManager/namedCache]> rollback
[jmx://localhost:12000/MyCacheManager/namedCache]> begin
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put b b
[jmx://localhost:12000/MyCacheManager/namedCache]> rollback
27.3.21. The site Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
site command performs administration tasks related to cross-datacenter replication. This command also retrieves information about the status of a site and toggles the status of a site. An example of its usage is as follows:
	27.3.22. The start Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
start command initiates a batch of operations. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> start [jmx://localhost:12000/MyCacheManager/namedCache]> put a a [jmx://localhost:12000/MyCacheManager/namedCache]> put b b [jmx://localhost:12000/MyCacheManager/namedCache]> end
[jmx://localhost:12000/MyCacheManager/namedCache]> start
[jmx://localhost:12000/MyCacheManager/namedCache]> put a a
[jmx://localhost:12000/MyCacheManager/namedCache]> put b b
[jmx://localhost:12000/MyCacheManager/namedCache]> end
27.3.23. The stats Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
stats command displays statistics for the cache. An example of its usage is as follows:
	27.3.24. The upgrade Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
upgrade command implements the rolling upgrade procedure. For details about rolling upgrades, refer to Chapter 36, Rolling Upgrades.
	
		An example of the 
upgrade command's use is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> upgrade --synchronize=hotrod --all [jmx://localhost:12000/MyCacheManager/namedCache]> upgrade --disconnectsource=hotrod --all
[jmx://localhost:12000/MyCacheManager/namedCache]> upgrade --synchronize=hotrod --all
[jmx://localhost:12000/MyCacheManager/namedCache]> upgrade --disconnectsource=hotrod --all
27.3.25. The version Command 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
		The 
version command displays version information for the CLI client and server. An example of its usage is as follows:
	[jmx://localhost:12000/MyCacheManager/namedCache]> version Client Version 5.2.1.Final Server Version 5.2.1.Final
[jmx://localhost:12000/MyCacheManager/namedCache]> version
Client Version 5.2.1.Final
Server Version 5.2.1.Final