当前位置: 首页 > elasticsearch, 搜索 > 正文

elasticsearch:memcached插件

1 星2 星3 星4 星5 星 (1 次投票, 评分: 5.00, 总分: 5)
Loading ... Loading ...
baidu_share

memcached模块可以让你在memcached的协议上执行 elasticsearch 的 API
The memcached module allows to expose elasticsearch API over the memcached protocol (as closely as possible).

使用方式很简单,只需用下载安装插件 transport-memcached
It is provided as a plugin called transport-memcached and installing is as simply as executing plugin -install transport-memcached or downloading the memcached plugin and placing it under the plugins directory.

memcached同时支持二级制和文本的通讯协议,且会自动选择判断并选择正确的协议。
The memcached protocol supports both the binary and the text protocol, automatically detecting the correct one to use.

memcached协议与ES的REST接口的映射关系
Mapping REST to Memcached Protocol
memcached命令在elasticsearch里面是由同一个REST层来映射和处理的(并不是直接暴露memcached的接口,只是接口方式为memcached的协议),下面是一个支持的memcached命令的列表:
Memcached commands are mapped to REST and handled by the same generic REST layer in elasticsearch. Here is a list of the memcached commands supported:

GET

memcached的 GET 命令对应于REST里面的 GET 。使用URI作为key(注:包含参数的url),因为memcached协议的GET约定get的时候,只能传递一个key的参数,所以在http对应的get或者post里面,如果要传递body参数是不能用的,但是这里我们有一个办法,es支持通过参数”source”来传递body的内容。
The memcached GET command maps to a REST GET. The key used is the URI (with parameters). The main downside is the fact that the memcached GET does not allow body in the request (and SET does not allow to return a result…). For this reason, most REST APIs (like search) allow to accept the “source” as a URI parameter as well.

SET

memcached SET 与REST POST 对应,key值就是url(包含参数),body(value)对应于REST的body。
The memcached SET command maps to a REST POST. The key used is the URI (with parameters), and the body maps to the REST body.

DELETE

memcached DELETE 协议与REST DELETE 对应,key就是URI(包含参数)。
The memcached DELETE command maps to a REST DELETE. The key used is the URI (with parameters).

QUIT

QUIT 支持用来断开与服务器的连接
The memcached QUIT command is supported and disconnects the client.

Settings
有如下对应的设置可配。
The following are the settings the can be configured for memcached:

Setting Description
memcached.port A bind port range. Defaults to 11211-11311.
该组件共享设置 network settings
It also shares the uses the common network settings.

Disable memcached
memcached模块可以通过设置参数 memcached.enabled 为 false 来完全停用,默认检测到有插件就启用。
The memcached module can be completely disabled and not started using by setting memcached.enabled to false. By default it is enabled once it is detected as a plugin.

本文固定链接: http://www.chepoo.com/elasticsearch-memcached-pulgin.html | IT技术精华网

elasticsearch:memcached插件:等您坐沙发呢!

发表评论