Skip to content

Commit dfb6cb6

Browse files
authored
Merge pull request #375 from experdb/develop
Develop
2 parents 378e726 + b6e8fc6 commit dfb6cb6

13 files changed

Lines changed: 282 additions & 112 deletions

File tree

eXperDB-Management-Agent/src/main/java/com/k4m/dx/tcontrol/server/DxT053.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import java.io.BufferedReader;
66
import java.io.FileReader;
77
import java.net.Socket;
8+
import java.util.Iterator;
89

910
import org.json.simple.JSONObject;
11+
import org.json.simple.parser.JSONParser;
1012
import org.slf4j.Logger;
1113
import org.slf4j.LoggerFactory;
1214
import org.springframework.context.ApplicationContext;
@@ -17,6 +19,7 @@
1719
import com.k4m.dx.tcontrol.socket.ProtocolID;
1820
import com.k4m.dx.tcontrol.socket.SocketCtl;
1921
import com.k4m.dx.tcontrol.socket.TranCodeType;
22+
import com.k4m.dx.tcontrol.socket.client.ClientProtocolID;
2023
import com.k4m.dx.tcontrol.util.CommonUtil;
2124
import com.k4m.dx.tcontrol.util.RunCommandExec;
2225

@@ -54,7 +57,6 @@ public void execute(String strDxExCode, JSONObject jObj) throws Exception {
5457

5558
String restoreType = String.valueOf(jObj.get(ProtocolID.RESTORE_FLAG));
5659
String exelog = String.valueOf(jObj.get(ProtocolID.EXELOG));
57-
5860
String restoreWrkName = String.valueOf(jObj.get(ProtocolID.WRK_NM));
5961

6062
vo.setEXELOG(exelog);
@@ -63,10 +65,30 @@ public void execute(String strDxExCode, JSONObject jObj) throws Exception {
6365
if (restoreType.equals("full")) {
6466
restoreCmd = "pgbackrest --stanza=experdb --config=$PGHOME/etc/pgbackrest/config/" + restoreWrkName + ".conf --delta restore > "
6567
+ pgBlogPath + "/" + exelog + ".log";
66-
} else {
68+
} else if(restoreType.equals("pitr")){
6769
String time_restore = String.valueOf(jObj.get(ProtocolID.TIME_RESTORE));
6870
restoreCmd = "pgbackrest --stanza=experdb --config=$PGHOME/etc/pgbackrest/config/" + restoreWrkName + ".conf --type=time \"--target="
6971
+ time_restore + "\" --target-action=promote --delta restore > " + pgBlogPath + "/" + exelog + ".log";
72+
} else if(restoreType.equals("ropd")) {
73+
JSONParser parser = new JSONParser();
74+
JSONObject jsonObject = (JSONObject) parser.parse(String.valueOf(jObj.get(ClientProtocolID.DBLIST_MAP)));
75+
Iterator<String> dbListKeys = jsonObject.keySet().iterator();
76+
77+
String dbListCmd = "";
78+
79+
while(dbListKeys.hasNext()) {
80+
String key = dbListKeys.next().toString();
81+
82+
if(String.valueOf(jObj.get(ClientProtocolID.LIST_TYPE)).equals("include")) {
83+
socketLogger.info("DxT053.value : " + String.valueOf(jsonObject.get(key)));
84+
dbListCmd += " --db-include=" + String.valueOf(jsonObject.get(key));
85+
}else if(String.valueOf(jObj.get(ClientProtocolID.LIST_TYPE)).equals("exclude")) {
86+
dbListCmd += " --db-exclude=" + String.valueOf(jsonObject.get(key));
87+
}
88+
}
89+
90+
restoreCmd = "pgbackrest --stanza=experdb --config=$PGHOME/etc/pgbackrest/config/" + restoreWrkName + ".conf" + dbListCmd + " --delta restore > "
91+
+ pgBlogPath + "/" + exelog + ".log";
7092
}
7193

7294
RunCommandExec r = new RunCommandExec(restoreCmd);

eXperDB-Management-Agent/src/main/java/com/k4m/dx/tcontrol/socket/client/ClientProtocolID.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,5 +287,6 @@ public class ClientProtocolID {
287287
public static final String REMOTE_USR= "REMOTE_USR";
288288
public static final String HOSTUSER= "HOSTUSER";
289289
public static final String SSH_PORT= "SSH_PORT";
290-
290+
public static final String DBLIST_MAP= "DBLIST_MAP";
291+
public static final String LIST_TYPE= "LIST_TYPE";
291292
}

eXperDB-Management-WebConsole/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.k4m</groupId>
66
<artifactId>eXperDB-Management-WebConsole</artifactId>
77
<packaging>war</packaging>
8-
<version>v15.0.3</version>
8+
<version>v15.0.4</version>
99
<name>eXperDB-Management-WebConsole</name>
1010
<url>http://www.egovframe.go.kr</url>
1111

eXperDB-Management-WebConsole/src/main/java/com/k4m/dx/tcontrol/cmmn/WebConsoleSetting.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class WebConsoleSetting {
1515

1616
public static void main(String[] args) throws Exception {
1717
String strLanguage ="";
18-
String strVersion ="eXperDB-Management-WebConsole-15.0.3";
18+
String strVersion ="eXperDB-Management-WebConsole-15.0.4";
1919

2020
String strDatabaseIp = "";
2121
String strDatabasePort = "";

eXperDB-Management-WebConsole/src/main/java/com/k4m/dx/tcontrol/cmmn/client/ClientProtocolID.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,5 +316,7 @@ public class ClientProtocolID {
316316
public static final String REMOTE_USR= "REMOTE_USR";
317317
public static final String HOSTUSER= "HOSTUSER";
318318
public static final String SSH_PORT= "SSH_PORT";
319+
public static final String DBLIST_MAP= "DBLIST_MAP";
320+
public static final String LIST_TYPE= "LIST_TYPE";
319321

320322
}

eXperDB-Management-WebConsole/src/main/java/com/k4m/dx/tcontrol/functions/schedule/service/WrkExeVO.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class WrkExeVO {
2727
private long DB_SZ;
2828
private int BACKREST_SCD_ID;
2929
private String backrest_gbn;
30+
private String remote_ip;
3031

3132
public int getExe_sn() {
3233
return exe_sn;
@@ -235,6 +236,14 @@ public String getBackrest_gbn() {
235236
public void setBackrest_gbn(String backrest_gbn) {
236237
this.backrest_gbn = backrest_gbn;
237238
}
239+
240+
public String getRemote_ip() {
241+
return remote_ip;
242+
}
243+
244+
public void setRemote_ip(String remote_ip) {
245+
this.remote_ip = remote_ip;
246+
}
238247

239248

240249

eXperDB-Management-WebConsole/src/main/java/com/k4m/dx/tcontrol/restore/web/BackrestRestoreController.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ public ModelAndView backrestAllAgentList(@ModelAttribute("workVo") WorkVO workVO
6969
if(!wrkExeVO.equals(null)) {
7070
resultCode = "S";
7171

72+
mv.addObject("db_svr_nm", backupService.selectDbSvrNm(workVO).getDb_svr_nm());
7273
mv.addObject("backrest_gbn", wrkExeVO.getBackrest_gbn());
74+
75+
if(wrkExeVO.getBackrest_gbn().equals("remote")) {
76+
mv.addObject("remote_ip", wrkExeVO.getRemote_ip());
77+
}
7378
}
7479

7580
} catch (Exception e) {
@@ -220,6 +225,9 @@ public void executeBackrestRestore(@ModelAttribute("workVo") WorkVO workVO, @Mod
220225
jObj.put(ClientProtocolID.RESTORE_FLAG, request.getParameter("restore_type"));
221226
jObj.put(ClientProtocolID.TIME_RESTORE, request.getParameter("time_restore"));
222227

228+
jObj.put(ClientProtocolID.DBLIST_MAP, paramMap.get("dbList_map"));
229+
jObj.put(ClientProtocolID.LIST_TYPE, request.getParameter("list_type"));
230+
223231
ClientInfoCmmn cic = new ClientInfoCmmn();
224232
JSONObject result = new JSONObject();
225233

@@ -351,7 +359,6 @@ public void createBackrestRestoreConfig(WorkVO workVO, DbServerVO dbServerVO, Ht
351359
}
352360
}
353361
}else {
354-
System.out.println(paramMap.get("cloud_map"));
355362
jObj.put(ClientProtocolID.CLOUD_MAP, paramMap.get("cloud_map"));
356363
}
357364

eXperDB-Management-WebConsole/src/main/resources/egovframework/sql/latest/eXperDB-Management_RepoDB-Install.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ ${1:-} == "A" ]; then
77
fi
88

99
echo "****************************************************"
10-
echo "eXperDB-Management-15.0.3 Repository DB Install"
10+
echo "eXperDB-Management-15.0.4 Repository DB Install"
1111
echo "****************************************************"
1212

1313
echo "**CREATE USER experdb**"
@@ -105,4 +105,8 @@ echo "**14.0.3 END**"
105105

106106
echo "**15.0.0**"
107107
psql -U experdb -d experdb -f eXperDB-Management_15.0.0.sql
108-
echo "**15.0.0 END**"
108+
echo "**15.0.0 END**"
109+
110+
echo "**15.0.3**"
111+
psql -U experdb -d experdb -f eXperDB-Management_15.0.3.sql
112+
echo "**15.0.3 END**"

eXperDB-Management-WebConsole/src/main/resources/egovframework/sqlmap/mappers/backup/backupSql.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,12 +1273,14 @@
12731273
B.db_svr_ipadr_id,
12741274
B.bck_file_pth,
12751275
B.wrk_id,
1276-
A.backrest_gbn
1276+
A.backrest_gbn,
1277+
A.remote_ip
12771278
FROM T_BCK_WRKCNG_I A, T_WRKEXE_G B
12781279
WHERE
12791280
A.DB_SVR_ID = #{db_svr_id}
12801281
AND B.WRK_ID = A.WRK_ID
12811282
AND B.exe_rslt_cd = 'TC001701'
1283+
AND A.bck_bsn_dscd = 'TC000205'
12821284
order by wrk_end_dtm desc limit 1;
12831285
</select>
12841286
</mapper>

eXperDB-Management-WebConsole/src/main/resources/egovframework/tcontrolProps/globals_default.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
#Thu Feb 24 06:53:01 UTC 2022
33
lang=ko
4-
version=eXperDB-Management-WebConsole-15.0.3
4+
version=eXperDB-Management-WebConsole-15.0.4
55
database.username=ENC(FjsPJj2xBs3gL1GH7mACfw\=\=)
66
database.password=ENC(KeX0QrXzGcewYGJ4oIWEyUa320+oR7nK)
77
database.url=ENC(acPqa+VFwBt0M47drdxfV009U7nRk/mIwyH0VPurNuWt7QetZmxYhGjXLdWq3yZwcEsgGpVAhQ0\=)

0 commit comments

Comments
 (0)