Webdis - 一个快速的 Redis HTTP 接口

jopen 12年前

Webdis是一个简单的 HTTP 服务器。它将操作命令转发至Redis,然后按你选择的格式送发请求返回。它用到了 hiredis, jansson, libevent, 和 http-parser这些第三访包。支持以下特性:

  • 支持GET 和 POST,和PUT用于文件上传
  • 默认返回输出JSON,optional JSONP parameter (?jsonp=myFunction or ?callback=myFunction).
  • Raw Redis 2.0 protocol output with .raw suffix
  • MessagePack output with .msg suffix
  • HTTP 1.1 pipelining (70,000 http requests per second on a desktop Linux machine.)
  • Multi-threaded server, configurable number of worker threads.
  • WebSocket support (Currently using the “hixie-76” specification).
  • Connects to Redis using a TCP or UNIX socket.
  • Restricted commands by IP range (CIDR subnet + mask) or HTTP Basic Auth, returning 403 errors.
  • Possible Redis authentication in the config file.
  • Pub/Sub using Transfer-Encoding: chunked, works with JSONP as well. Webdis can be used as a Comet server.
  • Drop privileges on startup.
  • Custom Content-Type using a pre-defined file extension, or with ?type=some/thing.
  • URL-encoded parameters for binary data or slashes and question marks. For instance, %2f is decoded as / but not used as a command separator.
  • Logs, with a configurable verbosity.
  • Cross-origin requests, usable with XMLHttpRequest2 (Cross-Origin Resource Sharing - CORS).
  • File upload with PUT.
  • With the JSON output, the return value of INFO is parsed and transformed into an object.
  • Optional daemonize.
  • Default root object: Add "default_root": "/GET/index.html" in webdis.json to substitute the request to / with a Redis request.
  • HTTP request limit with http_max_request_size (in bytes, set to 128MB by default).
  • Database selection in the URL, using e.g. /7/GET/key to run the command on DB 7.

项目主页:http://www.open-open.com/lib/view/home/1354683542851