[NOSQL] Getting started with Memcache

Source: Internet
Author: User

Apsaradb for Memcache is a temporary key-value storage NoSQL database. In the past, it was widely used on Internet websites as a cache layer between applications and databases (it has been replaced by Redis ), it was initially developed by Danga Interactive to speed up LiveJournal access, and later became an open source project widely used, Official Website: http://memcached.org/

Memcache features

  • Full Memory Operation
  • Hash Storage
  • Simple text protocol for data communication
  • Operations on bytes data. Other types of data are explained by the application and support serialization and deserialization.
  • The cluster is also controlled by the application and adopts the consistent hash algorithm.
Install and start Memcache:
[root@lx61 ~]# yum install memcached

Start:

[root@lx61 ~]# /etc/init.d/memcached startStarting memcached: [  OK  ]
The default listener port is 11211:

[root@lx61 ~]# ps -ef|grep memcache101      21341     1  0 13:38 ?        00:00:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid

Memcache acts as the database cache

Memcache is mainly used as a database cache. When it is used as a database cache, the process for applications to access the database is as follows:

1) before accessing the database, check whether the key in memcache is the SQL statement.

2) If yes, use its value as the query result, which can reduce the access pressure on the database.

3) If no, access the database and put the retrieved results (value) and corresponding SQL statement (key) into memcached.

High Availability solution-repcached

/Usr/local/bin/repcached-p 11211-v
/Usr/local/bin/repcached-p 11212-x localhost-v-d
Do not run as root


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.