国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql memcached UDF 安裝詳解

2024-07-24 12:40:13
字體:
來源:轉載
供稿:網友

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,我們必須通過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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 贵德县| 临夏市| 洪洞县| 望城县| 葵青区| 杂多县| 南开区| 曲麻莱县| 兰州市| 阿勒泰市| 固始县| 镇雄县| 榆中县| 广安市| 沈丘县| 民和| 嫩江县| 沅江市| 石城县| 襄汾县| 江北区| 新绛县| 濮阳县| 勃利县| 涪陵区| 九龙城区| 和林格尔县| 安新县| 苍溪县| 龙里县| 丹江口市| 独山县| 丰城市| 乌苏市| 郓城县| 广河县| 阿巴嘎旗| 建湖县| 澄城县| 吕梁市| 松阳县|