mysql memcached UDF ��װ����
1��mysql memcached UDF ��ʵ����ͨ��libmemcached��ʹ��memcache��һϵ�к�����ͨ����Щ���������� ��memcache����get, set, cas, append, prepend, delete, increment, decrement objects��������������ͨ��mysql trigger��ʹ����Щ��������ô����ͨ��mysql���õģ����Զ��Ĺ���memcache!
2:��װ������
1����װmemcache
2����װlibmemcached
shell> cd libmemcached-0.35
shell> ./configure --with-memcached=/usr/local/bin/memcached
shell> make && make install
shell> echo "/usr/local/lib" >> /etc/ld.so.conf
shell> ldconfig
3����װmemcached_functions_mysql
shell> tar zxvf memcached_functions_mysql-0.9.tar.gz
shell> cd memcached_functions_mysql-0.9
shell> ./configure --with-mysql=/usr/local/mysql51/bin/mysql_config --with-libmemcached =/usr/local/
shell> make && make install
4������lib���mysql��plugin����
shell> cp -R /usr/local/lib/libmemcached_functions_mysql.* /usr/local/mysql51/lib/mysql/plugin/
5������memcache UDF ����
��mysql��ִ�� source install_functions.sql
�������ǾͿ���ʹ��mysql memcached UDF �ˣ����ǿ���ͨ�����������鿴�Ƿ��Ѿ�������װ
1)�鿴mysql.func,�кܶຯ��
mysql> select * from mysql.func;
+------------------------------+-----+---------------------------------+----------+
| name | ret | dl | type |
+------------------------------+-----+---------------------------------+----------+
| memc_add | 2 | libmemcached_functions_mysql.so | function |
| memc_add_by_key | 2 | libmemcached_functions_mysql.so | function |
| memc_servers_set | 2 | libmemcached_functions_mysql.so | function |
2������trigger�����Ƿ���memcache��insert��update��
���������䣬���ǿ��Բ��գ�
1��memcached_functions_mysql-0.9/sql Ŀ¼�µ�trigger_fun.sql
2��ʹ�ò����ĵ���http://dev.mysql.com/doc/refman/5.1/en/ha-memcached-interfaces-mysqludf.html
���ǻ�����ע�����¼��㣺
1��mysql ����ʱһ����Ҫ��'--with-mysqld-ldflags=-all-static' ������������Ϊ������������mysql �Ķ�̬��װ������
2��ʹ��ʱ��Ҫ�۲�mysql.err��־����֪������������⣬udf����memcache������¼��err��־�ע����������־������һ�¾ͱ�����
3��mysql ����������һ�仰��
The list of servers used by the memcached UDFs is not persistent over restarts of the MySQL server. If the MySQL server fails, then you must re-set the list of memcached servers.
���ԣ�����������mysql�����DZ���ͨ��select memc_servers_set('192.168.0.1:11211,192.168.0.2:11211');��������ע��memcache��������
���http://dev.mysql.com/doc/refman/5.0/en/ha-memcached-interfaces.html
ԭ�ģ�http://blog.163.com/lgh_2002/blog/static/44017526201123121912959/
- ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
- �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����