web_backend_develope
chenlw 8 years ago
parent 2aeb726bcd
commit e401c4951c

@ -140,6 +140,7 @@ public class SetVolume {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("volumeName", volumeName); map.put("volumeName", volumeName);
//请求web //请求web
this.stopVolume(volumeName);
String rest = ht.sendPost("gfs/deleteVolume", map); String rest = ht.sendPost("gfs/deleteVolume", map);
if (null == rest || "".equals(rest)) { if (null == rest || "".equals(rest)) {
log.error(" --- gluster is disconnect ! \n"); log.error(" --- gluster is disconnect ! \n");
@ -176,7 +177,7 @@ public class SetVolume {
map.put("volumeName", volumeName); map.put("volumeName", volumeName);
map.put("bricks", brickName); map.put("bricks", brickName);
//请求web //请求web
String rest = ht.sendPost("gfs/addABricks", map); String rest = ht.sendPost("gfs/addBricks", map);
if (null == rest || "".equals(rest)) { if (null == rest || "".equals(rest)) {
log.error(" --- gluster is disconnect ! \n"); log.error(" --- gluster is disconnect ! \n");
return 0; return 0;

@ -292,21 +292,27 @@ public class OracleExtractHelper {
+ ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName() + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName()
+ ")))\'"; + ")))\'";
if (null != oc) { if (null != oc) {
if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_LOG_LOCALTION + oc.getName()+".log")) { // 如果dblink已经存在,先删除dblink在创建dblink if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()+".log")) { // 如果dblink已经存在,先删除dblink在创建dblink
String deleteSql = "DROP PUBLIC DATABASE LINK " String deleteSql = "DROP PUBLIC DATABASE LINK "
+ linkName; + linkName;
//删除 dblink //删除 dblink
if (OracleConnector.execOracleSQL(conn, deleteSql, Configs.EXTRACT_LOG_LOCALTION + oc.getName())) { if (OracleConnector.execOracleSQL(conn, deleteSql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) {
OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName()); // OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
if(!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())){
OracleConnector.execUpdateOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
}
} else { } else {
Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!"); Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!");
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION
+ oc.getName()+".log", "删除已有的DBLink失败,无法创建新的DBLink!"+"\r\n"); + oc.getName()+".log", "删除已有的DBLink失败,无法创建新的DBLink!"+"\r\n");
} }
} else { } else {
// 否则创建dblink // 否则创建dblink
OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName()); // OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
if(!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())){
OracleConnector.execUpdateOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName());
}
} }
} }
} }

@ -164,6 +164,7 @@ public class MoveDataServiceImpl implements IMoveDataService {
dataMove.setDstVolumePath(path); dataMove.setDstVolumePath(path);
dataMove.setDstVolumeIp(ip); dataMove.setDstVolumeIp(ip);
} }
dataMove.setCompleteStatus("0");
moveList.add(dataMove); moveList.add(dataMove);
} }
if (moveList.size() > 0) { if (moveList.size() > 0) {

@ -70,25 +70,25 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
return false; return false;
} }
for (OracleConnectorParams collectOracle : datainfos) { for (OracleConnectorParams collectOracle : datainfos) {
String replicasName = collectOracle.getName();
try{
if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){ if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){
DataInfoEntity data = new DataInfoEntity(); DataInfoEntity data = new DataInfoEntity();
data.setId(Integer.valueOf(collectOracle.getDataId())); data.setId(Integer.valueOf(collectOracle.getDataId()));
data.setExtractStatus(1); data.setExtractStatus(1);
dataInfoDao.updateExtract(data); dataInfoDao.updateExtract(data);
String replicasName = collectOracle.getName();
collectOracle.setName("J" + collectOracle.getName().replace("-", "_")); collectOracle.setName("J" + collectOracle.getName().replace("-", "_"));
String cmd = "kubectl label --overwrite rc " String cmd = "kubectl label --overwrite rc "
+ replicasName + " isExtract=1"; + replicasName + " isExtract=1";
//sql日志记录时间
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ collectOracle.getName()+".log", "\r\n 开始汇总 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n");
List<String> rList = Constant.ganymedSSH List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd); .execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (String string : rList) for (String string : rList)
sb.append(string).append("\n"); sb.append(string).append("\n");
Configs.CONSOLE_LOGGER.info(sb.toString()); Configs.CONSOLE_LOGGER.info(sb.toString());
//sql日志记录时间
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ collectOracle.getName()+".log", "\r\n\r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n");
// client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成 // client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成
oracleExtract.createDBLink(conn, collectOracle); //创建dblink oracleExtract.createDBLink(conn, collectOracle); //创建dblink
oracleExtract.createTableSpace(conn, collectOracle, oracleModel); //创建表空间 oracleExtract.createTableSpace(conn, collectOracle, oracleModel); //创建表空间
@ -105,6 +105,17 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
data.setExtractStatus(2); data.setExtractStatus(2);
dataInfoDao.updateExtract(data); dataInfoDao.updateExtract(data);
} }
}catch(Exception e){
log.error(Custom4exception.OracleSQL_Except, e);
}
finally{
//sql日志记录时间
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ collectOracle.getName()+".log", "\r\n 汇总结束 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n");
String cmd = "kubectl label --overwrite rc "
+ replicasName + " isExtract=2";
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
}
} }
isSuccess = true; isSuccess = true;
}catch(Exception e){ }catch(Exception e){
@ -149,6 +160,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
return false; return false;
} }
for (OracleConnectorParams collectOracle : datainfos) { for (OracleConnectorParams collectOracle : datainfos) {
String replicasName = collectOracle.getName();
try{ try{
if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){ if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){
DataInfoEntity data = new DataInfoEntity(); DataInfoEntity data = new DataInfoEntity();
@ -157,19 +169,18 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX); data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX);
data.setStandardExtractStatus("1"); data.setStandardExtractStatus("1");
dataInfoDao.update(data); dataInfoDao.update(data);
String replicasName = collectOracle.getName();
collectOracle.setName("CQ" + collectOracle.getName().replace("-", "_")); collectOracle.setName("CQ" + collectOracle.getName().replace("-", "_"));
String cmd = "kubectl annotate --overwrite rc " String cmd = "kubectl annotate --overwrite rc "
+ replicasName + " standardExtractStatus=1"; + replicasName + " standardExtractStatus=1";
//sql日志记录时间
FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION
+ collectOracle.getName()+".log", "\r\n 开始抽取标准表 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n");
List<String> rList = Constant.ganymedSSH List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd); .execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (String string : rList) for (String string : rList)
sb.append(string).append("\n"); sb.append(string).append("\n");
Configs.CONSOLE_LOGGER.info(sb.toString()); Configs.CONSOLE_LOGGER.info(sb.toString());
//sql日志记录时间
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ collectOracle.getName()+".log", "\r\n\r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n");
// client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成 // client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成
oracleExtract.createStandardDBLink(conn, collectOracle); //创建dblink oracleExtract.createStandardDBLink(conn, collectOracle); //创建dblink
oracleExtract.createTableSpace(conn, collectOracle, oracleModel); //创建表空间 oracleExtract.createTableSpace(conn, collectOracle, oracleModel); //创建表空间
@ -233,6 +244,14 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
}catch(Exception e){ }catch(Exception e){
log.error(Custom4exception.OracleSQL_Except, e); log.error(Custom4exception.OracleSQL_Except, e);
} }
finally{
//sql日志记录时间
FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION
+ collectOracle.getName()+".log", "\r\n 抽取标准表结束 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n");
String cmd = "kubectl annotate --overwrite rc "
+ replicasName + " standardExtractStatus=2";
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
}
} }
isSuccess = true; isSuccess = true;
}catch(Exception e){ }catch(Exception e){

@ -77,20 +77,6 @@ public class ThreadMoveData{
log.error(e); log.error(e);
} }
Map<String, TaskOperateData> taskMap = new HashMap<String, TaskOperateData>(); Map<String, TaskOperateData> taskMap = new HashMap<String, TaskOperateData>();
if (result.size() > 0) {
List<TaskOperateData> list = new ArrayList<TaskOperateData>();
try {
list = copy.operationTask();
} catch (Exception e) {
log.error("copy.operationTask()");
log.error(e);
}
for (TaskOperateData taskOperateData : list) {
taskMap.put(FileOperateHelper.addLastLinuxSeparator(taskOperateData.getSourcePath())
+ "-" + FileOperateHelper.addLastLinuxSeparator(taskOperateData.getDestPath()),
taskOperateData);
}
}
for ( DataInfoEntityMoveTmp moveE : result) { for ( DataInfoEntityMoveTmp moveE : result) {
switch (moveE.getCompleteStatus()) { switch (moveE.getCompleteStatus()) {
//待迁移 //待迁移
@ -119,6 +105,20 @@ public class ThreadMoveData{
//正则迁移 status = 1表示正在迁移(如果 web gfs 迁移成功 则 增加一条记录) //正则迁移 status = 1表示正在迁移(如果 web gfs 迁移成功 则 增加一条记录)
if(subMove[1].size() > 0){ if(subMove[1].size() > 0){
//请求进度
List<TaskOperateData> list = new ArrayList<TaskOperateData>();
try {
list = copy.operationTask();
} catch (Exception e) {
log.error("copy.operationTask()");
log.error(e);
}
for (TaskOperateData taskOperateData : list) {
taskMap.put(FileOperateHelper.addLastLinuxSeparator(taskOperateData.getSourcePath())
+ "-" + FileOperateHelper.addLastLinuxSeparator(taskOperateData.getDestPath()),
taskOperateData);
}
for (DataInfoEntityMoveTmp moveE : subMove[1]) { for (DataInfoEntityMoveTmp moveE : subMove[1]) {
TaskOperateData taskOne = taskMap.get(FileOperateHelper.addLastLinuxSeparator(moveE.getDataPath()) TaskOperateData taskOne = taskMap.get(FileOperateHelper.addLastLinuxSeparator(moveE.getDataPath())
+"-"+FileOperateHelper.addLastLinuxSeparator(makeDstPath(moveE.getDstPath()))); +"-"+FileOperateHelper.addLastLinuxSeparator(makeDstPath(moveE.getDstPath())));

Loading…
Cancel
Save