Questo contenuto non è disponibile nella lingua selezionata.
Chapter 2. Getting Started with Data Grid Server
Quickly set up Data Grid server and learn the basics.
2.1. Data Grid Server Requirements Copia collegamentoCollegamento copiato negli appunti!
Check host system requirements for the Data Grid server.
2.2. Downloading Server Distributions Copia collegamentoCollegamento copiato negli appunti!
The Data Grid server distribution is an archive of Java libraries (JAR
files), configuration files, and a data
directory.
Procedure
- Access the Red Hat customer portal.
- 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.
Run the
md5sum
orsha256sum
command with the server download archive as the argument, for example:sha256sum jboss-datagrid-${version}-server.zip
$ sha256sum jboss-datagrid-${version}-server.zip
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Compare with the
MD5
orSHA-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 Copia collegamentoCollegamento copiato negli appunti!
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
$ unzip infinispan-server-${version}.zip
The resulting directory is your $RHDG_HOME
.
2.4. Running Data Grid Servers Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
Launch Data Grid server with the startup script.
Procedure
-
Open a terminal in
$RHDG_HOME
. Run the
server
script.- Linux
bin/server.sh
$ bin/server.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Microsoft Windows
bin\server.bat
bin\server.bat
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
ISPN080004: Protocol SINGLE_PORT listening on 127.0.0.1:11222 ISPN080001: Data Grid Server <$version> started in <mm>ms
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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 Copia collegamentoCollegamento copiato negli appunti!
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
Install and run a new Data Grid server instance.
-
Open a terminal in
$RHDG_HOME
. Copy the root directory to
server2
.cp -r server server2
$ cp -r server server2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Open a terminal in
Specify a port offset and the location of the
server2
root directory.bin/server.sh -o 100 -s server2
$ bin/server.sh -o 100 -s server2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Check the server logs for the following messages:
2.5. Performing Operations with the Data Grid CLI Copia collegamentoCollegamento copiato negli appunti!
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 Copia collegamentoCollegamento copiato negli appunti!
Start the Data Grid CLI as follows:
-
Open a terminal in
$ISPN_HOME
. Run the CLI.
bin/cli.sh
$ bin/cli.sh [disconnected]>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5.2. Connecting to Data Grid Servers Copia collegamentoCollegamento copiato negli appunti!
Do one of the following:
Run the
connect
command to connect to a Data Grid server on the default port of11222
:[disconnected]> connect [hostname1@cluster//containers/default]>
[disconnected]> connect [hostname1@cluster//containers/default]>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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]>
[disconnected]> connect 127.0.0.1:11322 [hostname2@cluster//containers/default]>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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 Copia collegamentoCollegamento copiato negli appunti!
Use Data Grid cache templates to add caches with recommended default settings.
Procedure
Create a distributed, synchronous cache from a template and name it "mycache".
[//containers/default]> create cache --template=org.infinispan.DIST_SYNC mycache
[//containers/default]> create cache --template=org.infinispan.DIST_SYNC mycache
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipPress the tab key after the
--template=
argument to list available cache templates.Retrieve the cache configuration.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5.4. Adding Cache Entries Copia collegamentoCollegamento copiato negli appunti!
Add data to caches with the Data Grid CLI.
Prerequisites
Create a cache named "mycache" and
cd
into it.[//containers/default]> cd caches/mycache
[//containers/default]> cd caches/mycache
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Put an entry into "mycache".
[//containers/default/caches/mycache]> put hello world
[//containers/default/caches/mycache]> put hello world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipIf not in the context of a cache, use the
--cache=
parameter. For example:[//containers/default]> put --cache=mycache hello world
[//containers/default]> put --cache=mycache hello world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the entry to verify it.
[//containers/default/caches/mycache]> get hello world
[//containers/default/caches/mycache]> get hello world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5.5. Shutting Down Data Grid Servers Copia collegamentoCollegamento copiato negli appunti!
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
[//containers/default]> shutdown server $hostname
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
shutdown cluster
command to stop all servers joined to the cluster.[//containers/default]> shutdown cluster
[//containers/default]> shutdown cluster
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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
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