Installation and startup of Memcache under Linux

Source: Internet
Author: User

Memcache is a high-performance, distributed memory object caching system for reducing database load and increasing access speed in dynamic applications. It is said that the official says its users, including Twitter, Digg, Flickr, and so on, are some of the biggest internet celebrities. The current use of memcache to solve large users on the Internet is a very popular use of reading.

Compile error:
libmemcached/auto.cc:in function ' memcached_return_t text_incr_decr (memcached_server_st*, bool, const char*, size_t, uint64_t, BOOL) ':
Libmemcached/auto.cc:73:error:expected ') ' Before ' PRIu64 '

In file included from./libmemcached/common.h:72,
From./libmemcached/csl/common.h:40,
From libmemcached/csl/context.cc:38:
./libmemcached-1.0/memcached.h:46:27:error:tr1/cinttypes:no such file or directory

Upgrade GCC

# yum Install gcc44 gcc44-c++ libstdc++44-devel

# Export CC=/USR/BIN/GCC44

# Export CXX=/USR/BIN/G++44

Installing libmemcached

Tar zxvf libmemcached-0.42.tar.gz

CD libmemcached-0.42
./configure–-prefix=/usr/local/libmemcached–-with-memcached
Make && make install


4. Installing the PHP memcache extension


You can use the PECL installer that comes with PHP
#/usr/local/servers/php5/bin/pecl Install Memcache


can also be installed from the source code
# tar zxf memcache-2.2.3.tgz
# CD memcache-2.2.3
#/usr/local/servers/php5/bin/phpize
#./configure--enable-memcache=/usr/local/servers/memcached--with-php-config=/usr/local/servers/php5/bin/ Php-config--with-apxs2=/usr/sbin/apxs
# Make && Make Inst


Download installation

Downloaded, I went to its official (http://memcached.org/), currently the latest download version is 1.4.5

Also need to install libevent this software, from the official (http://monkey.org/~provos/libevent/) download, the current stable version is 1.4.14.

After downloading, upload it to the/home/blue/below

Execute the following command

Copy Code
Cd/home/blue
Tar zxvf memcached-1.4.5.tar.gz
Tar zxvf libevent-1.4.14b-stable.tar.gz
#安装libevent
CD libevent-1.4.14b-stable
./configure--prefix=/home/liuzhy/libevent-1.4.14b-stable
Make
Make install

#安装memcache
cd/home/blue/memcached-1.4.5
./configure--prefix=/home/blue/memcached-1.4.5--with-libevent=/home/blue/libevent-1.4.14b
Make
Make install
Copy Code

Start the Memcache service

Enter the bin directory, execute:./memcached-d-M 1024-u Blue, but the system says a shared library is not loaded, the name of the shared library is: libevent-1.4.so.2

The first thing to look at is where the link library address memcached This command is used. Perform the following command to view:

Ld_debug=libs/usr/local/memcached/bin/memcached-v

Show Memcache from where to find libevent-1.4.so.2 this file, so, we only have to assign libevent-1.4.so.2 this file to any of the above directory. Here we assign it to/lib64/below. Make a soft connection. The command is as follows:

Ln-s/usr/local/lib/libevent-1.4.so.2/usr/lib/libevent-1.4.so.2

At the start of the Memcache service:./memcached-d-M 1024-u Blue can do it.

The following parameters of the memcached command are Ollon as follows,

Copy Code
#/usr/local/bin/memcached-d-M 200-u root-l 192.168.1.91-p 12301-c 1000-p/tmp/memcached.pid
The relevant explanations are as follows:
The-D option is to start a daemon,
-M is the amount of memory allocated to Memcache, in megabytes, 200MB
-U is the user running memcache, and if it is currently root, you need to specify the user with this parameter.
-L is the server IP address of the listener, if there are multiple addresses, I specify the IP address of the server 192.168.1.91
-P is the port that sets Memcache listening, I set here 12301, preferably more than 1024 ports
The-c option is the maximum number of concurrent connections to run, which defaults to 1024, which is set to 256
-P is set to save memcache PID file, I am here to save in/tmp/memcached.pid
To stop the memcache process:
# Kill ' Cat/tmp/memcached.pid '
You can also start multiple daemons, but the ports cannot be duplicated
Copy Code
The first "-D" parameter needs further explanation.

-D Install installation memcached
-D Uninstall Uninstall memcached
-D Start memcached service
-D Restart Restart memcached service
-D Stop Stop memcached service
-D Shutdown Stop memcached service
Check Service:

1. Check the Memcache service for startup:

Netstat-lp | grep memcached
2, check the process number of memcache (according to the process number, you can end the Memcache service: "kill-9 process number")

Ps-ef | grep memcached

Installation and startup of Memcache under Linux

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.