2014-02-13 33 views
0

我已經安裝了下列產品包 -與內存緩存和MySQL使用memcache_functions_mysql UDF的

  1. 的libevent-2.0.21
  2. memcached的-1.4.17
  3. libmemcached-0.34
  4. memcached_functions_mysql_1.1

以上都已成功安裝。 的-v LDCONFIG命令(其中,它表明libmemcached庫已包含的部分)的輸出如下:

$ldconfig -v 

/usr/local/libmemcached/lib: 
     libmemcached.so.3 -> libmemcached.so.3.0.0 
     libmemcachedprotocol.so.0 -> libmemcachedprotocol.so.0.0.0 
     libmemcachedutil.so.0 -> libmemcachedutil.so.0.0.0 

但是當我嘗試加載UDF的到MySQL使用install_functions.sql被運與memcache_functions它拋出以下錯誤:

ERROR 1126 (HY000) at line 38: Can't open shared library 'libmemcached_functions_mysql.so' (errno: 0 libmemcached.so.3: cannot open shared object file: No such file or directory) 

和插件目錄的內容是:

-rw-r--r-- 1 root root 6.1K Jan 21 13:49 adt_null.so 
-rw-r--r-- 1 root root 11K Jan 21 13:49 auth.so 
-rw-r--r-- 1 root root 6.0K Jan 21 13:49 auth_socket.so 
-rw-r--r-- 1 root root 6.2K Jan 21 13:49 auth_test_plugin.so 
-rw-r--r-- 1 root root 35K Jan 21 13:49 ha_example.so 
-rw-r--r-- 1 root root 10K Jan 21 13:49 libdaemon_example.so 
-rw-r--r-- 1 root root 361K Feb 13 02:47 libmemcached_functions_mysql.a 
-rwxr-xr-x 1 root root 1.1K Feb 13 02:47 libmemcached_functions_mysql.la 
-rwxr-xr-x 1 root root 167K Feb 13 02:47 libmemcached_functions_mysql.so 
-rwxr-xr-x 1 root root 167K Feb 13 02:47 libmemcached_functions_mysql.so.0 
-rwxr-xr-x 1 root root 167K Feb 13 02:47 libmemcached_functions_mysql.so.0.0.0 
-rw-r--r-- 1 root root 11K Jan 21 13:49 mypluglib.so 
-rw-r--r-- 1 root root 5.9K Jan 21 13:49 qa_auth_client.so 
-rw-r--r-- 1 root root 11K Jan 21 13:49 qa_auth_interface.so 
-rw-r--r-- 1 root root 6.0K Jan 21 13:49 qa_auth_server.so 
-rw-r--r-- 1 root root 39K Jan 21 13:49 semisync_master.so 
-rw-r--r-- 1 root root 15K Jan 21 13:49 semisync_slave.so 

回答

0
Installing memcached on Ubuntu 12.04.1 LTS (64 bit) 

Python - 2.6.8 
MySQL – 5.5.28 
Zope – 2.12.19 

1. Install memcached 

    apt-get install memcached 

2. Install libmemcached -0 .34 (Version is very important. May or may not work with other versions). 

    Download it from https://launchpad.net/libmemcached/ 

    tar xvf libmemcached-0.34.tar.gz 
    sudo ./configure --prefix=/usr/lib/libmemcached --with-memcached=/usr/bin/memcached 
    sudo make 
    sudo make install. 

3. Install memcached_functions_mysql (Version 1.1 used at the time of the installation. (To create UDF’s that are invoked by triggers to manipulate the cache). 

    Downloading from https://launchpad.net/memcached-udfs 

    sudo ./configure --prefix=/usr/local/memcached_mysql --libdir=/usr/lib/mysql/plugin --with-mysql=/usr/bin/mysql_config --with-libmemcached=/usr/lib/libmemcached 
    sudo make 
    sudo make install 

    Navigate to the 「sql」 folder inside the memcached_mysql_functions directory. 

    mysql –u <username> -p < install_functions.sql 

4. For Zope users 

    Install python-memcached-1.53 

    Download it from https://pypi.python.org/pypi/python-memcached/ 
    Navigate to the extracted python-memcached directory. 

    /home/zope/zope/bin/python setup.py install 

5. Edit the script containing which imports the modules. 

    allow_module('memcache') 

    from memcache import Client 
    allow_class(Client) 
    allow_module('memcache.Client.get') 
    allow_module('memcache.Client.set') 

This is done so that memcache can be imported and used in your Restricted Python scripts. 
If an external method is used to handle the above case, then the file does need to be updated with the above content.