web_backend_develope
wu ming 8 years ago
commit 7bcc95e0d4

@ -56,6 +56,7 @@ gather-table-user-password=user
#kuber's url must exist #kuber's url must exist
kubeMasterUrl=http://192.168.0.110:8080/ kubeMasterUrl=http://192.168.0.110:8080/
kubeMasterAddress=192.168.0.110:8080 kubeMasterAddress=192.168.0.110:8080
collect-user-name=system collect-user-name=system

@ -58,7 +58,7 @@ public class CheckoutController extends BaseController {
} }
/** /**
* ---- * ----
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ -95,7 +95,7 @@ public class CheckoutController extends BaseController {
} }
/** /**
* ---- * ----
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ -116,7 +116,7 @@ public class CheckoutController extends BaseController {
} }
/** /**
* ---- -> * ----( )
* @return * @return
* @throws Exception * @throws Exception
*/ */

@ -197,8 +197,10 @@ public class DataModelController extends BaseController {
if (oraclesName != null) if (oraclesName != null)
for (String rcName : oraclesName) { for (String rcName : oraclesName) {
log.info("执行连接\t" + rcName); log.info("执行连接\t" + rcName);
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
+ " label --overwrite rc " + rcName + " status=0"; + " label --overwrite rc " + rcName + " status=0";
List<String> rList = Constant.ganymedSSH List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd); .execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@ -382,7 +384,7 @@ public class DataModelController extends BaseController {
} }
/** /**
* *
* *
* @return * @return
* @throws Exception * @throws Exception
@ -416,6 +418,32 @@ public class DataModelController extends BaseController {
return result; return result;
} }
/**
*
*
* @param res
* @param req
* @param id
* @return
* @throws Exception
*/
@RequestMapping(value = "/task/transfer/deletes", method = RequestMethod.POST)
@ResponseBody
public Object taskTransferDeletes(HttpServletRequest res,
HttpServletResponse req, @RequestBody String[] ids) throws Exception {
log.info("---------/task/transfer/deletes----------------------");
req.setStatus(200);
int result = 0;
if (ids != null ) {
// String[] ids = idsString.split(",");
result = moveDataService.delete(ids);
}
else {
req.setStatus(500);
}
return result;
}
/** /**
* *
* *

@ -39,13 +39,13 @@ public class PagerOptions extends Page{
private Integer offset; // 查询偏移量起始id private Integer offset; // 查询偏移量起始id
private String keyQuery; private String keyQuery;//模糊查询字段
//模糊查询字段
private List<String> array;
private String volumeType; private List<String> array;//模糊查询字段数组
//冷热区字段
private String mark; private String volumeType;//冷热区字段
private String mark;//冷热区字段
public String getDataType() { public String getDataType() {
return dataType; return dataType;

@ -5,10 +5,20 @@ import java.util.Properties;
import com.platform.entities.SqlFileInfoEntity; import com.platform.entities.SqlFileInfoEntity;
/**
* @author chen
*
*/
public class ScriptForm { public class ScriptForm {
/**
*
*/
private String content; private String content;
/**
*
*/
private SqlFileInfoEntity item; private SqlFileInfoEntity item;
/** /**

@ -29,9 +29,9 @@ public class VolumeForm {
/** 挂载点 */ /** 挂载点 */
private String path; private String path;
/** * exist正常返回状态Started,Stopped,Created */
private boolean status; private boolean status;
/** * exist正常返回状态Started,Stopped,Created */
private String type; private String type;
/** volume树形目录 */ /** volume树形目录 */

@ -5,16 +5,25 @@ import java.util.List;
import com.platform.entities.DataInfoEntity; import com.platform.entities.DataInfoEntity;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
/**--volume /**--
* @author chen * @author chen
* *
*/ */
public class volumeMoveForm { public class volumeMoveForm {
/**
* volume
*/
private String name; private String name;
/**
*
*/
private FolderNode selectNode; private FolderNode selectNode;
/**
*
*/
private List<DataInfoEntity> selectItems; private List<DataInfoEntity> selectItems;
/** /**

@ -32,6 +32,12 @@ public interface IMoveDataService {
*/ */
public int delete(DataInfoEntityMoveTmp dataMove) throws Exception; public int delete(DataInfoEntityMoveTmp dataMove) throws Exception;
/**
* @return
* @throws Exception
*/
public int delete(String... ids) throws Exception;
/** -- /** --
* @param data * @param data
* @return * @return

@ -78,7 +78,7 @@ public class CheckoutServiceImpl implements ICheckoutService {
DataInfoEntity data = new DataInfoEntity(); DataInfoEntity data = new DataInfoEntity();
Calendar c2 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance();
// 时间设置为 半年前的时间 // 时间设置为 半年前的时间
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH))); this.getMonBeforeHalfYear(c2);
String time = DateForm.date2StringByDay(c2.getTime()); String time = DateForm.date2StringByDay(c2.getTime());
data.setCollectingTime(time); data.setCollectingTime(time);
// data.setCollectingTime(collectingTime); // data.setCollectingTime(collectingTime);
@ -124,7 +124,7 @@ public class CheckoutServiceImpl implements ICheckoutService {
CheckoutEntity cksql = new CheckoutEntity(); CheckoutEntity cksql = new CheckoutEntity();
Calendar c2 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance();
// 时间设置为 半年前的时间 // 时间设置为 半年前的时间
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH))); this.getMonBeforeHalfYear(c2);
String time = DateForm.date2StringByDay(c2.getTime()); String time = DateForm.date2StringByDay(c2.getTime());
cksql.setCollectingTime(time); cksql.setCollectingTime(time);
cksql.setCityName(city); cksql.setCityName(city);
@ -451,12 +451,9 @@ public class CheckoutServiceImpl implements ICheckoutService {
* @param num * @param num
* @return * @return
*/ */
private int getMonBeforeHalfYear(int num){ private int getMonBeforeHalfYear(Calendar c2){
num -= Configs.dataBefore; c2.set(Calendar.DAY_OF_YEAR, c2.get(Calendar.DAY_OF_YEAR) -(Configs.dataBefore*30));
if (num <= 0) { return 1;
num = num + 12;
}
return num;
} }
private String isY(String str1, String str2) { private String isY(String str1, String str2) {

@ -210,11 +210,14 @@ public class MoveDataServiceImpl implements IMoveDataService {
} }
} }
int result = 0;
//迁移失败 //迁移失败
if ("3".equals(dataMove.getCompleteStatus())) { if ("3".equals(dataMove.getCompleteStatus())) {
removeservice.deleteFolder(dataMove.getDstPath()); int code = removeservice.deleteFolder(dataMove.getDstPath());
if (code == -100) {
return result;
}
} }
int result = 0;
//是正则迁移时: //是正则迁移时:
if ("1".equals(dataMove.getCompleteStatus())) { if ("1".equals(dataMove.getCompleteStatus())) {
if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){ if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
@ -263,4 +266,42 @@ public class MoveDataServiceImpl implements IMoveDataService {
} }
return dstPath; return dstPath;
} }
@Override
public int delete(String... ids) throws Exception {
List<DataInfoEntityMoveTmp> list = dataInfoMoveTmpDao.findAll();
List<DataInfoEntityMoveTmp> dellist = new ArrayList<DataInfoEntityMoveTmp>();
if (null != list) {
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : list) {
for (String id : ids) {
if (Integer.valueOf(id) == dataInfoEntityMoveTmp.getId()) {
dellist.add(dataInfoEntityMoveTmp);
}
}
}
}
int result = 0;
for (DataInfoEntityMoveTmp dataMove : dellist) {
//迁移失败
if ("3".equals(dataMove.getCompleteStatus())) {
int code = removeservice.deleteFolder(dataMove.getDstPath());
if (code == -100) {
continue;
}
}
//是正则迁移时:
if ("1".equals(dataMove.getCompleteStatus())) {
if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
try{
removeservice.deleteFolder(dataMove.getDstPath());
}catch(Exception e){
log.error(e);
}
}
}
result = dataInfoMoveTmpDao.remove(dataMove.getId());
}
return result;
}
} }

@ -86,9 +86,11 @@ public class ThreadCheckoutStandardOracle extends Thread {
connectOracle(tmpPod, key); connectOracle(tmpPod, key);
if (i == 10) { if (i == 10) {
String cmd = "kubectl --server " String cmd = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS + Configs.KUBE_MASTER_ADDRESS
+ " label --overwrite rc " + key + " status=1"; + " label --overwrite rc " + key + " status=1";
List<String> rList = Constant.ganymedSSH List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd); .execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
@ -98,6 +100,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
+ "\t[标签更新为: 失败]"); + "\t[标签更新为: 失败]");
log.info(sb.toString()); log.info(sb.toString());
String cmd2 = "kubectl --server " String cmd2 = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS + Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key + " annotate --overwrite rc " + key
@ -175,8 +178,10 @@ public class ThreadCheckoutStandardOracle extends Thread {
+ ",password:" + Configs.ORACLE_PSW); + ",password:" + Configs.ORACLE_PSW);
String message = "失败"; String message = "失败";
String cmd3 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS String cmd3 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key + " checkoutFlag=0"; + " annotate --overwrite rc " + key + " checkoutFlag=0";
List<String> rList3 = Constant.ganymedSSH List<String> rList3 = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd3); .execCmdWaitAcquiescent(cmd3);
StringBuffer sb3 = new StringBuffer(); StringBuffer sb3 = new StringBuffer();
@ -186,9 +191,11 @@ public class ThreadCheckoutStandardOracle extends Thread {
log.info("更新replicationController标签 " + key + "\t[标签更新为:未校验]"); log.info("更新replicationController标签 " + key + "\t[标签更新为:未校验]");
if (flag) { if (flag) {
String cmd = "kubectl --server " String cmd = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS + Configs.KUBE_MASTER_ADDRESS
+ " label --overwrite rc " + key + " status=2"; + " label --overwrite rc " + key + " status=2";
// 设置服务为 成功 // 设置服务为 成功
List<String> rList = Constant.ganymedSSH List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd); .execCmdWaitAcquiescent(cmd);
@ -200,6 +207,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
log.info("更新replicationController标签 " + key log.info("更新replicationController标签 " + key
+ "\t[标签更新为: 成功]"); + "\t[标签更新为: 成功]");
// 校验标签 // 校验标签
String cmd2 = "kubectl --server " String cmd2 = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS + Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key + " annotate --overwrite rc " + key
@ -277,6 +285,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
/* CacheOracleCheckoutEntity.putExtract(key, */CacheOracleCheckoutEntity /* CacheOracleCheckoutEntity.putExtract(key, */CacheOracleCheckoutEntity
.checkRemove(key)/* ) */; .checkRemove(key)/* ) */;
// 更新kuber状态 // 更新kuber状态
cmd2 = "kubectl --server " cmd2 = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS + Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key + " annotate --overwrite rc " + key

@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -154,10 +155,11 @@ public class ThreadExtractStandardSqlServer extends Thread{
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
Connection conn = null;
try { try {
File execSql = new File(execFilePath); conn = OracleConnector.connectionBuilder("jdbc:oracle:thin:@" + oracleConnect.getIp() + ":" + oracleConnect.getPort() + ":"
Connection conn = OracleConnector.connectionBuilder("jdbc:oracle:thin:@" + oracleConnect.getIp() + ":" + oracleConnect.getPort() + ":"
+ oracleConnect.getDatabaseName(), oracleConnect.getUser(), oracleConnect.getPassword(), null); + oracleConnect.getDatabaseName(), oracleConnect.getUser(), oracleConnect.getPassword(), null);
File execSql = new File(execFilePath);
// 创建表空间 创建 抽取标准表的 用户并授权 // 创建表空间 创建 抽取标准表的 用户并授权
oracleExtract.createTableSpace(conn, collectOracle , oracleConnect); // oracleExtract.createTableSpace(conn, collectOracle , oracleConnect); //
oracleExtract.createOnlyUser(conn, collectOracle, oracleConnect);// oracleExtract.createOnlyUser(conn, collectOracle, oracleConnect);//
@ -199,8 +201,17 @@ public class ThreadExtractStandardSqlServer extends Thread{
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
//删除保存过的id //删除保存过的id
CacheSetCantDelete.removeStandardId(String.valueOf(element.getDataId())); CacheSetCantDelete.removeStandardId(String.valueOf(element.getDataId()));
// sql日志记录时间 // sql日志记录时间

@ -30,6 +30,7 @@ public class Configs {
public static String KUBE_MASTER_ADDRESS="127.0.0.1:8080"; public static String KUBE_MASTER_ADDRESS="127.0.0.1:8080";
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号 public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名 public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名

@ -114,6 +114,9 @@ public class GanymedSSH {
Session sess = null; Session sess = null;
try { try {
// conn = getOpenedConnection(host, username, password, port); // conn = getOpenedConnection(host, username, password, port);
if (null != conn) {
// conn=getOpenedConnection(Configs., username, password, port)
}
sess = conn.openSession(); sess = conn.openSession();
// 执锟斤拷cmd // 执锟斤拷cmd
sess.execCommand(cmd); sess.execCommand(cmd);

Loading…
Cancel
Save