摘要
随着互联网的迅速发展,用户从系统获取的信息越来越多,访问系统的频率也在迅速增加。当大量客户端访问系统时,请求的响应时间也会大幅增加,传统关系型数据库已经无法满足用户的需求,而内存数据库在保证系统稳定的前提下,改善了用户体验,并得到了越来越广泛的应用。作为NoSQL内存数据库,Redis支持很多数据类型,适用于多种情况下的缓存与存储需求。文中主要介绍Redis集群,它是Redis的分布式实现,支持主从复制,也具有一定的容错性和线性可扩展性,当前使用Redis集群的网站有新浪微博、github等。虽然Redis集群应用广泛,但目前它在节点下线后会出现恢复时间长的现象,这与现有Redis集群的选举算法有关,即与Raft算法的实现有关。分析了Redis集群的可靠性,并优化了集群的选举算法。测试结果显示,在单个主节点下线50s内,优化后的集群都能成功恢复,比社区版本的集群提高了40%。
With the rapid development of Internet,users obtain more and more information from the system,and the frequency of accessing to system also grows rapidly.While a large number of clients access to the system,the response time of the request greatly increases,the traditional relational database is unable to meet the demand of the user,but inmemory database guarantees the stability of system,improves the user experience,and obtains more and more application.As a kind of in-memory database of NoSQL,Redis supports many data types,and it is applicable to many cases of requirements in caching and storage.In this paper,we mainly introduced Redis cluster,which is a distributed implementation of the Redis,supports master-slave replication,has a certain degree of fault tolerance and linear scalability,and recently is used by Sina microblog,github and so on.Although it is widely used,current Redis cluster occasionally has the case that long recovery time is needed after node fails,which has something to do with election algorithm of current Redis cluster,that is the implementation of Raft algorithm.In this paper,we analyzed the reliability of Redis cluster,and optimized the election algorithm of cluster.The results in test show that the optimized cluster can successfully recover in 50 seconds while only one master node is offline,and it is 40% higher than that of the cluster of the community version.
出处
《计算机科学》
CSCD
北大核心
2017年第10期165-170,共6页
Computer Science
基金
安徽省自然科学基金(1408085MKL06)
高等学校学科创新引智计划项目(B07033)
华为创新研究计划资助