Package kafka.deploy.utils.command

Examples of kafka.deploy.utils.command.CommandParameterizer


        if(logger.isInfoEnabled())
            logger.info("Starting Zookeeper cluster");

        Map<String, String> hostNameCommandLineMap = new HashMap<String, String>();
       
        CommandParameterizer commandLineParameterizer = new CommandParameterizer("SshZkStarterMid", CommandType.COMMAND_ID),
                             commandLineParameterizer2;
       
        // Generate server.<node_id>=<host_name>:2888:3888 list
        StringBuilder builder = new StringBuilder();
        if ( hostNames.size() > 1) {
          Map<String, String> parameters = new HashMap<String, String>();
          parameters.put(CommandParameterizer.ZK_CONFIG_PARAM, zkConfigFile);
       
          int nodeId = 1;
          for ( String hostName : hostNames) {
            parameters.put(CommandParameterizer.ZK_NODE_ID_PARAM, Integer.toString(nodeId));
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            builder.append(commandLineParameterizer.parameterize(parameters));
            nodeId++;
          }
        }
       
        // Generate commands for every host
        int nodeId = 1;
        for(String hostName: hostNames) {
          commandLineParameterizer = new CommandParameterizer("SshZkStarter.ssh" + (sshPrivateKey != null ? ""
                                                        : ".nokey"),
                                                        CommandType.COMMAND_ID);
          commandLineParameterizer2 = new CommandParameterizer("SshZkStarterEnd", CommandType.COMMAND_ID);
         
          Map<String, String> parameters = new HashMap<String, String>();
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            parameters.put(CommandParameterizer.HOST_USER_ID_PARAM, hostUserId);
            parameters.put(CommandParameterizer.SSH_PRIVATE_KEY_PARAM,
                           sshPrivateKey != null ? sshPrivateKey.getAbsolutePath() : null);
            parameters.put(CommandParameterizer.KAFKA_ROOT_DIRECTORY_PARAM, kafkaRootDirectory);
            parameters.put(CommandParameterizer.ZK_CONFIG_PARAM, zkConfigFile);
            parameters.put(CommandParameterizer.ZK_PORT_PARAM, Integer.toString(zkPort));
            parameters.put(CommandParameterizer.ZK_NODE_ID_PARAM, Integer.toString(nodeId));
            parameters.put(CommandParameterizer.ZK_DATA_DIR_PARAM, zkDataDir);

            hostNameCommandLineMap.put(hostName, commandLineParameterizer.parameterize(parameters)
                                             + builder.toString()
                                             + commandLineParameterizer2.parameterize(parameters));
            nodeId++;
        }
View Full Code Here


        if(!sourceDirectory.isDirectory())
            throw new RemoteOperationException("Directory " + sourceDirectory.getAbsolutePath()
                                               + " is not a directory");

        CommandParameterizer commandLineParameterizer = new CommandParameterizer("RsyncDeployer.rsync"
                                                                                 + (sshPrivateKey != null ? ""
                                                                                 : ".nokey"),
                                                                                 CommandType.COMMAND_ID);
       
        Map<String, String> hostNameCommandLineMap = new HashMap<String, String>();

        for(String hostName: hostNames) {
            Map<String, String> parameters = new HashMap<String, String>();
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            parameters.put(CommandParameterizer.HOST_USER_ID_PARAM, hostUserId);
            parameters.put(CommandParameterizer.SSH_PRIVATE_KEY_PARAM,
                           sshPrivateKey != null ? sshPrivateKey.getAbsolutePath() : null);
            parameters.put(CommandParameterizer.KAFKA_ROOT_DIRECTORY_PARAM, kafkaRootDirectory);
            parameters.put(CommandParameterizer.SOURCE_DIRECTORY_PARAM, sourceDirectory.getAbsolutePath());

            hostNameCommandLineMap.put(hostName, commandLineParameterizer.parameterize(parameters));
        }

        execute(hostNameCommandLineMap);

        if(logger.isInfoEnabled())
View Full Code Here

    @Override
    public void execute() throws RemoteOperationException {
        if(logger.isInfoEnabled())
            logger.info("Stopping Zookeeper cluster");

        CommandParameterizer commandLineParameterizer = new CommandParameterizer("SshZkStopper.ssh"
                                                                                 + (sshPrivateKey != null ? ""
                                                                                 : ".nokey"),
                                                                                 CommandType.COMMAND_ID);
       
        Map<String, String> hostNameCommandLineMap = new HashMap<String, String>();

        for(String hostName: hostNames) {
            Map<String, String> parameters = new HashMap<String, String>();
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            parameters.put(CommandParameterizer.HOST_USER_ID_PARAM, hostUserId);
            parameters.put(CommandParameterizer.SSH_PRIVATE_KEY_PARAM,
                           sshPrivateKey != null ? sshPrivateKey.getAbsolutePath() : null);
            parameters.put(CommandParameterizer.KAFKA_ROOT_DIRECTORY_PARAM, kafkaRootDirectory);

            hostNameCommandLineMap.put(hostName, commandLineParameterizer.parameterize(parameters));
        }

        execute(hostNameCommandLineMap);

        if(logger.isInfoEnabled())
View Full Code Here

          for ( String zkHostName : zkHostNames) {
            builder.append( zkHostName + ":" + zkPort + ",");
          }
        }
       
        CommandParameterizer commandLineParameterizer = new CommandParameterizer("SshBrokerStarter.ssh"
                                                                                 + (sshPrivateKey != null ? ""
                                                                                 : ".nokey"),
                                                                                 CommandType.COMMAND_ID);
       
        Map<String, String> hostNameCommandLineMap = new HashMap<String, String>();

        for(String hostName: hostNames) {
            Map<String, String> parameters = new HashMap<String, String>();
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            parameters.put(CommandParameterizer.HOST_USER_ID_PARAM, hostUserId);
            parameters.put(CommandParameterizer.SSH_PRIVATE_KEY_PARAM,
                           sshPrivateKey != null ? sshPrivateKey.getAbsolutePath() : null);
            parameters.put(CommandParameterizer.KAFKA_ROOT_DIRECTORY_PARAM, kafkaRootDirectory);
            parameters.put(CommandParameterizer.KAFKA_BROKER_CONFIG_PARAM, kafkaConfig);
            parameters.put(CommandParameterizer.KAFKA_LOG_DIRECTORY_PARAM, kafkaLog);
            parameters.put(CommandParameterizer.KAFKA_BROKER_ID_PARAM, brokerIds.get(hostName).toString());
            parameters.put(CommandParameterizer.ENABLE_ZK_PARAM, enableZk ? "true" : "false");
            parameters.put(CommandParameterizer.ZK_CONNECT_PARAM, enableZk ? builder.toString() : "");
           
            hostNameCommandLineMap.put(hostName, commandLineParameterizer.parameterize(parameters));
        }

        execute(hostNameCommandLineMap);
       
        if(logger.isInfoEnabled())
View Full Code Here

    @Override
    public void execute() throws RemoteOperationException {
        if(logger.isInfoEnabled())
            logger.info("Stopping Kafka brokers");

        CommandParameterizer commandLineParameterizer = new CommandParameterizer("SshBrokerStopper.ssh"
                                                                                 + (sshPrivateKey != null ? ""
                                                                                 : ".nokey"),
                                                                                 CommandType.COMMAND_ID);
       
        Map<String, String> hostNameCommandLineMap = new HashMap<String, String>();

        for(String hostName: hostNames) {
            Map<String, String> parameters = new HashMap<String, String>();
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            parameters.put(CommandParameterizer.HOST_USER_ID_PARAM, hostUserId);
            parameters.put(CommandParameterizer.SSH_PRIVATE_KEY_PARAM,
                           sshPrivateKey != null ? sshPrivateKey.getAbsolutePath() : null);
            parameters.put(CommandParameterizer.KAFKA_ROOT_DIRECTORY_PARAM, kafkaRootDirectory);

            hostNameCommandLineMap.put(hostName, commandLineParameterizer.parameterize(parameters));
        }

        execute(hostNameCommandLineMap);

        if(logger.isInfoEnabled())
View Full Code Here

    public void execute() throws RemoteOperationException {
        if(logger.isInfoEnabled())
            logger.info("Started remote class " + className);

        CommandParameterizer commandLineParameterizer = new CommandParameterizer("SshRunner.ssh"
                                                                                 + (sshPrivateKey != null ? ""
                                                                                 : ".nokey"),
                                                                                 CommandType.COMMAND_ID);
       
        Map<String, String> hostNameCommandLineMap = new HashMap<String, String>();

        for(String hostName: hostNames) {
            Map<String, String> parameters = new HashMap<String, String>();
            parameters.put(CommandParameterizer.HOST_NAME_PARAM, hostName);
            parameters.put(CommandParameterizer.HOST_USER_ID_PARAM, hostUserId);
            parameters.put(CommandParameterizer.SSH_PRIVATE_KEY_PARAM,
                           sshPrivateKey != null ? sshPrivateKey.getAbsolutePath() : null);
            parameters.put(CommandParameterizer.KAFKA_ROOT_DIRECTORY_PARAM, kafkaRootDirectory);
            parameters.put(CommandParameterizer.CLASS_NAME_PARAM, className);
           
            CommandParameterizer parameterizer = new CommandParameterizer(params, CommandType.RAW_COMMAND);
            parameters.put(CommandParameterizer.PARAMETERS_PARAM, parameterizer.parameterize(parameters));

            hostNameCommandLineMap.put(hostName, commandLineParameterizer.parameterize(parameters));
        }

        execute(hostNameCommandLineMap);
View Full Code Here

TOP

Related Classes of kafka.deploy.utils.command.CommandParameterizer

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.