Install memcached under mac

Refer to: http://stephen830.iteye.com/blog/2009678

When writing data to the database, you first need to perform a database write operation, and then set any previously cached results affected by this write operation to invalid . This process helps prevent data inconsistencies between the cache and the database.

libevent is the only prerequisite to install memcached. It is the asynchronous event notification library that memcached relies on. You can find the source file of libevent on monkey.org. The download address of

libeven installation package is http://libevent.org/ The download address of

memcached installation package is http://memcached.org/

The newer version of libeven is libevent-2.1. 8-stable.tar.gz

The newer version of memcached is memcached-1.4.17.tar.gz

Install libeven and

extract the downloaded installation package libevent-2.1.8-stable.tar.gz to get the directory libevent-2.1.8-stable
cd libevent-2.1.8-stable  
sudo ./configure --prefix=/usr/local/libevent-2.1.8 CPPFLAGS="-I /usr/local/Cellar/openssl/1.0.2l/include" LDFLAGS="-I /usr/local/Cellar/openssl/1.0.2l/lib"
sudo make  
sudo make install  


Install memcached

Extract the downloaded installation package memcached-1.4.37.tar.gz to get the directory memcached-1.4.37

cd memcached-1.4.37  
sudo ./configure --prefix=/usr/local/memcached-1.4.37 --with-libevent=/usr/local/libevent-2.1.8  
sudo make  
sudo make install  


Run memcached

-vv parameter debug mode

Ruby code
   
sudo ./memcached -p 11211 -m 64 -u root -vv
 

-d Daemon mode
Ruby code
   
sudo ./memcached -p 11211 -m 64 -u root -d


# /usr/local/bin/memcached -d -m 200 -u root -l 192.168.1.91 -p 12301 -c 1000 -P
/tmp/memcached.pid m is the amount of memory allocated to Memcache, the unit is MB, here is 200MB -u is the user running Memcache, if it is currently root, you need to use this parameter to specify the user. -l is the IP address of the listening server. If there are multiple addresses, I have specified the IP address of the server here . The c option is the maximum number of concurrent connections running, the default is 1024, and 256 is set here -P is to set the pid file that saves Memcache, here I save it in /tmp/memcached.pid to stop the Memcache process: # kill `cat /tmp/ memcached.pid` can also start multiple daemons, but the port cannot be repeated ------------------------------- It said at the beginning The "-d" parameter needs further explanation -d install install memcached -d uninstall uninstall memcached -d start start memcached service -d restart restart memcached service























-d stop stop memcached service

-d shutdown stop memcached service

-------------------------------

Additional functions:

1. View startup Memcache service:

netstat -lp | grep memcached

2. Check the process ID of memcache (according to the process ID, you can end the memcache service: "kill -9 process ID")

ps -ef | grep memcached

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326204690&siteId=291194637
Recommended