Step 1: first install Lib-Event
Download the package http://libevent.org for Lib-event/
Decompress and install
- ./Configure-Prefix =/usr(Or./Configure-- Program-Prefix =/usr)
- Make
- MakeInstall
Step 2: Install memcached
Download memcached pack http://www.memcached.org/downloads
Decompress and install
1../configure
2. Make
3. Make install
Run the LS-Al/usr/local/bin/MEM * command to check whether the installation is successful.
By default, memcached is installed in/usr/local/bin.
Start memcached server and start it in the installation directory.
/Usr/local/bin/memcached-D-M 10-u root-l 127.0.0.1-P 11211-C 256-P/tmp/memcached. PID
[Email protected]:/home/chiwei/Disk/service # ls
[Email protected]:/home/chiwei/Disk/service # ls-Al/usr/local/bin/memcached
-Rwxr-XR-x 1 Root 495978 July 23 16:16/usr/local/bin/memcached
[Email protected]:/home/chiwei/Disk/service # cd/usr/local/bin/me
-Su: CD:/usr/local/bin/me: the file or directory does not exist.
[Email protected]:/home/chiwei/Disk/service # cd/usr/local/bin/
[Email protected]:/usr/local/bin # ls
Memcached
[Email protected]:/usr/local/bin #./memcached-D-C 1024-l 127.0.0.1-P 10101-M 1024-u Root
[Email protected]:/usr/local/bin # telnet 127.0.0.1 10101
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape Character is '^]'.
Stats
Stats to view the status, flush_all: Clear the basic command for viewing the memcached status in the cache. Through this command, you can see the following information: stat PID 22459 process idstat uptime 1027046 Server Run seconds stat time 1273043062 server current UNIX timestamp stat version 1.4.4 server version stat pointer_size 64 operating system word size (this server is 64-bit) stat rusage_user 0.040000 process cumulative user time stat rusage_system 0.260000 process cumulative system time stat curr_connections 10 number of currently open connections stat total_connections 82 number of previously opened connections stat connection_structures 13 Number of connection structures allocated by the server stat cmd_get 54 total number of get commands executed stat cmd_set 34 Total number of set commands executed stat cmd_flush 3 Total number of times flush_all commands stat get_hits 9 get hits stat get_misses 45 get misses stat delete_misses 5 delete misses stat delete_hits 1 Delete hits stat incr_misses 0 incr misses stat incr_hits 0 incr hits stat decr_misses 0 decr misses stat decr_hits 0 decr hits stat cas_misses 0 CAS misses stat cas_hits 0 CAS hit count stat cas_badval 0 use wipe count stat auth_cmds 0 stat auth_errors 0 stat bytes_read 15785 read bytes total stat bytes_written 15222 write bytes total stat limit_maxbytes 1048576 allocated memory (bytes) stat accepting_conns 1 currently accepts connections stat listen_disabled_num 0 stat threads 4 threads stat conn_yields 0 stat bytes 0 storage item Byte Count stat curr_items 0 item count stat total_items 34 Total item count stat evictions 0 is obtains the total number of items deleted from a space.
Test
Telenet 127.0.0.1 10101
After the connection is successful, you can use
When you disable the memcached service, first view the TMP folder
[Email protected]: ~ # Ls
[Email protected]: ~ # Cd/tmp/
[Email protected]:/tmp # ls
Qtsingleapp-chines-1a7c-3e8-lockfile for aptdaemon-wmcjdf
Bjydjbu3ux RPC % 0049d % 0043ache. Data
Decgylp7oi SMS % 0043ache. Data
Fcitx-socket-: 0 sni-qt_chinese-calendar_2043-z3cOqS
Sni-qt_sogou-qimpanel_2248-fTSQLu
Hsperfdata_root sogou-qimpanel: 0.pid
Indicator-china-weather-1000.pid sogou-qimpanelchiwei
JNA ssh-Wcoq8f0CINjL
Memcached. PID unity_support_test.1
Qtsingleapp-chines-1a7c-3e8
There is a PID file for saving memcache
Kill the dot symbol in the upper left corner of the 'cat/tmp/memcached. Pi' keyboard
Or
[Email protected]: ~ # Ps-Ef | grep memcached
Root 24915 1584 0? 00:00:00./memcached-D-C 1024-l 127.0.0.1-P 10101-M 1024-u Root
Root 25011 10370 0 00:00:00 pts/15 grep -- color = auto memcached
[Email protected]: ~ # Killed 24915
[Email protected]: ~ # Telnet 127.0.0.1 10101
Trying 127.0.0.1...
TELNET: Unable to connect to remote host: Connection refused
[Email protected]: ~ #
Memcached specific use, refer to the http://www.cnblogs.com/czh-liyu/archive/2010/04/27/1722084.html
Memcached ProtocolClick Open Link
Install and use memcached in ubuntu14