Package org.apache.zookeeper.server.persistence

Examples of org.apache.zookeeper.server.persistence.FileTxnSnapLog


            public NIOServerCnxn.Factory createConnectionFactory()throws IOException {
                return new ObservableNIOServerCnxn.Factory(getClientPort());
            }
            public ZooKeeperServer createServer() throws IOException {
                ManagedZooKeeperServer zks = new ManagedZooKeeperServer(
                        new FileTxnSnapLog(new File(ServerConfig.getDataDir()),
                        new File(ServerConfig.getDataLogDir())),
                new ZooKeeperServer.BasicDataTreeBuilder());
                return zks;
            }
        });
View Full Code Here


            runPeer(new QuorumPeer.Factory() {
                public QuorumPeer create(NIOServerCnxn.Factory cnxnFactory)
                throws IOException {
                    ManagedQuorumPeer peer = new ManagedQuorumPeer();
                    peer.setClientPort(ServerConfig.getClientPort());
                    FileTxnSnapLog factory = new FileTxnSnapLog(new
                            File(ServerConfig.getDataLogDir()), new 
                                    File(ServerConfig.getDataDir()));
                    peer.setTxnFactory(factory);
                    peer.setQuorumPeers(QuorumPeerConfig.getServers());
                    peer.setElectionType(QuorumPeerConfig.getElectionAlg());
View Full Code Here

            public ZooKeeperServer createServer() throws IOException {
                // create a file logger url from the command line args
                ZooKeeperServer zks = new ZooKeeperServer();

               FileTxnSnapLog ftxn = new FileTxnSnapLog(new
                       File(ServerConfig.getDataLogDir()),
                        new File(ServerConfig.getDataDir()));
               zks.setTxnLogFactory(ftxn);
               return zks;
            }
View Full Code Here

     * test code.
     * It defaults to FileLogProvider persistence provider.
     */
    public ZooKeeperServer(File snapDir, File logDir, int tickTime)
            throws IOException {
        this(new FileTxnSnapLog(snapDir,logDir),
                tickTime,new BasicDataTreeBuilder());
    }
View Full Code Here

        FileSupport.toRichFile(data_dir()).recursiveDelete();

        System.out.println("Starting ZooKeeper");
        ZooKeeperServer zk_server = new ZooKeeperServer();
        zk_server.setTickTime(500);
        zk_server.setTxnLogFactory(new FileTxnSnapLog(new File(data_dir(), "zk-log"), new File(data_dir(), "zk-data")));
        connector = new NIOServerCnxnFactory();
        connector.configure(new InetSocketAddress(0), 100);
        connector.startup(zk_server);
        System.out.println("ZooKeeper started");
    }
View Full Code Here

                }
            }
            zkServer = new ZooKeeperServer();
            File dataDir = new File("./target/zookeeper/log");
            File snapDir = new File("./target/zookeeper/data");
            FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, snapDir);
            zkServer.setTxnLogFactory(ftxn);
            zkServer.setTickTime(1000);
            connectionFactory = new NIOServerCnxn.Factory(new InetSocketAddress("localhost", clientPort), 0);
            connectionFactory.startup(zkServer);
        }
View Full Code Here

                cleanZookeeperDir();
            }
            zkServer = new ZooKeeperServer();
            File dataDir = new File(zookeeperBaseDir, "log");
            File snapDir = new File(zookeeperBaseDir, "data");
            FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, snapDir);
            zkServer.setTxnLogFactory(ftxn);
            zkServer.setTickTime(1000);
            connectionFactory = new NIOServerCnxn.Factory(new InetSocketAddress("localhost", clientPort), 0);
            connectionFactory.startup(zkServer);
        }
View Full Code Here

                }
            }
            zkServer = new ZooKeeperServer();
            File dataDir = new File("./target/zookeeper/log");
            File snapDir = new File("./target/zookeeper/data");
            FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, snapDir);
            zkServer.setTxnLogFactory(ftxn);
            zkServer.setTickTime(1000);
            connectionFactory = new NIOServerCnxn.Factory(new InetSocketAddress("localhost", clientPort), 0);
            connectionFactory.startup(zkServer);
        }
View Full Code Here

              new NIOServerCnxn.Factory(config.getClientPortAddress(),
                      config.getMaxClientCnxns());
 
          quorumPeer = new QuorumPeer();
          quorumPeer.setClientPortAddress(config.getClientPortAddress());
          quorumPeer.setTxnFactory(new FileTxnSnapLog(
                      new File(config.getDataLogDir()),
                      new File(config.getDataDir())));
          quorumPeer.setQuorumPeers(config.getServers());
          quorumPeer.setElectionType(config.getElectionAlg());
          quorumPeer.setMyid(config.getServerId());
View Full Code Here

     */
    @Test
    public void testTxnFailure() throws Exception {
        long count = 1;
        File tmpDir = ClientBase.createTmpDir();
        FileTxnSnapLog logFile = new FileTxnSnapLog(tmpDir, tmpDir);
        DataTree dt = new DataTree();
        dt.createNode("/test", new byte[0], null, 0, 1, 1);
        for (count = 1; count <= 3; count++) {
            dt.createNode("/test/" + count, new byte[0], null, 0, count,
                    System.currentTimeMillis());
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.server.persistence.FileTxnSnapLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.