Package io.fathom.auto.zookeeper.model

Examples of io.fathom.auto.zookeeper.model.ZookeeperClusterRegistration


    @Override
    protected ZookeeperClusterRegistration buildRegistration(int myid) {
        InetAddress ip = MachineInfo.INSTANCE.getIp();

        ZookeeperClusterRegistration registration = new ZookeeperClusterRegistration();
        registration.ip = InetAddresses.toAddrString(ip);
        registration.serverId = myid;

        // We start up as an observer, and then we try to upgrade to participant
        registration.type = ZookeeperClusterRegistration.OBSERVER;
View Full Code Here


        File confFile = getConfigFile();
        Files.write(writer.toString().getBytes(Charsets.UTF_8), confFile);
    }

    void writeConfig(ClusterSnapshot snapshot, int myid, PrintWriter writer) {
        ZookeeperClusterRegistration me = snapshot.servers.get(myid);

        if (me == null) {
            throw new IllegalStateException();
        }

        writer.println("peerType=" + me.type);

        writer.println("dataDir=" + getDataDir().getAbsolutePath());
        writer.println("dataLogDir=" + getLogsDir().getAbsolutePath());
        writer.println("syncLimit=2");
        writer.println("initLimit=2");

        boolean newFormat = false;
        if (!newFormat) {
            writer.println("clientPort=2181");
        }

        for (Entry<Integer, ZookeeperClusterRegistration> entry : snapshot.servers.entrySet()) {
            int serverId = entry.getKey();
            ZookeeperClusterRegistration registration = entry.getValue();

            String serverName = "zk_" + serverId;
            if (!newFormat) {
                writer.println(String.format("server.%s=%s:2182:2183", serverId, serverName));
            } else {
View Full Code Here

    public void writeHosts(ClusterSnapshot snapshot) throws IOException {
        Map<String, String> hosts = Maps.newHashMap();

        for (Entry<Integer, ZookeeperClusterRegistration> entry : snapshot.servers.entrySet()) {
            int serverId = entry.getKey();
            ZookeeperClusterRegistration registration = entry.getValue();

            String zkHost = "zk_" + serverId;
            String ip = registration.ip;

            hosts.put(zkHost, ip);
View Full Code Here

        this.cluster = new ZookeeperCluster(clusterPath, lockPath.buildLock());
    }

    public void run() throws IOException {
        ZookeeperClusterRegistration registration = cluster.register();

        int myid = registration.serverId;

        File installDir = new File("/opt/zookeeper");
        File instanceDir = new File("/var/zookeeper");
View Full Code Here

TOP

Related Classes of io.fathom.auto.zookeeper.model.ZookeeperClusterRegistration

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.