此内容没有您所选择的语言版本。

Chapter 2. Getting Started with Data Grid Server


Quickly set up Data Grid server and learn the basics.

2.1. Data Grid Server Requirements

Check host system requirements for the Data Grid server.

See the Red Hat Data Grid Supported Configurations.

2.2. Downloading Server Distributions

The Data Grid server distribution is an archive of Java libraries (JAR files), configuration files, and a data directory.

Procedure

  1. Access the Red Hat customer portal.
  2. Download the Red Hat Data Grid 8.0 server from the software downloads section.

Verification

Use the checksum to verify the integrity of your download.

  1. Run the md5sum or sha256sum command with the server download archive as the argument, for example:

    $ sha256sum jboss-datagrid-${version}-server.zip
  2. Compare with the MD5 or SHA-256 checksum value on the Data Grid Software Details page.

Reference

Data Grid Server README describes the contents of the server distribution.

2.3. Installing Data Grid Server

Extract the Data Grid server archive to any directory on your host.

Procedure

Use any extraction tool with the server archive, for example:

$ unzip infinispan-server-${version}.zip

The resulting directory is your $RHDG_HOME.

2.4. Running Data Grid Servers

Spin up Data Grid server instances that automatically form clusters. Learn how to create cache definitions to store your data.

2.4.1. Starting Data Grid Servers

Launch Data Grid server with the startup script.

Procedure

  1. Open a terminal in $RHDG_HOME.
  2. Run the server script.

    Linux
    $ bin/server.sh
    Microsoft Windows
    bin\server.bat

    Server logs display the following messages:

    ISPN080004: Protocol SINGLE_PORT listening on 127.0.0.1:11222
    
    ISPN080001: Data Grid Server <$version> started in <mm>ms

Hello Data Grid!

  • Open 127.0.0.1:11222 in any browser to access the Data Grid console.

Reference

Data Grid Server README describes command line arguments for the server script.

2.4.2. Verifying Data Grid Cluster Discovery

By default Data Grid servers running on the same network discover each other with the MPING protocol.

This procedure shows you how to start two Data Grid servers on the same host and verify that the cluster view.

Prerequisites

Start a Data Grid server instance on your host.

Procedure

  1. Install and run a new Data Grid server instance.

    1. Open a terminal in $RHDG_HOME.
    2. Copy the root directory to server2.

      $ cp -r server server2
  2. Specify a port offset and the location of the server2 root directory.

    $ bin/server.sh -o 100 -s server2

Verification

Check the server logs for the following messages:

INFO  [org.infinispan.CLUSTER] (jgroups-11,<server_hostname>)
ISPN000094: Received new cluster view for channel cluster:
[<server_hostname>|3] (2) [<server_hostname>, <server2_hostname>]

INFO  [org.infinispan.CLUSTER] (jgroups-11,<server_hostname>)
ISPN100000: Node <server2_hostname> joined the cluster

2.5. Performing Operations with the Data Grid CLI

Connect to servers with the Data Grid command line interface (CLI) to access data and perform administrative functions.

2.5.1. Starting the Data Grid CLI

Start the Data Grid CLI as follows:

  1. Open a terminal in $ISPN_HOME.
  2. Run the CLI.

    $ bin/cli.sh
    [disconnected]>

2.5.2. Connecting to Data Grid Servers

Do one of the following:

  • Run the connect command to connect to a Data Grid server on the default port of 11222:

    [disconnected]> connect
    [hostname1@cluster//containers/default]>
  • Specify the location of a Data Grid server. For example, connect to a local server that has a port offset of 100:

    [disconnected]> connect 127.0.0.1:11322
    [hostname2@cluster//containers/default]>
Tip

Press the tab key to display available commands and options. Use the -h option to display help text.

2.5.3. Creating Caches from Templates

Use Data Grid cache templates to add caches with recommended default settings.

Procedure

  1. Create a distributed, synchronous cache from a template and name it "mycache".

    [//containers/default]> create cache --template=org.infinispan.DIST_SYNC mycache
    Tip

    Press the tab key after the --template= argument to list available cache templates.

  2. Retrieve the cache configuration.

    [//containers/default]> describe caches/mycache
    {
      "distributed-cache" : {
        "mode" : "SYNC",
        "remote-timeout" : 17500,
        "state-transfer" : {
          "timeout" : 60000
        },
        "transaction" : {
          "mode" : "NONE"
        },
        "locking" : {
          "concurrency-level" : 1000,
          "acquire-timeout" : 15000,
          "striping" : false
        },
        "statistics" : true
      }
    }

2.5.4. Adding Cache Entries

Add data to caches with the Data Grid CLI.

Prerequisites

  • Create a cache named "mycache" and cd into it.

    [//containers/default]> cd caches/mycache

Procedure

  1. Put an entry into "mycache".

    [//containers/default/caches/mycache]> put hello world
    Tip

    If not in the context of a cache, use the --cache= parameter. For example:

    [//containers/default]> put --cache=mycache hello world
  2. Get the entry to verify it.

    [//containers/default/caches/mycache]> get hello
    world

2.5.5. Shutting Down Data Grid Servers

Use the CLI to gracefully shutdown running servers. This ensures that Data Grid passivates all entries to disk and persists state.

  • Use the shutdown server command to stop individual servers.

    [//containers/default]> shutdown server $hostname
  • Use the shutdown cluster command to stop all servers joined to the cluster.

    [//containers/default]> shutdown cluster

Verification

Check the server logs for the following messages:

ISPN080002: Data Grid Server stopping
ISPN000080: Disconnecting JGroups channel cluster
ISPN000390: Persisted state, version=<$version> timestamp=YYYY-MM-DDTHH:MM:SS
ISPN080003: Data Grid Server stopped
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.