I can use Yum. But, I am going to install from source in order to get the latest builds.
libevent
Memcached requires libevent. So, get and install libevent first.
wget http://monkey.org/~provos/libevent-1.4.6-stable.tar.gz
tar zxpfv libevent*
cd libevent*
./configure
make
sudo make install
memcached
Next, install memcached.
wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar zxpfv memcached*
cd memcached*
./configure
make install
Errors . . . there is always at least one
You may get this error:
error while loading shared libraries: libevent-*: cannot open shared object file: No such file or directory
You need to create a symbolic link. For me, this is the command I needed to run. Yours may differ depending on the release you downloaded.
sudo ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib
Start memcached
memcached -d -m 64 -p 11211
"-d" runs memcached in daemon mode.
"-m" is the amount of memory memcached will use in MB's.
"-p" is the port # for memcached.
Connect to it from Rails 2.1
Rails 2.1 is awesome because of its new caching features. It can support memcached as a cache server. In order to get this to work, add/edit the following line in your config/environment.rb file. Or, you can add/edit your specific environments file, such as config/environments.development.rb file.
config.cache_store = :mem_cache_store, 'IP_ADDRESS_OF_MEMCACHED_SERVER:11211'
3 comments: