Memcacheq successfully installed and used on Linux (Centos)

Source: Internet
Author: User

One: Installation memcached

1. Download the memcached Package
: http://www.memcached.org (the latest package is on the homepage, click to download on the OK)
Unpacking Package: # TAR-ZXVF memcached-1.4.13.tar.gz (extract to directory according to your own situation)
Enter directory: # CD memcached-1.4.13

2. Installing Libevent
Check to see if you have installed Libevent:ls-al/usr/lib |grep libevent
If not installed Libevent,: http://www.libevent.org (home download–stable releases)
Unzip: # TAR-ZXVF Libevent-***-.tar.gz
#cd libevent-***-
#./configure--PREFIX=/USR
#make && make Install
Ls-al/usr/lib |grep libevent under test after installation
lrwxrwxrwx 1 root root 02-06 20:26 libevent-1.4.so.2-libevent-1.4.so.2.1.3
.................................
-rw-r--r--1 root root 11838 04-13 14:03 libevent_pthreads.a
-rwxr-xr-x 1 root root 996 04-13 14:03 libevent_pthreads.la
lrwxrwxrwx 1 root root 04-13 14:03 libevent_pthreads.so libevent_pthreads-2.0.so.5.1.6
lrwxrwxrwx 1 root root 04-13 14:03 libevent.so-libevent-2.0.so.5.1.6

3. Installing memcached
Pre-installed: #./configure--prefix=/usr/local/memcached--with-libevent=/usr
Note: If Libevent is not installed, an error will be noted (If it's already installed, specify its path using--with-libevent=/dir/);
Compiling and Installing: # make && make install
OK installation is successful.

Start memcached:
#/usr/local/memcached/bin/memcached-l 192.168.1.144-d-P 11211-u nobody-m 1024
Note: The above command,-D, means that the memcached,-l and-p combinations are started with daemon to indicate that the listener is on port 11212 of 192.168.1.144 (if the port number is not specified by-p, Memcached will run on port 11211),-u represents The running user is nobody,-m to allocate 1024MB of memory for it.

Connection memcached: # telnet 192.168.1.144 11211
The memcached has been installed here.

Increased to boot boot
# vi/etc/rc.local
Increase:
/usr/local/memcached/bin/memcached-l 192.168.1.144-d-P 11211-u nobody-m 1024

Two: Install Memcacheq
1. Download the Memcacheq Package
: http://code.google.com/p/memcacheq/downloads/list
Unpacking Package: # TAR-ZXVF memcacheq.0.2.tar.gz (extract to directory according to your own situation)
Enter directory: # CD memcacheq-0.2.0

2. Installing BerkeleyDB
: http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html

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


Unpacking Package: # TAR-ZXVF db-5.3.15.tar.gz (extract to directory according to your own situation)
Enter 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
Increase:
/usr/local/lib
/usr/local/berkeleydb.5.3/lib
#vi/etc/profile
Increase
Export Ld_library_path= $LD _library_path:/usr/local/lib:/usr/local/berkeleydb.5.3/lib

3. Install Memcacheq (Note: 5.3 Below is BerkeleyDB version, please follow the actual operation)
Pre-installation:./configure--prefix=/usr/local/memcacheq--enable-threads--with-libevent=/usr/local/libevent
Note: If BerkeleyDB is not installed, an error will be added (Configure:error:cannot find libdb.so in/usr/local/berkeleydb.5.3/lib);


My tips configure:error:cannot Find libdb.so in/usr/local/berkeleydb.5.3/lib error, my workaround:
Loading Berkeley-db
wget http://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




#编译完成, add the path to the Berkeley DB Runtime to the system configuration
echo "/usr/local/berkeleydb.4.7/lib/" >>/etc/ld.so.conf
Ldconfig




Test:/usr/local/memcacheq/bin/memcachq-h
Run Report:
Memcacheq:error while loading shared libraries:libdb-5.3.so:cannot open Shared object file:no such file or directory
Workaround: 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 1024x768 >/var/mcq/logs/m Q_error.log 2>&1


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


Inux Start Memcache Error:

Shell Code
    1. [email protected] memcached]#/bin/memcached-d-M 2048 - P 11211 - u root
    2. ./bin/memcached:error while loading gkfx libraries:libevent-1.4. So. 2 : Cannot open shared object File:no such file or directory

There are generally two reasons, one is that the operating system does not contain the shared library (lib*.so.* file) or the shared library version is not correct, in this case, go to the Internet download and install it.

Another reason is that you have installed the shared library, but when you execute a program that calls the shared library, the program cannot find the shared library file by default shared library path.

Because I have installed the libevent, it should be the program follow the default shared path library to find, but did not find the cause.

First find out where the libevent-1.4.so.2 file is using the Find command

Shell Code
    1. [email protected] memcached]# find/usr-name libevent- 1.4 . So. 2   
    2. /usr/libevent/lib/libevent-1.4. 2

According to the debug log you can see that the program will only go down to/lib and/usr/lib to find the shared link library.

And my libevent is installed under the/usr/libevent/lib/, so the memcache when the boot did not know to go to the bottom to find, so will error

Therefore, after installing the shared library, you should pay attention to the shared library path setting problem as follows:

1) If the shared library file is installed in the/lib or/usr/lib directory, then you need to execute the ldconfig command

The purpose of the Ldconfig command is to search for a shareable dynamic-link library (in the form of lib*.so*) in the default search directory (/lib and/usr/lib) and the directory listed in the dynamic library configuration file/etc/ld.so.conf, creating a dynamic Loader program ( ld.so) The required connection and cache files. The cache file defaults to/etc/ld.so.cache, which holds a list of queued dynamic-link library names.

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

Shell Code
    1. [Email protected] memcached]# cat/etc/ld.so.conf
    2. Include ld.so.conf.d/*.conf

As shown above: The contents of the/etc/ld.so.conf configuration file are only one row,

Ld.so.conf.d/*.conf means a file containing a suffix of. conf under the ld.so.conf.d/directory

So we can create a new 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. [email protected] ld.so.conf.d]# cat libevent.conf
    2. /usr/libevent/lib

After configuration, execute the following ldconfig command

Shell Code
    1. [[Email protected] ~] #ldconfig

3) If the shared library file is installed in a different "non-/lib or/usr/lib" directory, but does not want to add the path in the/etc/ld.so.conf (or there is no permission to add the path). That can export a global variable ld_library_path, and then run the program will go to this directory to find the shared library.

Ld_library_path means to tell loader which directories can be found in the shared library. You can set up multiple search directories separated by colons. For example, install a MySQL into the/usr/local/mysql directory, where there are a lot of library files under/usr/local/mysql/lib, you can add the following statements in the. BASHRC or. Bash_profile or shell:

Export Ld_library_path=/usr/local/mysql/lib: $LD _library_path

In general, this is a temporary solution that is used when there is no authority or temporary need.


Start

/usr/local/memcacheq/bin/memcacheq-d-r-uroot-p12002-h/var/mcq/data-n-r-v-L 1024-b 1024x768 >/var/mcq/logs/mq_e Rror.log 2>&1




An introduction to Ruby-related installations is included:
Starling is a lightweight persistent server that supports the Memcache protocol. Starling is to make it easy to create network access queues or multiple queues, which means asynchronous worker processes between multipoint and multiple machines. It is the famous micro-blogging site that Twitter developed to handle a large number of queue messages, as well as to keep the service responsive. Starling has been used in the production environment, not just by Twitter, but also by the use of fiveruns. Fiveruns even made improvements based on their own applications, and they thought the site was a lot faster.
This is a lightweight persistent server that supports the Memcache protocol, so it's okay to use a variety of clients such as Php/perl/ruby/java, and you can place slower processing logic in the background with Message Queuing, while also supporting multipoint distributed processing.
Since Starling is currently operating in the production environment, the stability should not be a problem after a practice test.



Installation:
1. Install the developer kit under Linux, preferably with Red Hat's add-remove program.
(1) In the Visual window to download Open "Add Remove program", find "development tools--development tool" tick, update. Insert the corresponding Linux installation disk.
2. Install Ruby and Ruby Gems
(1) Preparation for the installation of money
Check if Ruby is already installed on the system,
#rpm-qa | Egrep ' (Ruby) | (IRB) '
If it is installed and is not the version you want, you need to uninstall her 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) Installing Ruby
Assuming Ruby is installed to/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) Setting the path
#vi/etc/profile
By adding in the document,
Ruby_home=/usr/local/ruby
Path= $PATH: $RUBY _home/bin
Export Ruby_home PATH

(4) Check whether the installation is successful
Re-login,
#ruby-V
If you can display the version information for Ruby (Ruby 1.8.4 (2005-12-24) [I686-linux]), the installation is successful.

(5) Installing Ruby Gems
#tar-ZXVF rubygems-0.9.0.tgz
#cd rubygems-0.9.0
#ruby setup.rb

I am using the successful method is: Yum install RubyGems

(6) Check whether the installation is successful
#gem-V
If you can display the version information (0.9.0) of the gem, the installation was successful.


This article references the source: http://www.cnblogs.com/sunzy/archive/2012/04/13/2446234.html

http://blog.csdn.net/li_yang98/article/details/6208223, etc.


Memcacheq successfully installed and used on Linux (Centos)

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.