1. install memcached In Ubuntu. Use UbuntuSoftwareCenter in the graphic interface and find memcached. Click install to download and install memcached automatically. You can refer to: Install Memcachedhttp: // www.linuxidc.com/linux/2011-11/47476.htmin Ubuntu to find the memcacheddirectory. & Nbs
1. install memcached In Ubuntu. Use the Ubuntu Software Center in the graphic interface. Find memcached. Click install to automatically download and install memcached.
Install Memcached http://www.linuxidc.com/Linux/2011-11/47476.htm in Ubuntu
Enter
/Usr/share/Directory.
MemcachedDirectory. After switching to the root user, run
/Usr/share/memcached/scripts/start-memcachedTo start memcached. Run the pstree command to check whether memcached is successfully started. If memcached is successfully started, the memcached process is displayed. 2. run the memcached command to write and query key-value pairs and run Ctrl + Alt + t in another window. Use telnet to connect to the local machine to test the memcached function. Note that the default port of memcached is 11211: grid @ slavenode2 :~ $
Telnet fig 11211Trying 127.0.0.1... connected to 127.0.0.1.Escape character is '^]'. the connection is successful when you see the above display. You can test the key-value pairs written to and queried through the set and get commands: 1) write key-value pairs
Set li 0 0 3VarSTORED command explanation: set-Flag is used to specify whether to compress data, 0 does not compress, 1 compress-Expires specifies the data storage time, one method is the number of seconds (not more than 30 days ), another type can be specified with a unix timestamp. 0 is the number of bytes with an unlimited validity period-Byte value. 2) query key-value pairs.
Get liVALUE li 0 3 varEND 3. Other operations set counter 0 0 11 STORED
Incr counter 1 // auto-Increment2get counterVALUE counter 0 12END
Append counter 0 0 4 // appendTestSTOREDget counterVALUE counter 0 52 testEND
Delete counter // delete a specified key-Value PairDELETED
Flush_all // clear all key-value pairsOKget counterEND
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2