Chapter 2. Getting Started with Data Grid Server
Quickly set up Data Grid server and learn the basics.
2.1. Data Grid Server Requirements Copy linkLink copied to clipboard!
Check host system requirements for the Data Grid server.
2.2. Downloading Server Distributions Copy linkLink copied to clipboard!
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
md5sumorsha256sumcommand with the server download archive as the argument, for example:$ sha256sum jboss-datagrid-${version}-server.zip-
Compare with the
MD5orSHA-256checksum 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 Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
Launch Data Grid server with the startup script.
Procedure
-
Open a terminal in
$RHDG_HOME. Run the
serverscript.- Linux
$ bin/server.sh- Microsoft Windows
bin\server.batServer 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:11222in 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 Copy linkLink copied to clipboard!
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
-
Open a terminal in
Specify a port offset and the location of the
server2root 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 Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
Start the Data Grid CLI as follows:
-
Open a terminal in
$ISPN_HOME. Run the CLI.
$ bin/cli.sh [disconnected]>
2.5.2. Connecting to Data Grid Servers Copy linkLink copied to clipboard!
Do one of the following:
Run the
connectcommand to connect to a Data Grid server on the default port of11222:[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]>
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 Copy linkLink copied to clipboard!
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 mycacheTipPress the tab key after the
--template=argument to list available cache templates.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 Copy linkLink copied to clipboard!
Add data to caches with the Data Grid CLI.
Prerequisites
Create a cache named "mycache" and
cdinto it.[//containers/default]> cd caches/mycache
Procedure
Put an entry into "mycache".
[//containers/default/caches/mycache]> put hello worldTipIf not in the context of a cache, use the
--cache=parameter. For example:[//containers/default]> put --cache=mycache hello worldGet the entry to verify it.
[//containers/default/caches/mycache]> get hello world
2.5.5. Shutting Down Data Grid Servers Copy linkLink copied to clipboard!
Use the CLI to gracefully shutdown running servers. This ensures that Data Grid passivates all entries to disk and persists state.
Use the
shutdown servercommand to stop individual servers.[//containers/default]> shutdown server $hostnameUse the
shutdown clustercommand 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