Install Memcached in Ubuntu and its command explanation

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.