0. this document describes how to install and deploy the memcached service operating system in linux: RedHatEnterpriseLinuxServerrelease5.4 (Tikanga) memory: 4G1. verify whether gcc is installed by running gcc-v on the command line to check whether gcc version information is output. If not, notify the O & M personnel to install it. Attachment: output during normal gcc installation [root @ TY
0. Before the start
This document describesLinuxInstall and deploy the memcached service in the environment
Operating System:
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Memory: 4 GB
1. Verify that gcc is installed
Execute gcc-v on the command line to check whether the gcc version is output. If no gcc version is available, notify the O & M personnel to install
Appendix: output during normal gcc Installation
[Root @ tyff000001 bin] # gcc-v
Using built-in specs.
Target: x86_64-RedHat-linux
Configured :.. /configure -- prefix =/usr -- mandir =/usr/share/man -- infodir =/usr/share/info -- enable-shared -- enable-threads = posix -- enable-checking = release -- with-system-zlib -- enable-_ cxa_atexit -- disable-libunwind-exceptions -- enable-libgcj-multifile -- enable-versions ages = c, c ++, objc, obj-c ++, java, fortran, ada -- enable-java-awt = gtk -- disable-dssi -- enable-plugin -- with-java-home =/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre -- with-cpu = generic -- host = x86_64-redhat-linux
Thread model: posix
Gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
[Root @ tyff000001 bin] #
2. Download The memcached source code package
Http://code.google.com/p/memcached/downloads/list
Currently, memcached-1.4.12.tar.gz is installed.
3. Download The libevent package
Http://libevent.org/
Libevent-2.0.16-stable.tar.gz
4. decompress the memcached and libevent packages.
Upload the memcached-1.4.12.tar.gz and libevent-2.0.16-stable.tar.gz packages to the server.
For example,/home/kevin/software/
Switch the command line to this directory and run
Tar-zxvf memcached-1.4.12.tar.gz
Tar-zxvf ibevent-2.0.16-stable.tar.gz
Decompress the two packages
5. Install
Command Line enter the decompressed libevent directory/home/kevin/software/libevent-2.0.16-stable
Run the following commands in sequence:
./Configure -- prefix =/usr/
Make
Make install # (note that the user running this command must have the permission to install the software-apply for a root user)
Verify Installation
Ls/usr/lib | grep libevent
If the installation is correct, there will be output
Libevent-2.0.so.5
Libevent-2.0.so.5.1.4
Libevent.
Libevent_core-2.0.so.5
Libevent_core-2.0.so.5.1.4
Libevent_core.a
Libevent_core.la
Libevent_core.so
Libevent_extra-2.0.so.5
Libevent_extra-2.0.so.5.1.4
Libevent_extra.a
Libevent_extra.la
Libevent_extra.so
Libevent. la
Libevent_pthreads-2.0.so.5
Libevent_pthreads-2.0.so.5.1.4
Libevent_pthreads.a
Libevent_pthreads.la
Libevent_pthreads.so
Libevent. so
- Install the memcached Service
Switch to the memcached extract directory
Cd/home/kevin/software/memcached-1.4.12
Run the following commands in sequence:
./Configure -- prefix =/usr/local/memcached -- with-libevent =/usr/
Make
Make install
Verify that memcached is successfully installed
Ls-al/usr/local/memcached/bin
Tip:
[Root @ tyff000001 memcached-1.4.12] # ls-al/usr/local/memcached/bin
Total 296
Drwxr-xr-x 2 root 4096 Feb 2.
Drwxr-xr-x 5 root 4096 Feb 2 ..
-Rwxr-xr-x 1 root 288370 Feb 2 memcached
6. Start the Memcache server (the memory cache size is 3 GB)
Cd/usr/local/memcached/bin
./Memcached-d-m 3072
7. Others
View memcached Processes
Ps-e | grep memcache
Memcached startup parameters
-D option is to start a daemon,
-M indicates the amount of memory allocated to Memcache. The unit is MB. Here it is 3072 MB (3 GB ),
-U is the user who runs Memcache. Here is kevin,
-L is the IP address of the listener server.
-P is the port for Memcache listening. It is not specified as 11211 by default, preferably over 1024.
-The c option is the maximum number of concurrent connections. The default value is 1024, which is determined based on the load of your server.
-P is the pid file for saving Memcache. Here I am saving it in/tmp/memcached. pid