Liunx System Installation Memcached

Source: Internet
Author: User
Tags memcached

First understand the difference between memcache and memcached, a letter of difference, summed up under:

What is Memcache?
Memcache is a free and open source, high performance, allocated memory object caching system. Used to accelerate dynamic Web applications and reduce database load. It can handle any number of connections, using non-blocking network IO. Since its working mechanism is to create a space in memory, and then build a hash table, memcached self-management of these hash tables.
Memcache official website:http://memcached.org/

What is memcached again?
Memcache is the project name of the system, memcached is the system's main program file (the letter D can be understood as daemon), in a daemon mode running on one or more servers, at any time accept client connection operation, using shared memory to access data. The memcached is simple and powerful. Its simple design facilitates rapid deployment, easy development of the problems faced, and solves many large data caches. Its API is available for the most popular languages.


Installation steps:

1, download memcached server-side installation files, such as version: Memcached-1.4.2.tar.gz.

2, download libevent installation files, such as version: Libevent-1.4.12-stable.tar.gz.

3, if it is a new server, using the Yum program to install the required development package (the following is the standard RPM package name), if the system has been installed without repeated installation, you can skip this step, the following steps in the course of the implementation of the prompt to install these, and then install the line.

Yum install gcc gcc-c++ gcc-g77 Flex Bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel Libpng-dev El Libtiff-devel Freetype-devel Pam-devel

4. Check that the software is installed by default on the system. If you have installed typically e bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel Select Uninstall, Because the version is low.

Rpm-qa|grep libevent #执行后如果显示了已安装版本, and the version is low, then the next uninstall; Rpm-e libevent-1.4.13-1--nodeps (ignore dependencies, file names write what you just saw)

By the Way software uninstall:

1. The uninstallation of the software is mainly done using RPM. To uninstall the software, first know the name of the package registered in the system. Type the command:
#rpm-Q-A
You can query to all packages installed on the current system.
2. Determine the name of the software to be uninstalled, you can begin to actually uninstall the software. Type the command:
#rpm-E [package name]
You can uninstall the software. The function of the parameter e is to allow the RPM to enter the Unload mode. Uninstall the package named Packages name. Because of the dependencies between the various packages in the system. If there is a dependency that cannot be uninstalled, RPM will give you a hint and stop uninstalling. You can use the following command to ignore dependencies and start unloading directly:
#rpm-E [package name]-nodeps
Ignoring dependencies may cause other software in the system to become unusable

5. Install Libevent: upload libevent-2.0.10-stable.tar.gz to server copy to/usr/local/directory (depending on your needs)

TAR-ZXF libevent-2.0.10-stable.tar.gz #当前目录执行, unzip the file. mkdir libevent #当前目录新建安装libevent文件夹. CD libevent-2.0.10-stable #进入安装文件目录./configure--prefix=/usr/local/libevent #安装到你刚刚新建的目录吧make #编译 (code variable executable) make Install #执行

6, install memcached: Upload memcached-1.4.5.tar.gz to the server copied to the/usr/local/directory (according to their own needs)

TAR-ZXF memcached-1.4.5.tar.gz #当前目录执行, unzip the file. mkdir memcached #新建安装memcache的文件夹. Note: Sometimes copying code directly from a webpage can result in an inability to execute, error message: Bash:mkdir:command not found. This is the time for you to hit it manually. CD memcached-1.4.5;. /configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libevent #必须指定 just installed libevent directory make;make install ;

7, if the memcache installed on a separate server, check whether the firewall is allowed, its default port is 11211, if the server is completely open, you do not have to configure the port access.

8. Start

/usr/local/memcached/bin/memcached-d-M 2048-u root-l 0.0.0.194-c 500-p/tmp/memcached.pid #带上用户名, this server IP.

If the startup error is as follows:

/usr/local/memcached/bin/memcached:error while loading shared libraries:libevent-2.0.so.5:cannot open Shared object fi Le:no such file or directory

Processing method:

We need to know what directories memcached to find the libevent dynamic library, and this command

#LD_DEBUG =libs/usr/local/memcached/bin/memcached-v

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6E/90/wKioL1V_-hDxewb1AAI4X2VluFE507.jpg "title=" Untitled. png "alt=" wkiol1v_-hdxewb1aai4x2vlufe507.jpg "/> Show the directory you are looking for is/usr/lib, then we need to add a soft link:

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

It's ready to start again.

9. view, close memcached

Ps-ef|grep memcache #查看其进程kill ' cat/tmp/memcached.pid ' #关闭其进程

10. Clean up the installation files:

RM libevent-2.0.10-stable.tar.gzrm MEMCACHED-1.4.5.TAR.GZRM-RF LIBEVENT-2.0.10-STABLE/RM-RF memcached-1.4.5/




Liunx System Installation Memcached

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.