| With the advent of the era of big data and the gradual emergence of bottlenecks in the development of computer hardware,distributed database has become an important support for computing and storing massive data in the Internet.The distributed database based on data replication uses Raft as its consistency algorithm,and is widely applied due to its scalability,flexible failover,concurrent processing capabilities.However,the Raft algorithm is difficult to maintain the consensus between nodes in the Byzantine fault environment,and the availiability is poor in the network fluctuation environment.Therefore,the research on Byzantine fault-tolerant and high-availability consensus algorithms suitable for distributed database application scenarios is urgent.Through the analysis of the existing consensus algorithms,this paper proposes to optimize the Raft algorithm from the two directions including Byzantine fault tolerance and availiability by using threshold signature technology and distributed trust management technology.With the threshold signature technology,trusted submission of log is implemented,and with the distributed trust management technology,vulnerable nodes are prevented from becoming leaders,thereby improving the availiability of the system.The specific work is as follows:Firstly,in view of the problem that the Raft algorithm cannot tolerate Byzantine faults,a threshold signature-based Byzantine fault tolerant Raft algorithm FB-Raft is proposed.FB-Raft uses a decentralized distributed key generation mechanism to securely distribute keys among nodes,and uses threshold signature and signature verification mechanisms in leader election and log replication to avoid Byzantine failures from destroying the consensus of the system.It is proved by formal specification that the algorithm has correctness.The simulation experiments shows that FB-Raft performs well in terms of delay and throughput,and achieves Byzantine fault tolerance with low performance overhead.Then,aiming at the problem of low availability of Raft algorithm in the environment of network fluctuation,a high availability Raft algorithm TB-Raft based on trust is proposed.Each node in TB-Raft calculates the local trust degree of other nodes based on the interaction quality between nodes,and uses the transive trust to calculate the global trust degree.The robustness of the nodes is described by trust degree.Multiple candidates are voted based on trust within the voting delay to elect a leader with higher global trust in leader election.The correctness of the algorithm design is discussed through theoretical calculations and simulation experiments.It is verified that the throughput of the algorithm is nearly the same as that of Raft,and the high availiability of the algorithm with low performance overhead is improved.Finally,the consensus algorithm driver based on FB-Raft and TB-Raft is designed and implemented.The driver is connected with the existing distributed database system through the access module,and the consensus algorithm module achieves the data consensus between nodes.Through the tests,it is verified that the consensus algorithm driver has the expected function and great read and write performance. |