Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 3. Performing Batch Operations


Process operations in groups, either interactively or using batch files.

Prerequisites

  • A running Data Grid cluster.

3.1. Performing Batch Operations with Files

Create files that contain a set of operations and then pass them to the Data Grid CLI.

Procedure

  1. Create a file that contains a set of operations.

    For example, create a file named batch that creates a cache named mybatch, adds two entries to the cache, and disconnects from the CLI.

    $ cat > batch<<EOF
    create cache --template=org.infinispan.DIST_SYNC mybatch
    put --cache=mybatch hello world
    put --cache=mybatch hola mundo
    disconnect
    EOF
    Copy to Clipboard Toggle word wrap
  2. Run the CLI and specify the file as input.

    $ bin/cli.sh -c localhost:11222 -f batch
    Copy to Clipboard Toggle word wrap
  3. Create a new Data Grid CLI connection and verify mybatch.

    [//containers/default]> ls caches
    ___protobuf_metadata
    mybatch
    [//containers/default]> ls caches/mybatch
    hola
    hello
    [//containers/default]> disconnect
    [disconnected]>
    Copy to Clipboard Toggle word wrap
Note

CLI batch files support system property expansion. Strings that use the ${property} format are replaced with the value of the property system property.

3.2. Performing Batch Operations Interactively

Use the standard input stream, stdin, to perform batch operations interactively.

Procedure

  1. Start the Data Grid CLI in interactive mode.

    $ bin/cli.sh -c localhost:11222 -f -
    Copy to Clipboard Toggle word wrap
    Note

    If you do not use the -c flag, you must run the connect command.

    $ bin/cli.sh -f -
    connect
    Copy to Clipboard Toggle word wrap
  2. Run batch operations, for example:

    create cache --template=org.infinispan.DIST_SYNC mybatch
    put --cache=mybatch hello world
    put --cache=mybatch hola mundo
    disconnect
    quit
    Copy to Clipboard Toggle word wrap
Tip

Use echo to add commands in interactive mode.

The following example shows how to use echo describe to get cluster information:

$ echo describe|bin/cli.sh -c localhost:11222 -f -
{
  "name" : "default",
  "version" : "10.0.0-SNAPSHOT",
  "coordinator" : false,
  "cache_configuration_names" : [ "org.infinispan.REPL_ASYNC", "___protobuf_metadata", "org.infinispan.DIST_SYNC", "qcache", "org.infinispan.LOCAL", "dist_cache_01", "org.infinispan.INVALIDATION_SYNC", "org.infinispan.REPL_SYNC", "org.infinispan.SCATTERED_SYNC", "mycache", "org.infinispan.INVALIDATION_ASYNC", "mybatch", "org.infinispan.DIST_ASYNC" ],
  "cluster_name" : "cluster",
  "physical_addresses" : "[192.168.1.7:7800]",
  "coordinator_address" : "thundercat-34689",
  "cache_manager_status" : "RUNNING",
  "created_cache_count" : "4",
  "running_cache_count" : "4",
  "node_address" : "thundercat-47082",
  "cluster_members" : [ "thundercat-34689", "thundercat-47082" ],
  "cluster_members_physical_addresses" : [ "10.36.118.25:7801", "192.168.1.7:7800" ],
  "cluster_size" : 2,
  "defined_caches" : [ {
    "name" : "___protobuf_metadata",
    "started" : true
  }, {
    "name" : "mybatch",
    "started" : true
  } ]
}
Copy to Clipboard Toggle word wrap
Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat