Install the Aerospike client
Prerequisites
For Java Client 8.0.1 and later:
If you are using JDK version 21 or later as your runtime environment (RTE):
- Specify the Aerospike Java Client package
aerospike-client-jdk21
in yourpom.xml
orbuild.gradle
build specification file.
If you are using JDK version equal to or later than 8 and earlier than 21 as your RTE:
- Specify the Aerospike Java Client package
aerospike-client-jdk8
in yourpom.xml
orbuild.gradle
build specification file.
From Aerospike Java Client version 8.0.1 and onward, the
aerospike-client-jdk21
and aerospike-client-jdk8
packages
are functionally equivalent, with equivalent APIs. The only
difference is that the aerospike-client-jdk21
package supports the
use of virtual threads and may give a throughput performance boost
for applications which use sync operations.
The developer API of the packages is the same. The packages differ in their internal implementations.
Aerospike Java Client 8.0.1+ versions contain multiple packages, each with a different JDK prerequisite:
One of the following build managers:
Build from Source Code (Optional)
The client library can optionally be built from source code. This step requires Maven. The source code is available from:
Github. Clone source code repository and build library. The default branch builds the aerospike-client-jdk21 package.
git clone git@github.com:aerospike/aerospike-client-java.git
cd aerospike-client-java
./build_allThe jdk8 branch builds the aerospike-client-jdk8 package.
git clone git@github.com:aerospike/aerospike-client-java.git
cd aerospike-client-java
git checkout jdk8
./build_all
The build installs the client library into your local Maven repository. The client package includes the following projects:
Folder | Contents |
---|---|
client | APIs and resources for building an application to communicate with the Aerospike cluster. |
examples | Example programs to build and test. |
benchmarks | Benchmark program for testing performance your Java client on the Aerospike cluster. |
Reference Client Library
Your project needs to reference the client library as a dependency. If the client library is found on your local Maven repository, that library is used. Otherwise, the client library on a remote Maven Repository is used.
Use your favorite build manager to define this dependency on the Aerospike Java client. The artifactId is aerospike-client-jdk8 or aerospike-client-jdk21 depending on your chosen JDK.
- Maven — add the following dependency to
pom.xml
:
<dependencies>
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client-jdk21</artifactId>
<version>8.0.1</version>
</dependency>
</dependencies>
- Ivy — add the following to
ivy.xml
:
<dependencies>
<dependency org="com.aerospike" name="aerospike-client-jdk21" revision="8.0.1" />
</dependencies>
- Gradle — add the following to
build.gradle
:
repositories {
mavenCentral()
}
dependencies {
compile "com.aerospike:aerospike-client-jdk21:8.0.1"
}
- SBT — add the following to
build.sbt
:
libraryDependencies += "com.aerospike" % "aerospike-client-jdk21" % "latest.integration"
- Leiningen — add the following to
project.clj
:
:dependencies [[com.aerospike/aerospike-client-jdk21 "LATEST"]]
Alternate Crypto Library
The default crypto library used in the client is GNU Crypto. To use the alternate Bouncy Castle crypto library, the artifactId is aerospike-client-bc-jdk8 or aerospike-client-bc-jdk21.
<dependencies>
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client-bc-jdk21</artifactId>
<version>8.0.1</version>
</dependency>
</dependencies>
Netty
AerospikeClient asynchronous methods now support Netty event loops in addition to direct NIO event loops. Netty is optional. To use Netty with AerospikeClient, declare netty library dependencies in your build file.
- Maven — add the following dependency to
pom.xml
:
<dependencies>
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client</artifactId>
<version>7.2.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.100.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.100.Final</version>
</dependency>
<!-- Only needed when using epoll event loops on linux -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<!-- OR -->
<classifier>linux-aarch64</classifier>
<version>4.1.100.Final</version>
</dependency>
</dependencies>