Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The installation method of Memcache under Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the installation method of Memcache under Linux". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the installation method of Memcache under Linux".

Since the libevent class library is required for memcached installation, install libevent first

Libevent download website: http://www.monkey.org/~provos/libevent/

The installation steps for the libevent-1.4.8-stable.tar.gz version downloaded in this manual are as follows:

1. Decompress

Tar xzfv libevent-1.4.8-stable.tar.gz

two。 Go to the libevent-1.4.8-stable directory

Cd libevent-1.4.8-stable

3. Compile, install

. / configure

Make

Make install

Note: install to / usr/local/lib/ directory by default

Next, install memcached

Memcached download website: http://www.danga.com/memcached/download.bml

The memcached-1.2.6.tar.gz version is downloaded in this manual.

The installation steps are as follows:

1. Decompress

Tar xzfv memcached-1.2.6.tar.gz

two。 Go to the memcached-1.2.6 directory

Cd memcached-1.2.6

3. Compile, install

. / configure-- prefix=/local/memcached

Make

Make install

After the installation is complete, the bin and share directories appear in / local/memcached

Go to the bin directory and start memcache

The methods are as follows:

. / memcached-d-u nobody-m 512 127.0.0.1-p 11211

At this point, an exception will be reported

Error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

The reason is that the libevent-1.4.so.2 class library cannot be found. The solution is as follows:

Use LD_DEBUG=help. / memcached-v to determine the loaded class library path as follows:

LD_DEBUG=libs. / memcached-v 2 > & 1 > / dev/null | less

The system displays:

Linux:/local/memcached/bin # LD_DEBUG = libs. / memcached-v 2 > & 1 > / dev/null | less

20421: find library = libevent- 1.4so. 2; searching

20421: search cache = / etc/ld.so.cache

20421: search path = / lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686

/ sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib (system search path)

20421: trying file = / lib/tls/i686/sse2/libevent- 1.4so. 2

20421: trying file = / lib/tls/i686/libevent- 1.4so. 2

20421: trying file = / lib/tls/sse2/libevent- 1.4so. 2

20421: trying file = / lib/tls/libevent- 1.4so. 2

20421: trying file = / lib/i686/sse2/libevent- 1.4so. 2

20421: trying file = / lib/i686/libevent- 1.4so. 2

20421: trying file = / lib/sse2/libevent- 1.4so. 2

20421: trying file = / lib/libevent- 1.4so. 2

20421: trying file = / usr/lib/tls/i686/sse2/libevent- 1.4so. 2

20421: trying file = / usr/lib/tls/i686/libevent- 1.4so. 2

20421: trying file = / usr/lib/tls/sse2/libevent- 1.4so. 2

20421: trying file = / usr/lib/tls/libevent- 1.4so. 2

20421: trying file = / usr/lib/i686/sse2/libevent- 1.4so. 2

20421: trying file = / usr/lib/i686/libevent- 1.4so. 2

20421: trying file = / usr/lib/sse2/libevent- 1.4so. 2

20421: trying file = / usr/lib/libevent- 1.4so. 2

20421:

. / memcached: error while loading shared libraries: libevent- 1.4 .so. 2: cannot open shared object file: No such file or directory

We see that memcached will look in many places, so according to other requests, we just need to build a soft link and specify it to the class library we installed.

The methods are as follows:

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

Now you can start memcached normally.

. / memcached-d-u nobody-m 512 127.0.0.1-p 11211

At this point, you can see that memcached has been started, indicating that the installation is successful.

To end the Memcache process, execute:

# kill `cat / tmp/ Memcached.pid`

Multiple daemons can also be started, but the ports cannot be duplicated.

Description of memcache startup parameters:

The-d option is to start a daemon

-m is the amount of memory allocated to Memcache in MB, and this is 10MB.

-u is the user running Memcache. This is root.

-l is the IP address of the listening server. If there are multiple addresses, I specify the IP address of the server 192.168.0.200.

-p is the port on which Memcache snooping is set. Here, I have set up a port of more than 1024.

The-c option is the number of concurrent connections run by * *. The default is 1024. I set it here according to the load of your server.

-P is the pid file that is set to save Memcache. Here I save it in / tmp/memcached.pid

Thank you for reading, the above is the content of "the installation method of Memcache under Linux". After the study of this article, I believe you have a deeper understanding of the installation method of Memcache under Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report