Install Memcached in Ubuntu

Source: Internet
Author: User
Tags php define mediawiki
Memcached is a free, open-source (BSDlicense authorization), high-performance distributed object memory cache system. It was developed for LiveJournal by DangaInteractive, but is currently used by many software such as MediaWiki. Memcached is widely used for caching dynamic data, which can greatly reduce the load and pressure on the database and improve the database system performance.

Memcached is a free, open-source (BSD license authorization), high-performance distributed object memory cache system. It was developed for LiveJournal by Danga Interactive, but it is currently developed by many software such as MediaWiki) used. Memcached is widely used for caching dynamic data, which can greatly reduce the load and pressure on the database and improve the database system performance.

Memcached is a free, open-source (BSD license authorization), high-performance distributed object memory cache system. It was developed for LiveJournal by Danga Interactive, but it is currently developed by many software such as MediaWiki) used. Memcached is widely used for caching dynamic data, which can greatly reduce the load and pressure on the database, improve the performance and capacity of the database system, and greatly increase the efficiency and speed of dynamic web pages.

Memcached lacks authentication and security control, which means that the Memcached server should be placed behind the firewall.

Memcached has client Development kits in multiple languages, including Perl/PHP/JAVA/C/Python/Ruby/C #/MySQL/

1. Install Memcached

A. Compile and install the SDK through source code
  
Before compiling, check whether gcc, make, patch, and other compilation tools are installed and can be used properly.

Install Libevent

Libevent is an asynchronous event processing software function library, which is released under the BSD license. Memcached depends on Libevent. Therefore, you must first compile and install Libevent.

wget http://www.monkey.org/~provos/libevent-2.0.13-stable.tar.gztar xzvf  libevent-2.0.13-stable.tar.gz./configuremakemake install

Install Memcached

wget http://memcached.googlecode.com/files/memcached-1.4.7.tar.gztar xvzf memcached-1.4.7.tar.gz cd memcached-1.4.7./configure --prefix=/usr/local/memcached/makemake install

Create a soft link

ln -s /usr/local/lib/libevent-2.0.so.5 /lib/libevent-2.0.so.5

Note: If you do not create this soft link, starting memcached may report. /memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory errors. This is because memcached cannot locate the libevent library, and the default installation directory of libevent is/usr/local/lib/libevent-2.0.so.5, so here you create a soft chain to solve this problem.

In addition, I used the-with-libevent parameter to specify the libevent location during compilation. This problem still exists during startup.

Start memcache

./memcached -d -m 64 -p 11211 -l 127.0.0.1 -u nobody -c 1024

Memcached common startup parameters:

-D: Start a daemon.-m: The number of memories allocated to Memcache. The unit is MB. The default value is 64 MB.-u: the user who runs Memcache-l: listening Server IP address-p: Set the Memcache listening port. The default value is 11211. Note:-p (p is lower case)-c: set the maximum number of concurrent connections. The default value is 1024-P: set the pid file for saving Memcache. Note:-P (P is capital)-h displays help

B. Install the SDK through the APT package

apt-get install memcached

Ii. Install Memcache Manager

A. Prepare the environment

Install the Memcache Client

Method 1: Install the SDK through APT

apt-get install php5-memcache

Method 2: Install by using pecl

pecl install memcache

Restart Apache

/etc/init.d/apache2 restart

B. Install MemAdmin

MemAdmin is a visualized Memcached management and monitoring tool. It is developed using PHP and is small in size and easy to operate.

Main functions: Server parameter monitoring: Real-Time refresh of STATS, SETTINGS, ITEMS, SLABS, and SIZES. Server performance monitoring: real-time monitoring of hit rates of common operations such as GET, DELETE, INCR, DECR, and CAS. Supports data traversal to facilitate monitoring of stored content. Conditional queries are supported to filter out keys or values that meet the conditions. Array, JSON, and other Serialized character deserialization display. Other services compatible with the memcache protocol, such as Tokyo Tyrant (excluding the traversal function ). Supports server connection pools, facilitating and simplifying multi-server management switching.

Install

wget http://www.junopen.com/memadmin/memadmin-1.0.5.tar.gztar xvzf memadmin-1.0.5.tar.gz cp -r  memadmin /var/www/

Configure the access user

Vi memadmin/config. php # modify the user name and password as needed $ config ['user'] = "admin"; // your username $ config ['passwd'] = "admin "; // your password

Access https: // domain name (or IP)/memadmin/index. php, and enter the user name/password to access it.

C. Install Memcachepphp

Memcachepphp is also a WEB management tool. This program has only one file and is easy to deploy. Memcachepphp provides the following functions: manage multiple memcache servers, view memory usage of each server in real time, View cache hits in real time, View cache content directly, and delete specified cache items.

Install

wget http://livebookmark.net/memcachephp/memcachephp.zipunzip  memcachephp.zipcp memcache.php /var/www/

Configure Memcachepphp

Modify the user name, password, and memcache server address as needed

vi memcache.php define(‘ADMIN_USERNAME’,'memcache’);     // Admin Usernamedefine(‘ADMIN_PASSWORD’,'password’);    // Admin Passworddefine(‘DATE_FORMAT’,'Y/m/d H:i:s’);define(‘GRAPH_SIZE’,200);define(‘MAX_ITEM_DUMP’,50);$MEMCACHE_SERVERS[] = ‘localhost:11211′; // add more as an array//$MEMCACHE_SERVERS[] = ‘mymemcache-server2:11211′; // add more as an array

Access https: // domain name (or IP)/memadmin/index. php, and enter the user name/password to access it.

Original article address: Install Memcached In Ubuntu. Thank you for sharing it with me.

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.