Linux under memcached installation and startup

Source: Internet
Author: User
Tags memcached

Linux under memcached installation and startup (2013-12-18 11:12:45) reproduced
Category: Linux

Reference:

http://wangrui.iteye.com/blog/500921

http://www.monkey.org/~provos/

1. Prepare the installation files

Download installation files for memcached and libevent

Http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz (memcached)

Https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz (libevent)

2. Specific installation steps

1. Since memcached relies on libevent, it is necessary to install libevent. Since the Linux system may already have Libevent installed by default, execute the command:

Rpm-qa|grep libevent

Check to see if the system has the installation software, if there is an execution command:

Rpm-e libevent-1.4.13-4.el6.x86_64--nodeps (because the system comes with the old version, ignoring the dependency delete)

3. Install the libevent command:

Tar zxvf libevent-2.0.21-stable.tar.gz

CD libevent-2.0.21-stable

./configure--prefix=/usr/local/libevent

Make

Make install

At this point libevent installation is complete;

During installation: Configure:error:no acceptable C compiler found in $PATH error when GCC is not installed, run the following command:

Yum Install gcc* make*

4. Install the memcached command:

Tar zxvf memcached-1.4.2.tar.gz

CD memcached-memcached-1.4.2

./configure--prefix=/usr/local/memcached--with-libevent=

/usr/local/libevent/

Make

Make install

At this point memcached installation is complete;

5. Libevent.so is often not found when starting memcached, and can be checked by the following command:

Enter the/usr/local/memcached/bin directory

LD_DEBUG=help ./memcached -v

LD_DEBUG=libs  ./memcached -v

Workaround:

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

6. Start memcached

1. Open a terminal and enter the following command:

./usr/local/memcached/bin/memcached-d-M 256-u root-p 11211-c 1024–p/tmp/memcached.pid

Start parameter Description:

The-D option is to start a daemon.

-U root indicates that the user who initiated the memcached is root.

-M is the amount of memory allocated to Memcache, in megabytes, by default 64MB.

-M return error on memory exhausted (rather than removing items).

-U is the user running memcache, and if it is currently root, you need to specify the user with this parameter.

-P is the port that sets the TCP listener for memcache, preferably a port above 1024.

The-c option is the maximum number of concurrent connections to run, and the default is 1024.

-P is a PID file that is set to save Memcache.

In addition, there is a more detailed parameter description:

param code
  1. Memcached 1.4.2
  2. -P Listening TCP port (default: 11211)
  3. -U listening UDP port (default: 11211, 0 means no listening)
  4. -S UNIX socket path for listening (disable network support)
  5. -A UNIX socket access mask, octal digits (default: 0700)
  6. The IP address of the-l listener. (Default: Inaddr_any, all addresses)
  7. -D runs as a daemon.
  8. -r maximum core file limit.
  9. -U sets the user to which the process belongs. (Only the root user can use this parameter)
  10. -m maximum available memory, in megabytes, for a single data item. (Default: 64MB)
  11. -M memory is wrong with the times. (data is not deleted)
  12. -C Maximum number of concurrent connections. (Default: 1024)
  13. -K locks all memory pages. Note that you can lock the upper memory limit.
  14. Attempts to allocate more memory fail, so be aware of the user-assignable memory limit that is used when the daemon is started.
  15. (Not the previous-u parameter; under SH, use the command "ulimit-s-L num_kb" to set.) )
  16. -V Prompt message (Error/warning information is printed in the event loop.) )
  17. -VV details (also print client commands/responses)
  18. -VVV Super Details (also prints changes in the internal state)
  19. -H Print this help message and exit.
  20. -I print licenses for memcached and Libevent.
  21. -P saves the process ID to the specified file and only makes sense when the-D option is used.
  22. -F Block size growth factor. (Default: 1.25)
  23. -N The minimum space allocated to Key+value+flags (default: 48)
  24. -L attempts to use a large memory page, if available. Increasing the memory page size can reduce the number of page table buffer (TLB) misses and improve operational efficiency.
  25. In order to get a large memory page from the operating system, memcached will assign all data items to a large chunk.
  26. -D uses delimiters as prefixes and IDs.
  27. This is used to get status reports by prefix. The default is ":" (colon).
  28. If this parameter is specified, the state collection is automatically turned on, and if not specified, the command "stats detail on" is required to open.
  29. The number of threads used by-T (default: 4)
  30. -R The maximum number of requests that can be processed per connection.
  31. -C disables CAs.
  32. -B Set the length of the background log queue (default: 1024)
  33. -B Binding Protocol-possible value: Ascii,binary,auto (default)
  34. -I overrides each data page size. Adjusts the maximum size of the data item.

You can also start multiple daemons, but the ports cannot be duplicated

View memcached startup commands

PS Aux|grep memcached

Linux under memcached installation and startup

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.