Can third party libraries be preloaded with Aerospike

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

Can third party libraries be preloaded with Aerospike?

Question:

In some circumstances it may be desirable to use a third party library, for socket management for example. How can this be done with the Aerospike server?

Answer:

This can be done using the LD_PRELOAD environment variable. LD_PRELOAD, when set to the path of a shared object, will load that object before any other libary. The following line in /etc/init.d/aerospike shows that LD_PRELOAD will be retained if set when starting Aerospike.

if [ -n $LD_PRELOAD ]; then export LD_PRELOAD; fi

As /etc/init.d/aerospike spawns a sub-shell, the value for LD_PRELOAD would need to be exported to sub-shells as well as set in the environment to be respected. An example in the bash shell would be:

$ export LD_PRELOAD=/your/special/library.so

Note:

Unless stated explictly in Aerospike documentation, third party libraries used in this manner have not been certified with Aerospike and, as such, behaviour may not be guaranteed.