Installing the Aerospike Java Client
Prerequisites
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:
Aerospike Website. Download source code package and build library.
tar xvf aerospike-client-java-{VERSION}.tgz
cd aerospike-client-java-{VERSION}
./build_allGithub. Clone source code repository and build library.
git clone git@github.com:aerospike/aerospike-client-java.git
cd aerospike-client-java
./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.
- Maven — add the following dependency to
pom.xml
:
<dependencies>
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client</artifactId>
<version>6.0.0</version>
</dependency>
</dependencies>
- Ivy — add the following to
ivy.xml
:
<dependencies>
<dependency org="com.aerospike" name="aerospike-client" revision="6.0.0" />
</dependencies>
- Gradle — add the following to
build.gradle
:
repositories {
mavenCentral()
}
dependencies {
compile "com.aerospike:aerospike-client:6.0.0"
}
- SBT — add the following to
build.sbt
:
libraryDependencies += "com.aerospike" % "aerospike-client" % "latest.integration"
- Leiningen — add the following to
project.clj
:
:dependencies [[com.aerospike/aerospike-client "LATEST"]]
Alternate Crypto Library
The default crypto library used for aerospike-client is GNU Crypto. To use the alternate Bouncy Castle crypto library, the artifactId is aerospike-client-bc instead of aerospike-client.
<dependencies>
<dependency>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-client-bc</artifactId>
<version>6.0.0</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>6.0.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.50.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.50.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.84.Final</version>
</dependency>
</dependencies>