web_backend_develope
wu ming 8 years ago
commit 7bcc95e0d4

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

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

@ -197,8 +197,10 @@ public class DataModelController extends BaseController {
if (oraclesName != null)
for (String rcName : oraclesName) {
log.info("执行连接\t" + rcName);
String cmd = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
+ " label --overwrite rc " + rcName + " status=0";
List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer();
@ -382,7 +384,7 @@ public class DataModelController extends BaseController {
}
/**
*
*
*
* @return
* @throws Exception
@ -416,6 +418,32 @@ public class DataModelController extends BaseController {
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 String keyQuery;
//模糊查询字段
private List<String> array;
private String keyQuery;//模糊查询字段
private String volumeType;
//冷热区字段
private String mark;
private List<String> array;//模糊查询字段数组
private String volumeType;//冷热区字段
private String mark;//冷热区字段
public String getDataType() {
return dataType;

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

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

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

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

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

@ -210,11 +210,14 @@ public class MoveDataServiceImpl implements IMoveDataService {
}
}
int result = 0;
//迁移失败
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 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
@ -263,4 +266,42 @@ public class MoveDataServiceImpl implements IMoveDataService {
}
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);
if (i == 10) {
String cmd = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS
+ " label --overwrite rc " + key + " status=1";
List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd);
StringBuffer sb = new StringBuffer();
@ -98,6 +100,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
+ "\t[标签更新为: 失败]");
log.info(sb.toString());
String cmd2 = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key
@ -175,8 +178,10 @@ public class ThreadCheckoutStandardOracle extends Thread {
+ ",password:" + Configs.ORACLE_PSW);
String message = "失败";
String cmd3 = "kubectl --server " + Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key + " checkoutFlag=0";
List<String> rList3 = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd3);
StringBuffer sb3 = new StringBuffer();
@ -186,9 +191,11 @@ public class ThreadCheckoutStandardOracle extends Thread {
log.info("更新replicationController标签 " + key + "\t[标签更新为:未校验]");
if (flag) {
String cmd = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS
+ " label --overwrite rc " + key + " status=2";
// 设置服务为 成功
List<String> rList = Constant.ganymedSSH
.execCmdWaitAcquiescent(cmd);
@ -200,6 +207,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
log.info("更新replicationController标签 " + key
+ "\t[标签更新为: 成功]");
// 校验标签
String cmd2 = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key
@ -277,6 +285,7 @@ public class ThreadCheckoutStandardOracle extends Thread {
/* CacheOracleCheckoutEntity.putExtract(key, */CacheOracleCheckoutEntity
.checkRemove(key)/* ) */;
// 更新kuber状态
cmd2 = "kubectl --server "
+ Configs.KUBE_MASTER_ADDRESS
+ " annotate --overwrite rc " + key

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

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

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

Loading…
Cancel
Save