redis 相关架构组件

来源:互联网 发布:工业交换机 知乎 编辑:程序博客网 时间:2024/06/03 20:46

twemproxy

支持一致性Hash,取模等数据分片模式

  • 支持失败节点自动删除

    • 可以设置重新连接该节点的时间
    • 可以设置连接多少次之后删除该节点
    • 该方式适合作为cache存储
  • 支持设置HashTag

    • 通过HashTag可以自己设定将两个KEYhash到同一个实例上去。
  • 减少与redis的直接连接数

    • 保持与redis的长连接
    • 可设置代理与后台每个redis连接的数目
  • 自动分片到后端多个redis实例上

    • 多种hash算法(部分还没有研究明白)
    • 可以设置后端实例的权重
  • 避免单点问题

    • 可以平行部署多个代理层.client自动选择可用的一个
  • 支持redis pipelining request

  • 支持状态监控

    • 可设置状态监控ip和端口,访问ip和端口可以得到一个json格式的状态信息串
    • 可设置监控信息刷新间隔时间
  • 高吞吐量

    • 连接复用,内存复用。
    • 将多个连接请求,组成reids pipelining统一向redis请求。

另外可以修改redis的源代码,抽取出redis中的前半部分,作为一个中间代理层。最终都是通过linux下的epoll 事件机制提高并发效率,其中nutcraker本身也是使用epoll的事件机制。并且在性能测试上的表现非常出色。

配置部署建议: 编译时候打开logging模块。

redis部署知识: AOF;一种记录redis写操作的文件,用于恢复redis数据。


sentinel

redis系统外围组件,用于监控集群系统

Redis Sentinel is a system designed to help managing Redis instances. It performs the following three tasks:

  • Monitoring. Sentinel constantly check if your master and slave instances are working as expected.
  • Notification. Sentinel can notify the system administrator, or another computer program, via an API, that something is wrong with one of the monitored Redis instances.
  • Automatic failover. If a master is not working as expected, Sentinel can start a failover process where a slave is promoted to master, the other additional slaves are reconfigured to use the new master, and the applications using the Redis server informed about the new address to use when connecting.
  • Configuration provider. Sentinel acts as a source of authority for clients service discovery: clients connect to Sentinels in order to ask for the address of the current Redis master responsible for a given service. If a failover occurs, Sentinels will report the new address.

metaserver

redis之间的数据均衡


0 0