Distributed setup of:
- ccache
- memcached
- distcc/distccd
By default the servers will only listen to 127.0.0.1 (localhost), so you will need to change to 0.0.0.0 (wildcard) or suitable subset.
Edit the server configuration on each, in:
/etc/default/distcc
/etc/memcached.conf
Make sure to restart the services afterwards.
You will need to define your servers:
$ export DISTCC_HOSTS="<distccd>"
$ export MEMCACHED_SERVERS="<memcached>"
Configure your ccache with memcached support:
$ export CCACHE_PREFIX=distcc
$ export CCACHE_MEMCACHED_CONF=--SERVER=<memcached>:11211
And your compiler cache should now be distributed!
When using ccache "run_second_cpp" (which is now the default), you will need to run distcc in pump mode - for multiple files.
$ export DISTCC_HOSTS="<distccd>,lzo,cpp"
$ eval `distcc-pump --startup`
$ make -j80
$ distcc-pump --shutdown
Otherwise distcc will precompile your files, before sending them over the network to the actual compile server, regardless.
It is possible to run a local moxi server, that will proxy the actual network requests to the actual memcached server(s).
Doing so means higher performance by caching in local memory, and also being less susceptible to transient network errors.
$ sudo service moxi-server start
$ export CCACHE_MEMCACHED_CONF=--SERVER=localhost:11211
For the impatient, here's a Vagrantfile to do it for you.