Install Memcached in Ubuntu and its command explanation

Source: Internet
Author: User

1. install memcached In Ubuntu. Use the Ubuntu Software Center in the graphic interface. Find memcached. Click install to automatically download and install memcached.

For more information, see install Memcached In Ubuntu.

After the installation is complete, enter the/usr/share/directory to find the memcached directory. After switching to the root user, run/usr/share/memcached/scripts/start-memcached to 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 127.0.0.1 11211 Trying 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 write key-value pairs and query key-value pairs through the set and get commands: 1) the write key-value pair set li 0 0 3 varSTORED 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 (up to 30 days ), another type can be specified with a unix timestamp. 0 is the number of bytes that are valid for an unlimited period of time-Byte. 2) query the key-value pair get liVALUE li 0 3 varEND 3. other operations set counter 0 0 11 STOREDincr counter 1 // auto-incrementing 2get counterVALUE counter 0 12 ENDappend counter 0 0 4 // append testSTOREDget counterVALUE counter 0 52 testENDdelete counter // Delete the specified key value DELETED flush_all // clear all key-value pairs OKget counterEND

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.