Install the Aerospike client
Prerequisites
The Aerospike C client library requires the following libraries present on the machine to build and run:
Library Name | .rpm Package | Description |
---|---|---|
libssl | openssl | |
libcrypto | openssl | Required for RIPEMD160 hash function. |
To install library prerequisites using yum
:
sudo yum install openssl-devel
Some installation paths do not include the necessary C development tools. You may also need these packages:
sudo yum install gcc gcc-c++
If asynchronous functionality is desired, one of the following event frameworks must be installed.
libuv 1.15.0+
libuv has excellent performance and supports all platforms. The client also supports async TLS (SSL) sockets when using libuv.
libev 4.24+
libev has excellent performance on Linux/macOS, but its Windows implementation is suboptimal. Therefore, the C client supports libev on Linux/macOS only. The client does support async TLS (SSL) sockets when using libev.
libevent 2.1.8+
libevent is less performant than the other two options, but it does support all platforms. The client also supports async TLS (SSL) sockets when using libevent.
If a different event framework version is required, then the C client should be built from source code with that event framework version instead of following these pre-compiled library installation steps.
Download and Extract
You can download the C client package manually from the Download page. Make sure to read the release notes of the version you are downloading. Alternatively, you can automate downloading versions of the C client package from the artifact repository:
https://download.aerospike.com/artifacts/aerospike-client-c/<version>/
- Amazon Linux 2023
Package | Description |
---|---|
aerospike-client-c_{VERSION}_amzn2_{ARCH}.tgz | sync commands |
aerospike-client-c-libuv_{VERSION}_amzn2_{ARCH}.tgz | sync and async commands with libuv |
aerospike-client-c-libev_{VERSION}_amzn2_{ARCH}.tgz | sync and async commands with libev |
aerospike-client-c-libevent_{VERSION}_amzn2_{ARCH}.tgz | sync and async commands with libevent |
Extract the contents of the chosen package:
tar xvf <package>
Example
tar xvf aerospike-client-c-libuv_6.4.1_amzn2_x86_64.tgz
cd aerospike-client-c-libuv_6.4.1_amzn2_x86_64
Contents
The package contains the following installer packages:
- Amazon Linux 2023
aerospike-client-c[-{EVENTLIB}]-devel-{VERSION}-1.amzn2.{ARCH}.rpm
Aerospike C client development (static library and header files) installer for given version and event framework library. This installer is used for developers when compiling/linking their applications with the Aerospike client library.
aerospike-client-c[-{EVENTLIB}]-{VERSION}-1.amzn2.{ARCH}.rpm
Aerospike C client runtime (shared library) installer for given version and event framework library.
Install
Install one development package to compile your application with Aerospike client. Install corresponding runtime package to run your application with Aerospike client.
sudo rpm -i <installer package>
Example
- Amazon Linux 2023
sudo rpm -i aerospike-client-c-libuv-devel-6.4.1-1.amzn2.x86_64.rpm
sudo rpm -i aerospike-client-c-libuv-6.4.1-1.amzn2.x86_64.rpm
Development files install in:
/usr/include/aerospike
/usr/include/citrusleaf
/usr/lib/libaerospike.a
Runtime files install in:
/usr/lib/libaerospike.so
Building Applications with Event Library
Event libraries usually install into /usr/local/lib. Most operating systems do not
search /usr/local/lib by default. Therefore, the following LD_LIBRARY_PATH
setting
may be necessary.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
When compiling your async applications with aerospike header files, the event library
must be defined (-DAS_USE_LIBUV
or -DAS_USE_LIBEV
or -DAS_USE_LIBEVENT
) on the
command line or in an IDE. Example:
gcc -DAS_USE_LIBUV -o myapp myapp.c -laerospike -lev -lssl -lcrypto -lpthread -lm -lz