zookeeper
2018-08-19 18:01:26 34 举报
Zookeeper是一个分布式协调服务,它是Apache Hadoop生态系统中的一个重要组件。它为分布式应用程序提供了一种可靠的、高性能的、可扩展的服务,用于维护配置信息、命名空间、提供分布式同步和提供组服务。Zookeeper的核心是原子广播,这个机制保证了各个Server之间的同步。所有的更新都是永久性的,要么全部执行,要么全部不执行。Zookeeper的数据模型类似于一个树结构,每个节点被称为znode,可以存储数据和子节点。Zookeeper的设计目标是将那些复杂且容易出错的分布式一致性服务封装起来,给开发人员提供一套简单易用的接口。
作者其他创作
大纲/内容
分布式runFromConfig
RequestProcessor
new
QuorumPeerMain
startup(zkServer)
start
selectorThreads.add(new SelectorThread(i));
PlayBackListener
setZxid(zkDb.loadDataBase());
parse
//step2
//step3
ZKDatabase
runFromConfig
NIOServerCnxnFactory
//step12
//step15
workPool=WorkerService
restore
//step15.1.1
ZooKeeperCriticalThread
//step8.1.2
InputArchive ia = BinaryInputArchive.getArchive(crcIn);
zks.startdata();
//step5
expirerThread.start();
//step8.3
createFactory
WorkerService
acceptThread.start();
startup
ServerConfig
//step8.2
SyncRequestProcessor
ServerSocketChannel.open()
configure
//step6
init
startSessionTracker
ZooKeeperServerListenerImpl
//step14
ServerCnxnFactory
config
UserDetailsByNameServiceWrapper
ZooKeeperServerMain
FileTxnSnapLog
selectorThreads start
FileTxnIterator
new ZKDatabase(this.txnLogFactory);
shutdownLatch.await();等待
SessionTrackerImpl
parse(args[0])
//step8.1
takeSnapshot
//step11
//step4
setupRequestProcessors
adminServer创建并启动
PrepRequestProcessor
zks.startup();
loadData
//step10
ZooKeeperThread
//step7
单机ZooKeeperServerMain.main(args)
ZooKeeperServer
//step13
read
ss.socket().bind(addr);
AcceptThread
loadDataBase
Main(args)
txnLog = new FileTxnLog(this.dataDir);
FileHeader
//step1
DaemonThreadFactory
FinalRequestProcessor
main(args)
//step8.1.1
DataTree
SelectorThread
//step9
//step15.1.2
MyFilterSecurityInterceptor
//step15.1
findNValidSnapshots
FileSanp=SnapLog
startdata
从logdir读取zxid文件\\tmp\\zookeeper\\version-2
FileTxnLog
snapLog = new FileSnap(this.snapDir);
DataNode
* This class implements a simple standalone ZooKeeperServer. It sets up the * following chain of RequestProcessors to process requests: * PrepRequestProcessor - SyncRequestProcessor - FinalRequestProcessor
//step8
QuorumPeerConfig
onTxnLoaded
0 条评论
下一页