Can third party libraries be preloaded with Aerospike


#1

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.