I have installed memcache for a Drupal site with the memcached pecl extension. It's all running fine but I'm still struggling with the configuration settings.
For instance , following advice on drupal.org
You should probably lock down the memcache server so that it only listens for
connections from the hosts that need to be served, as the default is that
memcache listens to connections from all addresses.
So, to close that hole, edit /etc/sysconfig/memcached with:
OPTIONS="-l ${HOSTIP}"
Problem is that I don't have this file on my server, in any case not at this location. Some other articles have mentioned /etc/memcached.conf but I can't find this file either.
Considering that the /etc/sysconfig/memcached or /etc/memcached.conf do not exit on my server, can I safely create them? Is it possible for these files to be situated somewhere else, in which case where should I look or is there any way to find that info?
Finally , any resources, tutorials or documentation links would be greatly appreciated. I've browsed thru memcache's site Wiki, and could only find a couple of relevant articles for beginners.
You did not tell us about your OS/distro. Also, you did not tell us how you installed memcached.
Usually, you will get a sample config file under
/etc/
when you install memcached usingapt-get
under debian-based systems andrpm
oryum
under redhat, fedora or centos.If you installed it from source, you may not get a sample file under
/etc/
(I did not install memcached from source myself). However, you can look for a sample config file in the unpacked source folder.Anyway, you can use
locate memcached.conf
to look for one in your system. You need to dosudo updatedb
before that to update the search cache.Here is the config file from my system. You can use it:
You can also pass the same options from the command line.
The default (CentOS) /etc/sysconfig/memcached:
The init script (CentOS) /etc/init.d/memcached:
The above amounts to, if the file exists, 'source' it (i.e. read and evaluate its contents).
As far as I know, memcached does not have a configuration file. It uses command line parameters, for example (from a RHEL/CentOS init script):
(You'll note that the variables defined above, are used here).
The bottom line, therefore, is:
If you can't find on CentOS /etc/init.d/memcached try this:
and change:
to:
After add in /etc/sysconfig/memcached
Restart memcached
To check if parameter is added try: