此内容没有您所选择的语言版本。
4.6. Running Red Hat JBoss Data Grid in Karaf (OSGi)
Apache Karaf is a powerful, lightweight OSGi-based runtime container into which components and applications are deployed. OSGi implements a dynamic component model that does not exist in standalone JVM environments. OSGi containers such as Karaf include a rich set of tools for managing the life cycle of an application.
All dependencies between individual modules, including version numbers, must be explicitly specified. Where more than one class of the same name exists, the strict rules of OSGi specify which of the classes will be used by your bundle.
The Red Hat JBoss Data Grid Hot Rod client can be run in an in an OSGi-based container such as Karaf.
Use the path in the JBoss Data Grid Maven repository to set up Karaf. Additionally, JBoss Data Grid requires a
features file, located in org/infinispan/infinispan-client-hotrod/${VERSION}. This file lists all dependencies for the Hot Rod client in OSGi, while also making it simpler to install the feature into Karaf (version 2.3.3 or 3.0).
4.6.2. Installing the Hot Rod client feature in Karaf 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Red Hat JBoss Data Grid's Hot Rod feature is installed in Karaf as follows:
Prerequisite
Configure the Red Hat JBoss Data Grid Maven Repository.
Procedure 4.3. Install the Hot Rod Feature in Karaf
Karaf 2.3.3
For Karaf 2.3.3 use the following commands:karaf@root> features:addUrl mvn:org.infinispan/infinispan-client-hotrod/${VERSION}/xml/featureskaraf@root> features:install hotrod-client- Verify that the feature was successfully installed as follows:
karaf@root> features:list //output
Karaf 3.0.0
For Karaf use the following commands.karaf@root> feature:repo-add mvn:org.infinispan/infinispan-client-hotrod/${VERSION}/xml/featureskaraf@root> feature:install hotrod-client- Verify that the feature was successfully installed:
karaf@root> feature:list
Alternatively, use the-icommand parameter to install the Hot Rod Client feature using the following:karaf@root()> feature:repo-add -i mvn:org.infinispan/infinispan-client-hotrod/${VERSION}/xml/features
The Red Hat JBoss Data Grid JAR files contain the required OSGi manifest headers and are used inside OSGi runtime environments as OSGi bundles. Additionally, the required third-party dependencies must be installed. These can be installed individually, or altogether via the
features file, which defines all required dependencies.
To install bundles using the
features file:
- Register the feature repositories inside Karaf.
- Install the features contained in the repositories.
Procedure 4.4. Installing bundles using the features file
Start the Karaf console
Start the Karaf console using the following commands:$ cd $APACHE_KARAF_HOME/bin $ ./karafRegister a feature repository
Register a feature repository as follows:- For Karaf 2.3.3:
karaf@root()> features:addUrl mvn:org.infinispan/infinispan-core/${VERSION}/xml/features - For Karaf 3.0.0:
karaf@root()> feature:repo-add mvn:org.infinispan/infinispan-core/${VERSION}/xml/features
List and Install the Available Features (Karaf 3.0.0)
- Get the list of available features using the following:
karaf@root()> features:list - Install the available features.
karaf@root()> features:install
Alternatively, pass the-icommand parameter to thefeature:repo-addcommand. This installs all the features defined in that repository. For example:karaf@root()> feature:repo-add -i mvn:org.infinispan/infinispan-core/${VERSION}/xml/features
Result
JBoss Data Grid runs in library mode using Karaf.
For additional functionality, install the corresponding features. For example, to use the LevelDB CacheStore, install the features as follows:
karaf@root()> feature:repo-add -i mvn:org.infinispan/infinispan-cachestore-leveldb/${VERSION}/xml/features
The URL for feature repositories is constructed from the Maven artifact coordinates using the following format:
mvn:<groupId>/<artifactId>/<version>/xml/features
4.6.4. Feature Repositories 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Feature repositories for Red Hat JBoss Data Grid are available for the following artifacts:
- infinispan-commons
- infinispan-core
- infinispan-cachestore-jdbc
- infinispan-cachestore-leveldb
- infinispan-cachestore-remote
- infinispan-client-hotrod
Important
The JPA Cache Store is not supported in Apache Karaf in JBoss Data Grid 6.3.
Important
Querying in Library mode (which is covered in the Infinispan Query Guide) is not supported in Apache Karaf in JBoss Data Grid 6.3.