EMQX 数据存储Redis主要牵涉到几个外部的库文件:
1、 eredis:Non-blocking Redis client with focus on performance and robustness https://github.com/wooga/eredis.git
2、eredis_cluster:eredis_cluster is a wrapper for eredis to support cluster mode of redis https://github.com/adrienmo/eredis_cluster.git
3、ecpool: It is different with worker-pool libraries in that it is designed to pool connection/clients to server or database https://github.com/emqx/ecpool.git
下面分析第一个文件emqx_backend_redis_app.erl。
第一步、启动emqx_backend_redis application,
第二步、启动应用的第一个监听者emqx_backend_redis_sup
第三步、注册Redis统计
第四步、载入emqx_backend_redis模块
-module(emqx_backend_redis_app).
-include("../include/emqx_backend_redis.hrl").
-behaviour(