是一个简单的分布式同步数据库(或者是小文件系统)
--------------------------------------------------------
1、建立目录server1server1/dataDirserver1/dataLogDirserver1/logsserver1/zookeeper3.4.6server2
server2/dataDirserver2/dataLogDirserver2/logsserver2/zookeeper3.4.6server3
server3/dataDirserver3/dataLogDirserver3/logsserver3/zookeeper3.4.6-------------------------------------------------------
2、myidserver1/dataDir/myid
1server2/dataDir/myid
2server3/dataDir/myid
3--------------------------------------------------------
3、zoo.cfg server1/dataDir/zookeeper3.4.6/conf/zoo.cfgtickTime=2000
initLimit=5syncLimit=2dataDir=D:/Tools/zookeeper3.4.6/server1/dataDirdataLogDir=D:/Tools/zookeeper3.4.6/server1/dataLogDirclientPort=2181server.1=localhost:2887:3887server.2=localhost:2888:3888server.3=localhost:2889:3889 server2/dataDir/zookeeper3.4.6/conf/zoo.cfgtickTime=2000
initLimit=5syncLimit=2dataDir=D:/Tools/zookeeper3.4.6/server2/dataDirdataLogDir=D:/Tools/zookeeper3.4.6/server2/dataLogDirclientPort=2182server.1=localhost:2887:3887server.2=localhost:2888:3888server.3=localhost:2889:3889 server3/dataDir/zookeeper3.4.6/conf/zoo.cfgtickTime=2000
initLimit=5syncLimit=2dataDir=D:/Tools/zookeeper3.4.6/server3/dataDirdataLogDir=D:/Tools/zookeeper3.4.6/server3/dataLogDirclientPort=2183server.1=localhost:2887:3887server.2=localhost:2888:3888server.3=localhost:2889:3889--------------------------------------------------------
3、log4j.propertiesserver1/dataDir/zookeeper3.4.6/conf/log4j.properties
# Define some default values that can be overridden by system properties
zookeeper.root.logger=INFO, CONSOLEzookeeper.console.threshold=INFOzookeeper.log.dir=D:/Tools/zookeeper3.4.6/server1/logszookeeper.log.file=zookeeper.logzookeeper.log.threshold=DEBUGzookeeper.tracelog.dir=D:/Tools/zookeeper3.4.6/server1/logszookeeper.tracelog.file=zookeeper_trace.log#
# ZooKeeper Logging Configuration## Format is "<default threshold> (, <appender>)+
# DEFAULT: console appender only
log4j.rootLogger=${zookeeper.root.logger}# Example with rolling log file
#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE# Example with rolling log file and tracing
#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE#
# Log INFO level and above messages to the console#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppenderlog4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold}log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayoutlog4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n#
# Add ROLLINGFILE to rootLogger to get log file output# Log DEBUG level and above messages to a log filelog4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppenderlog4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold}log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file}# Max log file size of 10MB
log4j.appender.ROLLINGFILE.MaxFileSize=10MB# uncomment the next line to limit number of backup files#log4j.appender.ROLLINGFILE.MaxBackupIndex=10log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n ## Add TRACEFILE to rootLogger to get log file output# Log DEBUG level and above messages to a log filelog4j.appender.TRACEFILE=org.apache.log4j.FileAppenderlog4j.appender.TRACEFILE.Threshold=TRACElog4j.appender.TRACEFILE.File=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file}log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout
### Notice we are including log4j's NDC here (%x)log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n