已合并
openGauss工具一体化平台优化提交 #180
AtomGit-Bot创建于 2023年3月30日
openGauss工具一体化平台优化提交 #180
已合并
AtomGit-Bot创建于 2023年3月30日
refs/pull/180/head合入到master
32 个文件变更+223-553
Mdata-migration/doc/DataKit Product Manual - Data Migration .md+121-45
@@ -49,7 +49,7 @@
49 49 
50+ 离线子任务进度算法50+ 离线子任务进度算法
51 51 
52- 离线子任务通过底层Portal的全量迁移进度数据计算状态以及进度。进度状态包含:待迁移、迁移中、迁移完成(待校验)、校验中、校验完成、错误52+ 离线子任务通过底层迁移工具的全量迁移进度数据计算状态以及进度。进度状态包含:待迁移、迁移中、迁移完成(待校验)、校验中、校验完成、错误
53 53 
54 > 总进度 = 表数量 * 10 + 视图数量 + 函数数量 + 存储过程数量 + 触发器数量54 > 总进度 = 表数量 * 10 + 视图数量 + 函数数量 + 存储过程数量 + 触发器数量
55 >55 >
@@ -77,65 +77,141 @@
77普通用户77普通用户
78 78 
79## **注意事项**79## **注意事项**
80-1、迁移过程中,请勿关闭源数据库或目标据库;80+1、源数据库mysql需要开启复制功能,在配置中增加以下配置参,并重启:
81+> binlog_format= ROW
82+>
83+> binlog_row_image=FULL
84+>
85+> enforce_gtid_consistency=ON
86+>
87+> gtid_mode=ON
81 88 
82-2、执行迁移任务的服务器应具备一定的性配置,以保证迁移过程的顺利执行;89+2、反向迁移需要在openGauss数据库增加如下配置,并重启:
90+> 调整pg_hba.conf以允许复制(这里的值取决于实际的网络配置以及用于连接的用户)
91+>
92+> host all repuser 0.0.0.0/0 sha256
93+>
94+> 调整guc参数:
95+> + alter system set ssl to on;
96+> + alter system set wal_level to logical;
97+> + alter system set enable_thread_pool to off;
98+ 
99+3、迁移过程中,请勿关闭源数据库或目标数据库;
100+ 
101+4、执行迁移任务的服务器应具备一定的性能和配置,以保证迁移过程的顺利执行;
102+ 
103+5、为确认数据的顺利迁移,源端数据库(Mysql)的数据源添加时,请添加具备数据库读写权限的用户;
104+ 
105+6、通过Datakit平台安装的源端数据库(openGauss)可以直接迁移,导入的数据库以及在创建任务时添加的自定义openGauss数据源,需要提前将用户权限改为SYSADMIN角色;
106+```shell
107+#修改用户角色为SYSADMIN
108+alter user 用户名 SYSADMIN;
109+#查询用户角色,字段值为t时说明具有sysadmin角色,f时则没有
110+select rolsystemadmin from PG_ROLES where rolname='用户名';
111+```
112+ 
113+> 有sysadmin角色权限
114+![img_1.png](_resources/015.png)
115+>
116+>无sysadmin角色权限
117+>![img.png](_resources/014.png)
118+ 
119+7、迁移任务是在非root用户下执行,任务的执行机器来源于平台资源中心的设备管理,因此需要在设备管理的用户管理中添加非root用户;
83 120 
84## 功能说明121## 功能说明
85 122 
86### 迁移任务中心123### 迁移任务中心
87-该页面将展示所有的主任务,可以启动、删除、结束迁移以及查看任务详情。124+该页面将展示所有的主任务,可以启动、删除、结束迁移以及查看任务详情,同时可以创建迁移任务
88![platform-login](./_resources/00.png)125![platform-login](./_resources/00.png)
126+#### 任务筛选
127+可以通过任务名称、创建用户、任务状态、执行时间、完成时间进行筛选。
128+![img.png](_resources/012.png)
129+ 
130+任务名称:模糊匹配任务名称包含输入内容的任务。
131+ 
132+创建用户:筛选下拉框选中的用户创建的任务。
133+ 
134+任务状态:筛选下拉框选中的状态的任务。
135+ 
136+执行时间:筛选任务执行时间在选择的时间段内的任务。
137+ 
138+完成时间:筛选任务完成时间在选择的时间段内的任务。
139+#### 任务创建
140+ 
141+该任务是主任务,宏观层面的任务单元,包括若干个迁移过程(子任务),子任务为具体将数据从源端迁移到目的端的执行过程。子任务支持两种迁移模式,分别是在线模式和离线模式。
142+> **离线模式**:只会将现有已存在的全量数据迁移,全量数据迁移完成后,迁移任务结束。
143+>
144+> **在线模式**:将现有已存在的全量数据迁移完成后,任务会进入增量迁移状态,此时会监听源端数据的变化,如果有增量数据,会将增量数据进行迁移,在该模式下,可以停止增量迁移,之后启动反向迁移,任务会进入反向迁移状态,此时会监听目标端数据的变化,如果有反向增量数据,会将增量数据进行反向迁移。
145+ 
146+迁移迁移任务创建任务总共分为3个步骤,分别是**配置迁移任务源库和目的库****源库和目的库可以直接新增数据源****配置迁移过程参数**
147+ 
148+##### **配置迁移任务源库和目的库**
149+该步骤需要配置迁移数据的源端和目标端数据库。首先在左侧选择源端数据库后,鼠标移动到右侧数据库上即可出现添加子任务按钮,点击按钮后,可以添加一条子任务,随后再配置子任务的迁移模式。
150+ 
151+![platform-login](./_resources/01.jpg)
152+![platform-login](./_resources/01_1.png)
153+源库和目的库可以直接点击新增数据源进行添加。新增openGauss数据源的用户,需要提前将权限改为SYSADMIN。
154+![platform-login](./_resources/02.png)
155+##### **配置迁移过程参数**
156+![platform-login](./_resources/03.png)
157+该步骤可以配置任务全局参数和子任务参数。全局参数为所有子任务共享,作用于所有子任务,子任务参数只作用于自己,子任务参数优先级大于全局参数。
158+![platform-login](./_resources/04.png)
159+![platform-login](./_resources/05.png)
160+ 
161+ 
162+##### **分配执行机资源**
163+该步骤是配置任务运行的机器列表,数据来源于datakit平台资源中心的设备管理。机器会检测是否安装了底层迁移工具,如果未安装,可以在该步骤给机器安装迁移工具,安装时需要选择安装用户以及安装目录;未安装迁移工具的机器不能执行迁移任务。
164+迁移工具的安装用户即为迁移任务的执行用户,该用户必须是非root用户,因此需要在datakit平台资源中心的设备管理中,添加非root用户。
165+![platform-login](./_resources/06.png)
166+![platform-login](./_resources/07.png)
167+该页面可以根据执行机器的IP、物理机名称、CPU核数、剩余内存空间、剩余硬盘空间进行筛选。
168+![img.png](_resources/013.png)
169+物理机IP:模糊匹配机器IP包含输入内容的机器。
170+ 
171+物理机名称:模糊匹配物理机名称包含输入内容的机器。
172+ 
173+CPU核数:筛选配置信息中CPU核数等于输入核数的机器。
174+ 
175+内存空间:筛选配置信息中剩余内存空间大于输入数量的机器。
176+ 
177+硬盘空间:筛选配置信息中剩余硬盘容量大于输入数量的机器。
178+ 
179+点击完成按钮后,任务将创建完成,随后将跳转到迁移任务中心页面。
180+ 
181+#### 任务启动
182+点击启动,系统将为该任务中的所有子任务,分配具体执行机器,给执行机器上的底层迁移工具下发指令,启动迁移,状态改为迁移中。
89#### 任务详情183#### 任务详情
90如果任务未启动,打开详情将进入任务创建页面,可对任务进行修改。184如果任务未启动,打开详情将进入任务创建页面,可对任务进行修改。
91 185 
92如果任务已经启动,打开任务详情将进入任务详情信息页,可查看任务的进度信息以及所有子任务的迁移进度信息。186如果任务已经启动,打开任务详情将进入任务详情信息页,可查看任务的进度信息以及所有子任务的迁移进度信息。
93 187 
94-任务状态需要从底层Portal执行结果中获取,进入详情页面后会获取一次所有子任务的状态,如果需要获取最新的状态,点击页面的刷新按钮。188+任务状态以及进度信息是从底层迁移工具执行结果中获取并且计算得出此过程耗时较长,尤其是大批量任务的场景,因此进入详情页面后会获取一次所有子任务的状态,如果需要获取最新的状态,需要手动点击页面的刷新按钮获得
95![platform-login](./_resources/0_1.png)189![platform-login](./_resources/0_1.png)
96-在此页面可点击右侧停止按钮,让主任务结束迁移;同时可对子任务进行结束迁移、查看详情、查看日志、停止增量、启动反向、连接子任务执行机器等操作。
97- 
98-结束迁移:该功能提供给用户人为停止任务迁移,将停止底层Portal的执行,任务状态改为完成。
99- 
100-查看详情:通过右侧抽屉弹出,即时获取子任务迁移数据(表、视图、存储过程、函数、触发器)的迁移进度信息,如果是在线模式,还会显示迁移的过程记录以及增量迁移速度等信息。
101- 
102-查看日志:查看迁移日志,可下载日志。
103- 
104-停止增量:将正在增量迁移的任务进行停止。
105- 
106-启动反向:启动反向增量数据迁移。
107- 
108-连接任务执行机器: 打开webShell,登录服务器。
109- 
110![platform-login](./_resources/0_2.png)190![platform-login](./_resources/0_2.png)
111-![platform-login](./_resources/0_3.png)
112![platform-login](./_resources/0_4.png)191![platform-login](./_resources/0_4.png)
192+ 
193+在此页面可点击右侧停止按钮,让主任务结束迁移;同时可对子任务进行结束迁移、查看详情、查看日志、停止增量、启动反向、连接子任务执行机器等操作。
194+#### 查看详情
195+通过右侧抽屉弹出,将展示子任务的迁移详细数据,此时会实时获取子任务迁移数据(表、视图、存储过程、函数、触发器)的迁移进度信息,如果是在线模式,还会显示迁移的过程记录以及增量迁移速度等信息。
196+![platform-login](./_resources/0_3.png)
113![platform-login](./_resources/0_5.png)197![platform-login](./_resources/0_5.png)
198+#### 查看日志
199+查看迁移相关日志列表,可下载日志,进行问题跟踪与分析。
114![platform-login](./_resources/0_6.png)200![platform-login](./_resources/0_6.png)
201+#### 连接任务执行机器
202+点击子任务执行机器信息,将会打开webShell,登录该服务器。
203+![img.png](_resources/010.png)
204+![img_1.png](_resources/011.png)
205+#### 停止增量
206+停止增量:将正在增量迁移的任务进行停止,状态改为增量迁移已停止,在线模式下增量迁移开始、增量迁移进行中状态才会显示该功能。
207+![img.png](_resources/08.png)
208+#### 启动反向
209+启动反向:启动反向增量数据迁移,状态改为反向迁移开始,在线模式下增量迁移已停止状态才会显示该功能。
210+![img.png](_resources/09.png)
211+#### 结束迁移
212+结束迁移:主任务结束迁移将对所有子任务进行停止,对底层迁移工具发起结束迁移指令,任务状态改为完成。
115 213 
116-### 任务创建214+## 相关文档
215+[chameleon说明文档]( https://gitee.com/opengauss/openGauss-tools-chameleon/blob/master/chameleon%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97.md )
117 216 
118-该任务是主任务,宏观层面的任务单元,包括若干个迁移过程(子任务),子任务为具体将数据从源端迁移到目的端的执行过程。217+[debezium说明文档]( https://gitee.com/opengauss/debezium/blob/master/README.md )
119- 
120-迁移迁移任务创建任务总共分为3个步骤,分别是**配置迁移任务源库和目的库****源库和目的库可以直接新增数据源****配置迁移过程参数**
121- 
122-#### **配置迁移任务源库和目的库**
123-该步骤需要配置迁移数据的源端和目标端数据库。首先在左侧选择源端数据库后,鼠标移动到右侧数据库上即可出现添加子任务按钮,点击按钮后,可以添加一条子任务,随后再配置子任务的迁移模式。
124-![platform-login](./_resources/01.jpg)
125-![platform-login](./_resources/01_1.png)
126-源库和目的库可以直接点击新增数据源进行添加。
127-![platform-login](./_resources/02.png)
128-#### **配置迁移过程参数**
129-![platform-login](./_resources/03.png)
130-该步骤可以配置任务全局参数和子任务参数。全局参数为所有子任务共享,作用于所有子任务,子任务参数只作用于自己,子任务参数优先级大于全局参数。
131-![platform-login](./_resources/04.png)
132-![platform-login](./_resources/05.png)
133-#### **分配执行机资源**
134-该步骤是配置任务运行的机器列表。机器会检测是否安装了底层迁移组件Portal,如果未安装,可以在该步骤给机器安装Portal,安装时可以选择安装用户以及安装目录;未安装Portal的机器不能执行迁移任务。
135-![platform-login](./_resources/06.png)
136-![platform-login](./_resources/07.png)
137-点击完成按钮后,任务将创建完成,随后将跳转到迁移任务中心页面。
138-### 黑暗模式
139-点击右上角主题模式切换,插件将跟随平台切换到对应的主题。
140-![platform-login](./_resources/08.png)
141-![platform-login](./_resources/09.png)
Adata-migration/doc/_resources/010.png+0-0
Adata-migration/doc/_resources/011.png+0-0
Adata-migration/doc/_resources/012.png+0-0
Adata-migration/doc/_resources/013.png+0-0
Adata-migration/doc/_resources/014.png+0-0
Adata-migration/doc/_resources/015.png+0-0
Mdata-migration/doc/_resources/08.png+0-0
Mdata-migration/doc/_resources/09.png+0-0
Mdata-migration/src/main/java/org/opengauss/admin/plugin/aspectj/LogAspect.java+0-1
@@ -110,7 +110,6 @@ public class LogAspect {
110 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));110 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
111 } catch (Exception exp) {111 } catch (Exception exp) {
112 log.error("error:{}", exp.getMessage());112 log.error("error:{}", exp.getMessage());
113- exp.printStackTrace();
114 }113 }
115 }114 }
116 115 
Mdata-migration/src/main/java/org/opengauss/admin/plugin/config/DataMigrationApplicationRunner.java+2-4
@@ -32,8 +32,7 @@ public class DataMigrationApplicationRunner implements ApplicationRunner {
32 try {32 try {
33 migrationTaskService.doOfflineTaskRunScheduler();33 migrationTaskService.doOfflineTaskRunScheduler();
34 } catch (Exception e) {34 } catch (Exception e) {
35- e.printStackTrace();35+ log.error("OffLineTaskRunScheduler error", e.getMessage());
36- log.error("OffLineTaskRunScheduler error", e);
37 }36 }
38 });37 });
39 38 
@@ -41,8 +40,7 @@ public class DataMigrationApplicationRunner implements ApplicationRunner {
41 try {40 try {
42 migrationMainTaskService.doRefreshMainTaskStatus();41 migrationMainTaskService.doRefreshMainTaskStatus();
43 } catch (Exception e) {42 } catch (Exception e) {
44- e.printStackTrace();43+ log.error("RefreshMainTaskStatus error", e.getMessage());
45- log.error("RefreshMainTaskStatus error", e);
46 }44 }
47 });45 });
48 }46 }
Mdata-migration/src/main/java/org/opengauss/admin/plugin/service/impl/MigrationMainTaskServiceImpl.java+2-3
@@ -466,8 +466,7 @@ public class MigrationMainTaskServiceImpl extends ServiceImpl<MigrationMainTaskM
466 log.info("Sync refresh task status,taskId:{}", taskId);466 log.info("Sync refresh task status,taskId:{}", taskId);
467 syncRefreshTaskStatusByPortal(taskId);467 syncRefreshTaskStatusByPortal(taskId);
468 } catch (Exception e) {468 } catch (Exception e) {
469- e.printStackTrace();469+ log.error("Sync refresh task status error. message: {}", e.getMessage());
470- log.error("Sync refresh task status error", e);
471 }470 }
472 });471 });
473 }472 }
@@ -521,7 +520,7 @@ public class MigrationMainTaskServiceImpl extends ServiceImpl<MigrationMainTaskM
521 try {520 try {
522 Thread.sleep(mainTaskRefreshIntervalsMillisecond);521 Thread.sleep(mainTaskRefreshIntervalsMillisecond);
523 } catch (InterruptedException e) {522 } catch (InterruptedException e) {
524- e.printStackTrace();523+ log.error("refresh main task status error, message: {}", e.getMessage());
525 }524 }
526 }525 }
527 }526 }
Mdata-migration/src/main/java/org/opengauss/admin/plugin/service/impl/MigrationTaskHostRefServiceImpl.java+3-4
@@ -273,14 +273,14 @@ public class MigrationTaskHostRefServiceImpl extends ServiceImpl<MigrationTaskHo
273 list.add(rowData);273 list.add(rowData);
274 }274 }
275 } catch (SQLException e) {275 } catch (SQLException e) {
276- e.printStackTrace();276+ log.error("convert error, message: {}", e.getMessage());
277 } finally {277 } finally {
278 try {278 try {
279 if (rs != null) {279 if (rs != null) {
280 rs.close();280 rs.close();
281 }281 }
282 } catch (SQLException e) {282 } catch (SQLException e) {
283- e.printStackTrace();283+ log.error("convert error, message: {}", e.getMessage());
284 }284 }
285 }285 }
286 return list;286 return list;
@@ -367,8 +367,7 @@ public class MigrationTaskHostRefServiceImpl extends ServiceImpl<MigrationTaskHo
367 boolean flag = PortalHandle.installPortal(host, port, user, pass, installPath, portalPkgDownloadUrl, isNewFileInstall);367 boolean flag = PortalHandle.installPortal(host, port, user, pass, installPath, portalPkgDownloadUrl, isNewFileInstall);
368 migrationHostPortalInstallHostService.updateStatus(hostId, flag ? PortalInstallStatus.INSTALLED.getCode() : PortalInstallStatus.INSTALL_ERROR.getCode());368 migrationHostPortalInstallHostService.updateStatus(hostId, flag ? PortalInstallStatus.INSTALLED.getCode() : PortalInstallStatus.INSTALL_ERROR.getCode());
369 } catch (Exception e) {369 } catch (Exception e) {
370- e.printStackTrace();370+ log.error("sync install portal error, message: {}", e.getMessage());
371- log.error("sync install portal error", e);
372 }371 }
373 });372 });
374 }373 }
Mdata-migration/src/main/java/org/opengauss/admin/plugin/service/impl/MigrationTaskServiceImpl.java+1-1
@@ -477,7 +477,7 @@ public class MigrationTaskServiceImpl extends ServiceImpl<MigrationTaskMapper, M
477 try {477 try {
478 Thread.sleep(taskOfflineSchedulerIntervalsMillisecond);478 Thread.sleep(taskOfflineSchedulerIntervalsMillisecond);
479 } catch (InterruptedException e) {479 } catch (InterruptedException e) {
480- e.printStackTrace();480+ log.error("offline task scheduler error, message: {}", e.getMessage());
481 }481 }
482 }482 }
483 }483 }
Mdata-migration/src/main/java/org/opengauss/admin/plugin/utils/ShellUtil.java+6-86
@@ -2,6 +2,7 @@ package org.opengauss.admin.plugin.utils;
2 2 
3import cn.hutool.extra.ssh.JschUtil;3import cn.hutool.extra.ssh.JschUtil;
4import com.jcraft.jsch.*;4import com.jcraft.jsch.*;
5+import lombok.extern.slf4j.Slf4j;
5 6 
6import java.io.*;7import java.io.*;
7import java.nio.charset.StandardCharsets;8import java.nio.charset.StandardCharsets;
@@ -11,90 +12,9 @@ import java.nio.charset.StandardCharsets;
11 * @author: xielibo12 * @author: xielibo
12 * @date: 2023-01-16 21:5513 * @date: 2023-01-16 21:55
13 **/14 **/
15+@Slf4j
14public class ShellUtil {16public class ShellUtil {
15 17 
16- 
17- /**
18- * Determine whether the directory exists
19- *
20- * @param directory
21- * @return
22- */
23- public static boolean isDirExist(String directory, ChannelSftp sftp) {
24- boolean isDirExistFlag = false;
25- try {
26- SftpATTRS sftpATTRS = sftp.lstat(directory);
27- isDirExistFlag = true;
28- return sftpATTRS.isDir();
29- } catch (Exception e) {
30- if (e.getMessage().toLowerCase().equals("no such file")) {
31- isDirExistFlag = false;
32- }
33- }
34- return isDirExistFlag;
35- }
36- 
37- /**
38- * Create directory
39- */
40- public static void createDir(String createpath, ChannelSftp sftp) {
41- try {
42- if (isDirExist(createpath, sftp)) {
43- sftp.cd(createpath);
44- return;
45- }
46- String pathArry[] = createpath.split("/");
47- StringBuffer filePath = new StringBuffer("/");
48- for (String path : pathArry) {
49- if (path.equals("")) {
50- continue;
51- }
52- filePath.append(path + "/");
53- if (isDirExist(filePath.toString(), sftp)) {
54- sftp.cd(filePath.toString());
55- } else {
56- sftp.mkdir(filePath.toString());
57- sftp.cd(filePath.toString());
58- }
59- }
60- sftp.cd(createpath);
61- } catch (SftpException e) {
62- throw new RuntimeException("create directory Error:" + createpath);
63- }
64- }
65- 
66- public static String readFile(String host, Integer port, String user, String password,String filePath) {
67- Session session = JschUtil.openSession(host, port, user, password);
68- ChannelSftp sftp = null;
69- StringBuilder sb = new StringBuilder(16);
70- InputStream inputStream = null;
71- try {
72- Channel channel = session.openChannel("sftp");
73- channel.connect();
74- sftp = (ChannelSftp) channel;
75- inputStream = sftp.get(filePath);
76- InputStreamReader isr = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
77- BufferedReader reader = new BufferedReader(isr) ;
78- String buffer;
79- while ((buffer = reader.readLine()) != null) {
80- sb.append("\n").append(buffer);
81- }
82- } catch (Exception e) {
83- e.printStackTrace();
84- } finally {
85- JschUtil.close(sftp);
86- JschUtil.close(session);
87- if (inputStream != null) {
88- try {
89- inputStream.close();
90- } catch (IOException e) {
91- e.printStackTrace();
92- }
93- }
94- }
95- return sb.toString();
96- }
97- 
98 public static void execCommand(String host, Integer port, String user, String password, String... commands) {18 public static void execCommand(String host, Integer port, String user, String password, String... commands) {
99 Session session = JschUtil.openSession(host, port, user, password);19 Session session = JschUtil.openSession(host, port, user, password);
100 ChannelExec channelExec = null;20 ChannelExec channelExec = null;
@@ -105,7 +25,7 @@ public class ShellUtil {
105 }25 }
106 channelExec.connect();26 channelExec.connect();
107 } catch (JSchException e) {27 } catch (JSchException e) {
108- e.printStackTrace();28+ log.error("exec command error, message: {}", e.getMessage());
109 } finally {29 } finally {
110 JschUtil.close(channelExec);30 JschUtil.close(channelExec);
111 JschUtil.close(session);31 JschUtil.close(session);
@@ -133,9 +53,9 @@ public class ShellUtil {
133 sb.append("\n").append(buffer);53 sb.append("\n").append(buffer);
134 }54 }
135 } catch (JSchException e) {55 } catch (JSchException e) {
136- e.printStackTrace();56+ log.error("exec command error, message: {}", e.getMessage());
137 } catch (IOException e) {57 } catch (IOException e) {
138- e.printStackTrace();58+ log.error("exec command error, message: {}", e.getMessage());
139 } finally {59 } finally {
140 JschUtil.close(channelExec);60 JschUtil.close(channelExec);
141 JschUtil.close(session);61 JschUtil.close(session);
@@ -143,7 +63,7 @@ public class ShellUtil {
143 try {63 try {
144 in.close();64 in.close();
145 } catch (IOException e) {65 } catch (IOException e) {
146- e.printStackTrace();66+ log.error("exec command error, message: {}", e.getMessage());
147 }67 }
148 }68 }
149 }69 }
Mdatasync-mysql/src/main/java/org/opengauss/admin/plugin/aspectj/LogAspect.java+0-1
@@ -88,7 +88,6 @@ public class LogAspect {
88 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));88 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
89 } catch (Exception exp) {89 } catch (Exception exp) {
90 log.error("error:{}", exp.getMessage());90 log.error("error:{}", exp.getMessage());
91- exp.printStackTrace();
92 }91 }
93 }92 }
94 93 
Mdatasync-mysql/src/main/java/org/opengauss/admin/plugin/service/SyncDataServiceImpl.java+0-1
@@ -89,7 +89,6 @@ public class SyncDataServiceImpl {
89 return true;89 return true;
90 }90 }
91 } catch (SQLException | ClassNotFoundException e) {91 } catch (SQLException | ClassNotFoundException e) {
92- e.printStackTrace();
93 } finally {92 } finally {
94 if (resultSet != null) {93 if (resultSet != null) {
95 try {94 try {
MopenGauss-visualtool-plugin/src/main/java/org/opengauss/admin/plugin/aspectj/LogAspect.java+0-1
@@ -82,7 +82,6 @@ public class LogAspect {
82 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));82 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
83 } catch (Exception exp) {83 } catch (Exception exp) {
84 log.error("error:{}", exp.getMessage());84 log.error("error:{}", exp.getMessage());
85- exp.printStackTrace();
86 }85 }
87 }86 }
88 87 
MopenGauss-visualtool/README.md+74-54
@@ -57,77 +57,100 @@
57 57 
58## 支持的服务器系统58## 支持的服务器系统
59openEuler 20.3LTS(x86_x64,ARM),centos7.x(x86_x64)59openEuler 20.3LTS(x86_x64,ARM),centos7.x(x86_x64)
60-## 安装步骤60+## 安装部署
61-### 基于源码编译安装
62-1、使用root用户,创建新用户og_ops,并授予sudo免密权限
63- 
64-> + 添加用户 **useradd og_ops**
65-> + 设置密码 **passwd og_ops**
66-> + 增加文件编辑权限 **chmod u+w /etc/sudoers**
67-> + 编辑文件 **/etc/sudoers**,在文件底部增加:**og_ops ALL=(ALL) NOPASSWD: ALL**
68-> + 回收文件编辑权限 **chmod u-w /etc/sudoers**
69- 
70-2、使用root用户,在项目根目录下执行install.sh脚本
71- 
72-3、使用og_ops用户,在项目根目录下执行server.sh start启动服务
73- 
74-> servier.sh 支持参数(start|stop|restart|status)
75- 
76-4、访问地址https://ip:9494
77 61 
78### jar包安装62### jar包安装
79-1、创建工作目录63+```shell
80- 64+#1、创建datakit工作目录,并在工作目录中创建存放系统运行数据的子目录
81-> mkdir -p /ops/server/openGauss-visualtool/logs /ops/server/openGauss-visualtool/config /ops/ssl /ops/files65+mkdir -p 自定义工作目录
82- 66+cd 自定义工作目录
83-2、将visualtool-main.jar包上传至/ops/server/openGauss-visualtool/下67+mkdir -p logs config ssl files
84- 68+#2、将visualtool-main.jar包上传至 $自定义工作目录 下
85-3、修改application-temp.yml文件中的数据链链接ip、port、database、dbuser、dbpassword。将修改后的配置文件application-temp.yml传至/ops/server/openGauss-visualtool/config/下69+#3、修改application-temp.yml文件中的数据链链接ip、port、database、dbuser、dbpassword。将修改后的配置文件application-temp.yml传至 $自定义工作目录/config/下
86- 70+#4、修改配置文件中平台工作目录
87-4、运行以下命令创建ssl文件71+sed -i s#/ops#$(pwd)#g config/application-temp.yml
88- 72+#4、创建ssl文件
89-```
90keytool -genkey -noprompt \73keytool -genkey -noprompt \
91 -dname "CN=opengauss, OU=opengauss, O=opengauss, L=Beijing, S=Beijing, C=CN"\74 -dname "CN=opengauss, OU=opengauss, O=opengauss, L=Beijing, S=Beijing, C=CN"\
92 -alias opengauss\75 -alias opengauss\
93 -storetype PKCS12 \76 -storetype PKCS12 \
94 -keyalg RSA \77 -keyalg RSA \
95 -keysize 2048 \78 -keysize 2048 \
96- -keystore /ops/ssl/keystore.p12 \79+ -keystore $(pwd)/ssl/keystore.p12 \
97 -validity 3650 \80 -validity 3650 \
98- -storepass password81+ -storepass 123456
82+#5、执行启动命令
83+nohup java -Xms2048m -Xmx4096m -jar $(pwd)/visualtool-main.jar \
84+ --spring.profiles.active=temp >$(pwd)/logs/visualtool-main.out 2>&1 &
99```85```
100 86 
101-5、在root下给ops目录及下面所有文件修改所属用户为执行用户87+### docker安装
102- 88+```shell
103-6进入/ops/server/openGauss-visualtool目录,启动命令。日志输出位于/ops/server/openGauss-visualtool/logs/visualtool-main.out89+#1创建datakit工作目录,并在工作目录中创建存放系统运数据的子目录
104- 90+mkdir -p 自定义工作目录
105-> nohup java -Xms2048m -Xmx4096m -jar /ops/server/openGauss-visualtool/visualtool-main.jar --spring.profiles.active=temp >/ops/server/openGauss-visualtool/logs/visualtool-main.out 2>&1 &91+cd 自定义工作目录
92+mkdir -p logs config ssl files
93+#2、将visualtool-main.jar包上传至 $自定义工作目录 下
94+#3、修改application-temp.yml文件中的数据链链接ip、port、database、dbuser、dbpassword。将修改后的配置文件application-temp.yml传至 $自定义工作目录/config/下
95+#4、创建ssl文件
96+keytool -genkey -noprompt \
97+ -dname "CN=opengauss, OU=opengauss, O=opengauss, L=Beijing, S=Beijing, C=CN"\
98+ -alias opengauss\
99+ -storetype PKCS12 \
100+ -keyalg RSA \
101+ -keysize 2048 \
102+ -keystore $(pwd)/ssl/keystore.p12 \
103+ -validity 3650 \
104+ -storepass 123456
105+#5、编辑Dockerfile
106+vi Dockerfile
107+#复制以下内容进行粘贴
108+FROM openjdk:11
109+ENV TZ=Asia/Shanghai
110+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
111+EXPOSE 9494 5432
112+WORKDIR /ops/
113+ENTRYPOINT ["java","-Xms2048m","-Xmx4096m", "-jar", "visualtool-main.jar"]
114+#6、构建镜像
115+docker build -f Dockerfile -t datakit:5.0.0 .
116+#7、启动容器
117+docker run -idt -p 9494:9494 \
118+ -v /etc/localtime:/etc/localtime:ro \
119+ -v $(pwd):/ops \
120+ --name datakit datakit:5.0.0 \
121+ --spring.profiles.active=temp
122+```
106 123 
107## 升级步骤124## 升级步骤
108-### 基于源码升级
109-1、使用root用户,在项目根目录下执行upgrade.sh脚本
110- 
111-2、使用og_ops用户,在项目根目录下执行server.sh restart启动服务
112- 
113-3、访问地址https://ip:9494
114- 
115### jar包升级125### jar包升级
116-1、将新的jar包传至/ops/server/openGauss-visualtool/下126+```shell
117- 127+#1、将新的jar包传至 自定义工作目录 下,替换原有visualtool-main.jar
118-2、关闭原有进程后,再执行启动命令128+cd 自定义工作目录
119- 129+#2、关闭原有进程后,再执行启动命令
120-> nohup java -Xms2048m -Xmx4096m -jar /ops/server/openGauss-visualtool/visualtool-main.jar --spring.profiles.active=temp >/ops/server/openGauss-visualtool/logs/visualtool-main.out 2>&1 &130+nohup java -Xms2048m -Xmx4096m -jar $(pwd)/visualtool-main.jar \
131+ --spring.profiles.active=temp >$(pwd)/logs/visualtool-main.out 2>&1 &
132+```
133+### docker安装升级
134+```shell
135+#1、将新的jar包传至 自定义工作目录 下,替换原有visualtool-main.jar
136+#2、重启容器
137+docker restart datakit
138+```
139+### 平台配置修改
140+#### 端口修改
141+在工作目录的config目录中,修改配置文件,将默认9494端口修改为自定义端口,之后重启服务
121 142 
122### 注意事项:143### 注意事项:
123-1、平台使用的数据库,当前仅支持openGauss数据库,并且需要提前创建database144+1、当前平台运行依赖于openJdk11
124 145 
125-2、需要将部署服务器IP配置在平台使用的数据库openGauss)的白名单列表中146+2、平台使用的数据库,当前仅支持openGauss数据库,并且需要提前创建database
126 147 
127-3、平台默认登录账号密码:admin/admin123,请在首次登录后及时修改密码148+3、需要将部署服务器IP配置在平台使用数据库(openGauss)的白名单列表中
149+ 
150+4、平台默认的登录账号密码:admin/admin123,请在首次登录后及时修改密码。
128 151 
129## 卸载步骤152## 卸载步骤
130-1、在项根目下执行uninstall.sh脚本,卸载系统以及清理文件数据153+1、停止java进程或者docker容器,删除工作目录。
131 154 
1322、手动清理数据库中所有的表和序列。1552、手动清理数据库中所有的表和序列。
133 156 
@@ -155,6 +178,3 @@ keytool -genkey -noprompt \
155 178 
156[主程序扩展手册]( https://fullstack-dao.feishu.cn/docx/doxcnV63pz1w4bn4Zn1y2lxwJnf )179[主程序扩展手册]( https://fullstack-dao.feishu.cn/docx/doxcnV63pz1w4bn4Zn1y2lxwJnf )
157 180 
158-## 常见问题
159-1、插件框架依赖包无法拉取到。
160-> 本地maven settings中的mirror配置的mirrorOf参数如果配置的通配符*,则在后面追加上 ,!maven-public 即可。
MopenGauss-visualtool/config/application-temp.yml+1-1
@@ -15,7 +15,7 @@ server:
15 context-path: /15 context-path: /
16logging:16logging:
17 file:17 file:
18- path: /ops/server/openGauss-visualtool/logs/18+ path: /ops/logs/
19spring:19spring:
20 datasource:20 datasource:
21 type: com.alibaba.druid.pool.DruidDataSource21 type: com.alibaba.druid.pool.DruidDataSource
DopenGauss-visualtool/install-depency.sh+0-174
@@ -1,174 +0,0 @@
1-#! /bin/bash
2- 
3-#========================================================================
4-# install JDK、Maven、node、 by yum
5-#
6-# author: wyl
7-#========================================================================
8- 
9-hasJdk(){
10- /etc/jdk11/bin/java -version
11- if [ $? -eq 0 ]; then
12- return 1;
13- else
14- return 0;
15- fi
16-}
17- 
18-hasMaven(){
19- MAVEN_VERSION=$(mvn -version)
20- echo "${MAVEN_VERSION}"
21- if [[ ! $MAVEN_VERSION ]]
22- then
23- return 0;
24- fi
25- return 1;
26-}
27- 
28- 
29-hasNode(){
30- NODE_RESULT=$(node -v)
31- echo "${NODE_RESULT}"
32- if [[ ! $NODE_RESULT ]]
33- then
34- return 0;
35- fi
36- return 1;
37-}
38- 
39-isArm64(){
40- get_arch=`arch`
41- if [[ $get_arch =~ "x86_64" ]];then
42- return 0
43- elif [[ $get_arch =~ "aarch64" ]];then
44- return 1
45- elif [[ $get_arch =~ "mips64" ]];then
46- return 0
47- else
48- return 0
49- fi
50-}
51-isOpenEuler(){
52- OS_NAME=$(uname -a)
53- OL_MARK="oe1"
54- if [[ $OS_NAME =~ $OL_MARK ]]
55- then
56- return 1
57- else
58- return 0
59- fi
60-}
61- 
62-yum install -y tar
63-hasJdk
64-if [ $? != 1 ]
65-then
66- echo "Not Found jdk"
67- echo "Installing jdk..."
68- isArm64
69- if [ $? != 1 ]
70- then
71- wget https://mirrors.huaweicloud.com/kunpeng/archive/compiler/bisheng_jdk/bisheng-jdk-11.0.17-linux-x64.tar.gz
72- tar zxvf bisheng-jdk-11.0.17-linux-x64.tar.gz -C /etc/
73- mv /etc/bisheng-jdk-11.0.17 /etc/jdk11
74- rm -rf bisheng-jdk-11.0.17-linux-x64.tar.gz
75- else
76- wget https://mirrors.huaweicloud.com/kunpeng/archive/compiler/bisheng_jdk/bisheng-jdk-11.0.17-linux-aarch64.tar.gz
77- tar zxvf bisheng-jdk-11.0.17-linux-aarch64.tar.gz -C /etc/
78- mv /etc/bisheng-jdk-11.0.17 /etc/jdk11
79- rm -rf bisheng-jdk-11.0.17-linux-aarch64.tar.gz
80- fi
81- hasJdk
82- if [ $? != 1 ]
83- then
84- echo "Install jdk Fail"
85- fi
86-fi
87- 
88- 
89-hasMaven
90-if [ $? != 1 ]
91-then
92- echo "Not Found maven"
93- echo "Installing maven..."
94- 
95- wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
96- 
97- tar -zxvf apache-maven-3.5.4-bin.tar.gz -C /etc/
98- sed -i '30 i JAVA_HOME=/etc/jdk11' /etc/apache-maven-3.5.4/bin/mvn
99- if [ ! -f "/usr/local/bin/mvn" ]; then
100- ln -s /etc/apache-maven-3.5.4/bin/mvn /usr/local/bin/mvn
101- fi
102- 
103- hasMaven
104- if [ $? == 1 ]
105- then
106- echo "Config Aliyun Maven Mirror..."
107- rm -rf /etc/apache-maven-3.5.4/conf/settings.xml
108- cp config/settings.xml /etc/apache-maven-3.5.4/conf/
109- mvn -version
110- 
111- rm -rf apache-maven-3.5.4-bin.tar.gz
112- else
113- echo "Install maven Fail"
114- fi
115-fi
116-echo ""
117- 
118- 
119-hasNode
120-if [ $? != 1 ]
121-then
122- echo "Not Found nodejs"
123- echo "Installing nodejs..."
124- 
125- isArm64
126- if [ $? != 1 ]
127- then
128- wget https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz
129- tar -xvf node-v16.15.1-linux-x64.tar.xz -C /etc/
130- 
131- if [ ! -f "/usr/bin/node" ]; then
132- ln -s /etc/node-v16.15.1-linux-x64/bin/node /usr/bin/node
133- fi
134- 
135- if [ ! -f "/usr/bin/npm" ]; then
136- ln -s /etc/node-v16.15.1-linux-x64/bin/npm /usr/bin/npm
137- fi
138- 
139- if [ ! -f "/usr/local/bin/node" ]; then
140- ln -s /etc/node-v16.15.1-linux-x64/bin/node /usr/local/bin/node
141- fi
142- 
143- if [ ! -f "/usr/local/bin/npm" ]; then
144- ln -s /etc/node-v16.15.1-linux-x64/bin/npm /usr/local/bin/npm
145- fi
146- rm -rf node-v16.15.1-linux-x64.tar.xz
147- else
148- wget https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-arm64.tar.gz
149- tar -xvf node-v16.15.1-linux-arm64.tar.gz -C /etc/
150- 
151- if [ ! -f "/usr/bin/node" ]; then
152- ln -s /etc/node-v16.15.1-linux-arm64/bin/node /usr/bin/node
153- fi
154- 
155- if [ ! -f "/usr/bin/npm" ]; then
156- ln -s /etc/node-v16.15.1-linux-arm64/bin/npm /usr/bin/npm
157- fi
158- 
159- if [ ! -f "/usr/local/bin/node" ]; then
160- ln -s /etc/node-v16.15.1-linux-arm64/bin/node /usr/local/bin/node
161- fi
162- 
163- if [ ! -f "/usr/local/bin/npm" ]; then
164- ln -s /etc/node-v16.15.1-linux-arm64/bin/npm /usr/local/bin/npm
165- fi
166- rm -rf node-v16.15.1-linux-arm64.tar.gz
167- fi
168- npm config set registry http://registry.npmmirror.com/
169- hasNode
170- if [ $? != 1 ]
171- then
172- echo "Install nodejs Fail"
173- fi
174-fi
DopenGauss-visualtool/install.sh+0-70
@@ -1,70 +0,0 @@
1-#!/usr/bin/env bash
2-echo "begin install..."
3-sh ./uninstall.sh
4-read -p "Do you want to automatically install dependencies (JDK, maven, node) ? (Press y|Y for Yes, any other key for No). " install_depency
5-if [ "$install_depency" = "Y" -o "$install_depency" = "y" ]; then
6- sh ./install-depency.sh
7-else
8- echo "Please install the dependencies required by the system by yourself, including openjdk (11), maven (3), and node (16.15.1)."
9- exit 1
10-fi
11- 
12-read -p "Please enter the host of openGauss, Please ensure that the current host IP is in the whitelist of openGauss: " host
13-if [ ! -n "$host" ]; then
14- echo "Host cannot be empty."
15- exit 1
16-fi
17-read -p "Please enter the port of openGauss.: " port
18-if [ ! -n "$port" ]; then
19- echo "Port cannot be empty."
20- exit 1
21-fi
22-read -p "Please enter the database of openGauss.: " database
23-if [ ! -n "$database" ]; then
24- echo "Database cannot be empty."
25- exit 1
26-fi
27-read -p "Please enter the username of openGauss.: " username
28-if [ ! -n "$username" ]; then
29- echo "Username cannot be empty."
30- exit 1
31-fi
32-stty -echo
33-read -p "Please enter the password of openGauss.: " password
34-if [ ! -n "$password" ]; then
35- echo "Password cannot be empty."
36- exit 1
37-fi
38-stty echo
39- 
40-echo "host: $host, port: $port username: $username database: $database"
41-cp config/application-temp.yml config/application-cus.yml
42-sed -i "23s/ip:port/$host:$port/" config/application-cus.yml
43-sed -i "23s/database/$database/" config/application-cus.yml
44-sed -i "24s/dbuser/$username/" config/application-cus.yml
45-sed -i "25s/dbpassword/$password/" config/application-cus.yml
46- 
47-mvn clean install -P prod -Dmaven.test.skip=true
48-mkdir -p /ops/server/openGauss-visualtool/
49-mkdir -p /ops/files/
50-mkdir -p /ops/server/openGauss-visualtool/logs/
51-mkdir -p /ops/server/openGauss-visualtool/config/
52-mkdir -p /ops/ssl/
53-if [ ! -f "/ops/ssl/keystore.p12" ];then
54- /etc/jdk11/bin/keytool -genkey -noprompt \
55- -dname "CN=opengauss, OU=opengauss, O=opengauss, L=Beijing, S=Beijing, C=CN"\
56- -alias opengauss\
57- -storetype PKCS12 \
58- -keyalg RSA \
59- -keysize 2048 \
60- -keystore /ops/ssl/keystore.p12 \
61- -validity 3650 \
62- -storepass 123456
63-fi
64-echo "SSL is enabled, you can replace the keystore file at /ops/ssl/ folder and config the ssl options at file /ops/server/openGauss-visualtool/config/application-cus.yml"
65- 
66-touch /ops/server/openGauss-visualtool/logs/visualtool-main.out
67-cp visualtool-api/target/visualtool-main.jar /ops/server/openGauss-visualtool/
68-mv config/application-cus.yml /ops/server/openGauss-visualtool/config/
69-chown -R og_ops:og_ops /ops
70-echo "end install"
DopenGauss-visualtool/server.sh+0-88
@@ -1,88 +0,0 @@
1-#!/usr/bin/env bash
2- 
3-SERVER_HOME=/ops/server/openGauss-visualtool
4-cd $SERVER_HOME
5-API_NAME=visualtool-main
6-JAR_NAME=$SERVER_HOME/$API_NAME\.jar
7-LOG=$SERVER_HOME/logs/$API_NAME\.out
8-PID=$SERVER_HOME/$API_NAME\.pid
9- 
10-usage() {
11- echo "Usage: sh server.sh [start|stop|restart|status]"
12- exit 1
13-}
14- 
15-is_exist(){
16- pid=`ps -ef|grep $JAR_NAME|grep -v grep|awk '{print $2}' `
17- if [ -z "${pid}" ]; then
18- return 1
19- else
20- return 0
21- fi
22-}
23- 
24-start(){
25- is_exist
26- if [ $? -eq "0" ]; then
27- echo ">>> ${JAR_NAME} is already running PID=${pid} <<<"
28- else
29- echo '' > $LOG
30- nohup /etc/jdk11/bin/java -Xms2048m -Xmx4096m -jar $JAR_NAME --spring.profiles.active=cus >$LOG 2>&1 &
31- echo $! > $PID
32- echo ">>> start $JAR_NAME successed PID=$! <<<"
33- fi
34- }
35- 
36-stop(){
37- pidf=$(cat $PID)
38- echo ">>> ${API_NAME} PID = $pidf begin kill $pidf <<<"
39- kill $pidf
40- rm -rf $PID
41- sleep 2
42- is_exist
43- if [ $? -eq "0" ]; then
44- echo ">>> ${API_NAME} 2 PID = $pid begin kill -9 $pid <<<"
45- kill -9 $pid
46- sleep 2
47- echo ">>> $JAR_NAME process stopped <<<"
48- else
49- echo ">>> ${JAR_NAME} is not running <<<"
50- fi
51-}
52- 
53-status(){
54- is_exist
55- if [ $? -eq "0" ]; then
56- echo ">>> ${JAR_NAME} is running PID is ${pid} <<<"
57- else
58- echo ">>> ${JAR_NAME} is not running <<<"
59- fi
60-}
61- 
62-restart(){
63- stop
64- start
65-}
66- 
67-case "$1" in
68- "start")
69- start
70- ;;
71- "stop")
72- stop
73- ;;
74- "status")
75- status
76- ;;
77- "restart")
78- restart
79- ;;
80- *)
81- usage
82- ;;
83-esac
84-exit 0
85-}
86- 
87- 
88- 
DopenGauss-visualtool/uninstall.sh+0-5
@@ -1,5 +0,0 @@
1-#!/usr/bin/env bash
2-echo "begin uninstall..."
3-sh server.sh stop
4-rm -rf /ops
5-echo "end uninstall"
DopenGauss-visualtool/upgrade.sh+0-6
@@ -1,6 +0,0 @@
1-#!/usr/bin/env bash
2-echo "begin upgrade..."
3-mvn clean install -P prod -Dmaven.test.skip=true
4-/bin/cp -rf visualtool-api/target/visualtool-main.jar /ops/server/openGauss-visualtool/
5-chown -R og_ops:og_ops /ops
6-echo "end upgrade"
MopenGauss-visualtool/visualtool-api/src/main/java/org/opengauss/admin/web/ws/WebSocketEndpoint.java+1-2
@@ -47,8 +47,7 @@ public class WebSocketEndpoint {
47 public void onError(@PathParam("pluginId") String pluginId,47 public void onError(@PathParam("pluginId") String pluginId,
48 @PathParam("sessionId") String sessionId,48 @PathParam("sessionId") String sessionId,
49 Throwable error) {49 Throwable error) {
50- error.printStackTrace();50+ log.error("onError,pluginId:{},sessionId:{},errorMessage:{}",pluginId,sessionId,error.getMessage());
51- log.error("onError,pluginId:{},sessionId:{}",pluginId,sessionId);
52 }51 }
53 52 
54 @OnMessage53 @OnMessage
MopenGauss-visualtool/visualtool-common/src/main/java/org/opengauss/admin/common/core/handler/ops/cache/TaskManager.java+4-1
@@ -1,5 +1,7 @@
1package org.opengauss.admin.common.core.handler.ops.cache;1package org.opengauss.admin.common.core.handler.ops.cache;
2 2 
3+import lombok.extern.slf4j.Slf4j;
4+ 
3import java.util.Objects;5import java.util.Objects;
4import java.util.Optional;6import java.util.Optional;
5import java.util.concurrent.ConcurrentHashMap;7import java.util.concurrent.ConcurrentHashMap;
@@ -10,6 +12,7 @@ import java.util.concurrent.TimeUnit;
10 * @author lhf12 * @author lhf
11 * @date 2022/8/11 20:3713 * @date 2022/8/11 20:37
12 **/14 **/
15+@Slf4j
13public class TaskManager {16public class TaskManager {
14 private static final ConcurrentHashMap<String, Future<?>> TASK_CONTEXT = new ConcurrentHashMap<>();17 private static final ConcurrentHashMap<String, Future<?>> TASK_CONTEXT = new ConcurrentHashMap<>();
15 18 
@@ -24,7 +27,7 @@ public class TaskManager {
24 try {27 try {
25 TimeUnit.SECONDS.sleep(2);28 TimeUnit.SECONDS.sleep(2);
26 } catch (InterruptedException e) {29 } catch (InterruptedException e) {
27- e.printStackTrace();30+ log.error("remove task error, message: {}", e.getMessage());
28 }31 }
29 }32 }
30 33 
MopenGauss-visualtool/visualtool-common/src/main/java/org/opengauss/admin/common/utils/ServletUtils.java+3-1
@@ -15,6 +15,7 @@
15 */15 */
16package org.opengauss.admin.common.utils;16package org.opengauss.admin.common.utils;
17 17 
18+import lombok.extern.slf4j.Slf4j;
18import org.opengauss.admin.common.core.text.Convert;19import org.opengauss.admin.common.core.text.Convert;
19import org.springframework.web.context.request.RequestAttributes;20import org.springframework.web.context.request.RequestAttributes;
20import org.springframework.web.context.request.RequestContextHolder;21import org.springframework.web.context.request.RequestContextHolder;
@@ -31,6 +32,7 @@ import java.io.IOException;
31 *32 *
32 * @author xielibo33 * @author xielibo
33 */34 */
35+@Slf4j
34public class ServletUtils {36public class ServletUtils {
35 37 
36 /**38 /**
@@ -103,7 +105,7 @@ public class ServletUtils {
103 response.setCharacterEncoding("utf-8");105 response.setCharacterEncoding("utf-8");
104 response.getWriter().print(string);106 response.getWriter().print(string);
105 } catch (IOException e) {107 } catch (IOException e) {
106- e.printStackTrace();108+ log.error("error, message: {}", e.getMessage());
107 }109 }
108 return null;110 return null;
109 }111 }
MopenGauss-visualtool/visualtool-common/src/main/java/org/opengauss/admin/common/utils/file/FileUploadUtils.java+3-1
@@ -1,6 +1,7 @@
1package org.opengauss.admin.common.utils.file;1package org.opengauss.admin.common.utils.file;
2 2 
3import cn.hutool.core.io.FileUtil;3import cn.hutool.core.io.FileUtil;
4+import lombok.extern.slf4j.Slf4j;
4import org.opengauss.admin.common.config.SystemConfig;5import org.opengauss.admin.common.config.SystemConfig;
5import org.opengauss.admin.common.constant.Constants;6import org.opengauss.admin.common.constant.Constants;
6import org.opengauss.admin.common.exception.file.FileNameLengthLimitExceededException;7import org.opengauss.admin.common.exception.file.FileNameLengthLimitExceededException;
@@ -21,6 +22,7 @@ import java.nio.charset.StandardCharsets;
21 *22 *
22 * @author xielibo23 * @author xielibo
23 */24 */
25+@Slf4j
24public class FileUploadUtils {26public class FileUploadUtils {
25 /**27 /**
26 * default size 50M28 * default size 50M
@@ -257,7 +259,7 @@ public class FileUploadUtils {
257 FileUtil.writeBytes(svgContent.getBytes(StandardCharsets.UTF_8), file.getPath());259 FileUtil.writeBytes(svgContent.getBytes(StandardCharsets.UTF_8), file.getPath());
258 return Constants.RESOURCE_PREFIX + "/icons" + File.separator + DateUtils.datePath() + File.separator + fileName;260 return Constants.RESOURCE_PREFIX + "/icons" + File.separator + DateUtils.datePath() + File.separator + fileName;
259 } catch (IOException e) {261 } catch (IOException e) {
260- e.printStackTrace();262+ log.error("write menu svg error, message: {}", e.getMessage());
261 }263 }
262 return "";264 return "";
263 }265 }
MopenGauss-visualtool/visualtool-framework/src/main/java/org/opengauss/admin/framework/aspectj/LogAspect.java+0-1
@@ -86,7 +86,6 @@ public class LogAspect {
86 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));86 AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
87 } catch (Exception exp) {87 } catch (Exception exp) {
88 log.error("error:{}", exp.getMessage());88 log.error("error:{}", exp.getMessage());
89- exp.printStackTrace();
90 }89 }
91 }90 }
92 91 
MopenGauss-visualtool/visualtool-framework/src/main/java/org/opengauss/admin/framework/web/filter/WhiteListFilter.java+1-1
@@ -34,7 +34,7 @@ public class WhiteListFilter implements Filter {
34 try {34 try {
35 returnContent(servletResponse,"Sorry,The current IP is not in the white list, please contact the administrator to add it before accessing.");35 returnContent(servletResponse,"Sorry,The current IP is not in the white list, please contact the administrator to add it before accessing.");
36 } catch (Exception e) {36 } catch (Exception e) {
37- e.printStackTrace();37+ log.error("error, message: {}", e.getMessage());
38 }38 }
39 }39 }
40 }40 }
MopenGauss-visualtool/visualtool-service/src/main/java/org/opengauss/admin/system/service/impl/SysLogServiceImpl.java+1-1
@@ -193,7 +193,7 @@ public class SysLogServiceImpl implements ISysLogService {
193 file.put("createdAt", attrs.creationTime().toMillis());193 file.put("createdAt", attrs.creationTime().toMillis());
194 file.put("updatedAt", attrs.lastModifiedTime().toMillis());194 file.put("updatedAt", attrs.lastModifiedTime().toMillis());
195 } catch (IOException e) {195 } catch (IOException e) {
196- e.printStackTrace();196+ log.error("list all log error, message: {}", e.getMessage());
197 }197 }
198 files.add(file);198 files.add(file);
199 }199 }