Install memcacheq in Centos

Source: Internet
Author: User

Install memcacheq in Centos

1. Install memcached

1. Download The memcached package
: Http://www.memcached.org (the latest package on the home page, click to download it OK)
Decompress package: # tar-zxvf memcached-1.4.13.tar.gz (extract to the directory according to your own situation)
Go to the directory: # cd memcached-1.4.13

2. Install libevent
Check whether libevent is installed: ls-al/usr/lib | grep libevent
Install libevent if not,: http://www.libevent.org (home Download-Stable releases)
Decompress: # tar-zxvf libevent-*** -.tar.gz
# Cd libevent -***-
#./Configure -- prefix =/usr
# Make & make install
Ls-al/usr/lib | grep libevent after installation check
Lrwxrwxrwx 1 root 21 02-06 libevent-1.4.so.2-> libevent-1.4.so.2.1.3
.................................
-Rw-r -- 1 root 11838 04-13 14:03 libevent_pthreads.a
-Rwxr-xr-x 1 root 996 04-13 14:03 libevent_pthreads.la
Lrwxrwxrwx 1 root 30 04-13 libevent_pthreads.so-> libevent_pthreads-2.0.so.5.1.6
Lrwxrwxrwx 1 root 21 04-13 libevent. so-> libevent-2.0.so.5.1.6

3. Install memcached
Pre-install: #./configure -- prefix =/usr/local/memcached -- with-libevent =/usr
NOTE: If libevent is not installed, an error is returned (If it's already installed, specify its path using -- with-libevent =/dir /);
Compile and install: # make & make install
OK is installed successfully.

Start memcached:
#/Usr/local/memcached/bin/memcached-l 192.168.1.144-d-p 11211-u nobody-m 1024
Note: In the above command,-d indicates to start memcached in daemon mode. The combination of-l and-p indicates listening to port 11212 of 192.168.1.144 (if you do not need to use-p to specify the port number, memcached runs on port 11211). The-u table indicates that the running user is nobody, and-m indicates that the user is allocated 1024 MB of memory.

Connect to memcached: # telnet 192.168.1.144 11211
Here, memcached has been installed.

Add to start
# Vi/etc/rc. local
Added:
/Usr/local/memcached/bin/memcached-l 192.168.1.144-d-p 11211-u nobody-m 1024

Ii. Install memcacheq
1. Download The memcacheq package
: Http://code.google.com/p/memcacheq/downloads/list
Decompress the package: # tar-zxvf memcacheq.0.2.tar.gz (decompress the package to the directory based on your own situation)
Go to the directory: # cd memcacheq-0.2.0

2. Install BerkeleyDB
: Http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html

Request: wget http://download.oracle.com/berkeley-db/db-5.3.15.tar.gz (successful)


Decompress package: # tar-zxvf db-5.3.15.tar.gz (extract to the directory according to your own situation)
Go to the directory: # cd db-5.3.15
# Cd build_unix
# ../Dist/configure -- prefix =/usr/local/BerkeleyDB.5.3
# Make & make install
# Vi/etc/ld. so. conf
Added:
/Usr/local/lib
/Usr/local/BerkeleyDB.5.3/lib
# Vi/etc/profile
Add
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/lib:/usr/local/BerkeleyDB.5.3/lib

3. Install memcacheq (Note: In the following section, 5.3 is the version of berkeleyDB. Please perform this operation according to your actual situation)
Pre-installation:./configure -- prefix =/usr/local/memcacheq -- enable-threads -- with-libevent =/usr/local/libevent
NOTE: If BerkeleyDB is not installed, an error is returned (configure: error: cannot find libdb. so in/usr/local/BerkeleyDB.5.3/lib );

My prompt configure: error: cannot find libdb. so in/usr/local/BerkeleyDB.5.3/lib reports an error. My solution is as follows:
Install berkeley-db
Wgethttp: // download.oracle.com/berkeley-db/db-4.7.25.tar.gz
Tar zxf db-4.7.25.tar.gz
Cd db-4.7.25/build_unix/
../Dist/configure
Make
Make install



# After compilation, add the path of the Berkeley Db Runtime Library to the system configuration.
Echo "/usr/local/BerkeleyDB.4.7/lib/">/etc/ld. so. conf
Ldconfig



Test:/usr/local/memcacheq/bin/memcachq-h
Running report:
Memcacheq: error while loading shared libraries: libdb-5.3.so: cannot open shared object file: No such file or directory
Solution: ln-s/usr/local/BerkeleyDB.5.3/lib/libdb-5.3.so/usr/lib/libdb-5.3.so

Connection: /usr/local/memcacheq/bin/memcacheq-d-r-uroot-p12002-H/var/mcq/data-N-R-v-L 1024-B 1024>/ var/mcq/logs/mq_error.log 2> & 1

The process encountered many problems, such as dynamic library location and environment variables.

When Memcache is started on inux, the following error occurs:

Shell code
  1. [Root @ localhostmemcached] #./bin/memcached-d-m2048-p11211-uroot
  2. ./Bin/memcached: errorwhileloadingsharedlibraries: libevent-1.4.so.2: cannotopen?dobjectfile: Nosuchfileordirectory

There are two common causes. One is that the operating system does not contain the Shared Library (lib *. so. * file) or the version of the shared library is incorrect. In this case, download and install it online.

Another reason is that the shared library has been installed, but when you execute the program that needs to call the shared library, the program cannot find the shared library file according to the default shared library path.

Because I have already installed libevent, it is caused by the failure to find the program according to the default shared path library.

First use the find command to find where the libevent-1.4.so.2 file is

Shell code
  1. [Root @ localhostmemcached] # find/usr-namelibevent-1.4.so.2
  2. /Usr/libevent/lib/libevent-1.4.so.2

According to the debug log, the program will only go to/lib and/usr/lib to find the desired shared link library.

My libevent is installed under/usr/libevent/lib/. Therefore, when memcache is started, it is not known to be found below, so an error will be reported.

After installing the shared library, pay attention to the following issues:

1) if the shared library file is installed in the/lib or/usr/lib directory, run the ldconfig command.

The ldconfig command is mainly used in the default search directory (/lib and/usr/lib) and dynamic library configuration file/etc/ld. so. search for the shared dynamic link library (Format: lib *. so *) to create a dynamic loader (ld. so) the required connection and cache file. the default cached file is/etc/ld. so. cache. This file stores the list of Dynamic Linked Library names in the sorted order.

2) If the shared library file is installed in/usr/local/lib (many open-source shared libraries are installed in this directory) or other "non-/lib or/usr/lib" directories, add the new Shared Library directory to the shared library configuration file/etc/ld before executing the ldconfig command. so. conf, as follows:

Shell code
  1. [Root @ localhostmemcached] # cat/etc/ld. so. conf
  2. Includeld. so. conf. d/*. conf

As shown above: the/etc/ld. so. conf configuration file contains only one line,

Ld. so. conf. d/*. conf indicates a file with the. conf Suffix in the directory ld. so. conf. d /.

Therefore, you can create a libevent. conf configuration file in the/etc/ld. so. conf. d directory, and configure the libevent installation path.

My libevent content is as follows:

Shell code
  1. # Catlibevent. conf
  2. /Usr/libevent/lib

Run the following ldconfig command after Configuration

Shell code
  1. [Root @ localhost ~] # Ldconfig

3) if the shared library file is installed in another "non-/lib or/usr/lib" directory, but does not want to be in/etc/ld. so. add path in conf (or do not have permission to add path ). you can export a global variable LD_LIBRARY_PATH, and then find the shared library in the directory when running the program.

LD_LIBRARY_PATH indicates the directories in which the loader can find the shared library. you can set multiple search directories separated by colons. for example, if you have installed a mysql file to the/usr/local/mysql directory, a large number of library files are under/usr/local/mysql/lib. bashrc or. add the following statement to bash_profile or shell:

Export LD_LIBRARY_PATH =/usr/local/mysql/lib: $ LD_LIBRARY_PATH

Generally, this is only a temporary solution, which is used when you do not have the permission or need it temporarily.


Start

/Usr/local/memcacheq/bin/memcacheq-d-r-uroot-p12002-H/var/mcq/data-N-R-v-L 1024-B 1024>/ var/mcq/logs/mq_error.log 2> & 1

Command to start tomcat

/Usr/local/memcached/bin/memcached-d-m 2048-u root-l IP address-p 12000-c 512-P/tmp/memcached. pid

It comes with an introduction to ruby-related installation:
Starling is a lightweight persistent server that supports the MemCache protocol. Starling makes it easy to create a network access queue or multiple queues, that is, asynchronous working processes between multiple nodes and multiple machines. It is developed by Twitter, a famous microblog website, to process a large number of queue messages and maintain service response. Starling is already used in the production environment, not only Twitter, but also FiveRuns. FiveRuns even made improvements based on their own applications. They thought the website was much faster.
This is a lightweight persistent server that supports the memcache protocol. Therefore, it is okay to use php, perl, ruby, java, and other clients. You can put the slow processing logic in the background through message queues for processing, it also supports multi-point distributed processing.
As starling is currently running on twitter in the production environment, it has been tested in practice and stability should not be a problem.


Installation:
1. Install the development kit in linux. It is best to use red hat to add and delete programs for installation.
(1) In the visualization window, download and open "add and delete programs", find "development-> development tools", and update and insert the corresponding linux installation disk.
2. Install ruby and ruby gem
(1) Prepare for Installation
Check whether ruby is installed in the system,
# Rpm-qa | egrep '(ruby) | (irb )'
If the installation is not the desired version, uninstall it first, for example,
# Rpm e ruby-docs-1.8.1-7.EL4.2 \
Ruby-1.8.1-7.EL4.2 \
Irb-1.8.1-7.EL4.2 \
Ruby-libs-1.8.1-7.EL4.2 \
Ruby-mode-1.8.1-7.EL4.2 \
Ruby-tcltk-1.8.1-7.EL4.2 \
Ruby-devel-1.8.1-7.EL4.2

(2) install Ruby
Suppose Ruby is installed in/usr/local/ruby
# Mkdir/usr/local/ruby
# Tar-zxvf ruby-1.8.4.tar.gz
# Cd ruby-1.8.4
#./Configure -- prefix =/usr/local/ruby
# Make
# Make install

(3) set the path
# Vi/etc/profile
Add in this file,
RUBY_HOME =/usr/local/ruby
PATH = $ PATH: $ RUBY_HOME/bin
Export RUBY_HOME PATH

(4) check whether the installation is successful
Log on again,
# Ruby-v
If ruby version information (ruby 1.8.4 () [i686-linux]) is displayed, it indicates that the installation was successful.

(5) install Ruby Gems
# Tar-zxvf rubygems-0.9.0.tgz
# Cd rubygems-0.9.0
# Ruby setup. rb

The method I used successfully is: yum install rubygems

(6) check whether the installation is successful
# Gem-v
If the version information of the gem (0.9.0) is displayed, the installation is successful.

Reference: http://www.cnblogs.com/sunzy/archive/2012/04/13/2446234.html

Http://blog.csdn.net/li_yang98/article/details/6208223and so on

Related Article

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.