use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class CreateReplicationUtil method createMasterTaskGroup.
/**
*
* Fill in the related tasks of creating master to executor according master
* information
*
* @param master MasterNode
* @param slaveList List<SlaveNode>
* @param executor CreateReplicationJobExecutor
* @return null or error message
*/
public static String createMasterTaskGroup(MasterNode master, List<SlaveNode> slaveList, CreateReplicationJobExecutor executor) {
TaskGroup taskGroup = new TaskGroup(IConstants.REPL_GROUP_NAME_CREATE_MASTER);
taskGroup.setTarget(master.getDbName());
HostNode masterHost = (HostNode) master.getParent();
final String ip = masterHost.getIp();
final String port = masterHost.getPort();
final String userName = masterHost.getUserName();
final String password = masterHost.getPassword();
boolean isConnected = ServerManager.getInstance().isConnected(ip, Integer.parseInt(port), userName);
ServerInfo serverInfo = new ServerInfo();
if (isConnected) {
serverInfo = ServerManager.getInstance().getServer(ip, Integer.parseInt(port), userName);
if (!serverInfo.getLoginedUserInfo().isAdmin()) {
return Messages.bind(Messages.errInvalidUser, ip);
}
} else {
serverInfo.setHostAddress(ip);
serverInfo.setHostMonPort(Integer.parseInt(port));
serverInfo.setHostJSPort(Integer.parseInt(port) + 1);
serverInfo.setUserName(userName);
serverInfo.setUserPassword(password);
MonitoringTask monitoringTask = new MonitoringTask(serverInfo);
taskGroup.addTask(monitoringTask);
}
GetReplServerStatusTask getReplServerStatusTask = new GetReplServerStatusTask(serverInfo);
getReplServerStatusTask.setDbName(master.getDbName());
taskGroup.addTask(getReplServerStatusTask);
StopReplServerTask stopReplServerTask = new StopReplServerTask(serverInfo);
stopReplServerTask.setDbName(master.getDbName());
taskGroup.addTask(stopReplServerTask);
GetCubridConfParameterTask getCubridConfParameterTask = new GetCubridConfParameterTask(serverInfo);
getCubridConfParameterTask.putData("dbName", master.getDbName());
taskGroup.addTask(getCubridConfParameterTask);
SetCubridConfParameterTask setCubridConfParameterTask = new SetCubridConfParameterTask(serverInfo);
taskGroup.addTask(setCubridConfParameterTask);
GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
getDatabaseListTask.putData("dbName", master.getDbName());
taskGroup.addTask(getDatabaseListTask);
CommonUpdateTask stopDbTask = new CommonUpdateTask(CommonTaskName.STOP_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
stopDbTask.setDbName(master.getDbName());
taskGroup.addTask(stopDbTask);
CommonUpdateTask startDbTask = new CommonUpdateTask(CommonTaskName.START_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
startDbTask.setDbName(master.getDbName());
taskGroup.addTask(startDbTask);
BackupDbTask backupDbTask = new BackupDbTask(serverInfo);
backupDbTask.setDbName(master.getDbName());
backupDbTask.setLevel("0");
backupDbTask.setVolumeName(master.getDbName() + "_bk0v000");
backupDbTask.setBackupDir(master.getDbPath());
backupDbTask.setRemoveLog(false);
backupDbTask.setCheckDatabaseConsist(true);
backupDbTask.setThreadCount(String.valueOf(0));
backupDbTask.setZiped(false);
backupDbTask.setSafeReplication(false);
taskGroup.addTask(backupDbTask);
CancelTransFileTask cancelTransFileTask = new CancelTransFileTask(serverInfo);
taskGroup.addTask(cancelTransFileTask);
for (int i = 0; i < slaveList.size(); i++) {
SlaveNode slave = slaveList.get(i);
HostNode slaveHost = (HostNode) slave.getParent();
TransFileTask transFileTask = new TransFileTask(serverInfo);
transFileTask.setMasterDbDir(master.getDbPath());
List<String> fileList = new ArrayList<String>();
fileList.add(master.getDbName() + "_bk0v000");
fileList.add(master.getDbName() + "_bkvinf");
transFileTask.setBackupFileList(fileList);
transFileTask.setSlaveDbHost(slaveHost.getIp());
transFileTask.setSlaveCmServerPort(String.valueOf(Integer.parseInt(slaveHost.getPort()) + 1));
transFileTask.setSlaveDbDir(slave.getDbPath());
taskGroup.addTask(transFileTask);
GetTransferProgressTask getTransferProgressTask = new GetTransferProgressTask(serverInfo);
taskGroup.addTask(getTransferProgressTask);
}
executor.addGroupTask(taskGroup);
return null;
}
use of com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask in project cubrid-manager by CUBRID.
the class ConfigParaHelp method performImportCubridConf.
/**
* Perform the import task for cubrid.conf
*
* @param serverInfo the CubridServer
* @param confParamList the List<String>
*/
public static void performImportCubridConf(ServerInfo serverInfo, List<String> confParamList) {
CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setCubridParameterTaskName);
SetCubridConfParameterTask task = new SetCubridConfParameterTask(serverInfo);
task.setConfContents(confParamList);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgChangeServerParaSuccess);
}
}
Aggregations