一、任务步骤
1. 安装securityFX和securityCRT
下载地址:https://pan.baidu.com/s/15OYZdT7_7rH8Mo8HrJuJsQ
操作手册:见加压后的说明文档
2. ftp和crt连接远程服务器
IP、端口、用户名、密码见操作手册,向老师要
3. 待部署的war包
guoya-medium-wuling.war
把名字改成guoya-medium-姓名简称.war
下载地址:https://pan.baidu.com/s/1oqgmrT4JeyqRmy40IVOeVw
4. find命令定位tomcat
部署到叫ux的tomcat里面
[shccs01 ~]$find ./ -name webapps
./server/tomcat/passport/webapps
./server/tomcat/promotion/webapps
./server/tomcat/center/webapps
./server/tomcat/ux/webapps
[shccs01 ~]$
5. ftp上传war包到webapps下面
6. crt重启tomcat
在webapps上级目录找bin
find命令查找
find ~/ -name startup.sh查看进程是否存在
$ps -ef | grep shccs01 | grep tomcat停应用,并检查是否停成功
./shutdown.sh
$ps -ef | grep shccs01 | grep tomcat-
启应用
./startup.sh
$ps -ef | grep shccs01 | grep tomcat
7. 检查tomcat进程是否启动成功
./startup.sh
$ps -ef | grep shccs01 | grep tomcat
8. 查看tomcat启动日志是否正确
$find ./ -name cat.out
或者
$find ~/ -name cata.out | grep ux
./server/tomcat/passport/logs/catalina.out
./server/tomcat/promotion/logs/catalina.out
./server/tomcat/center/logs/catalina.out
./server/tomcat/ux/logs/catalina.out
$tail -300f ./server/tomcat/ux/logs/catalina.out
9. 查看应用能否正常访问
http://120.132.0.117:15021/guoya-medium-wuling/
10. 测试接口业务是否正常处理
<html>
<head>
<meta charset="utf-8" />
<title>xpl</title>
</head>
<body>
<center>
<h1>学生信息</h1>
<form action = 'http://120.132.0.117:15021/guoya-medium-wuling/student/add'>
<table style = "border:1px solid black;width:20%;">
<tr>
<td style = "border:1px solid black;width:30%;">
姓名
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'sname'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
学号
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'sno'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
年龄
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'age'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
电话号码
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'phone'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
导师姓名
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'tname'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
学历
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'education'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
性别
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'sex'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:30%;">
表名
</td>
<td style = "border:1px solid black;width:70%;">
<input type = "text" name = 'tableName' value = 'gy_student_xuepl'/>
</td>
</tr>
<tr>
<td style = "border:1px solid black;width:20%;" colspan = '2'>
<input type = "submit" value = '提交'/>
</td>
</table>
</form>
</center>
</body>
</html>
11.验证数据库是否正确
ip、端口、数据库实例名、用户名、密码见维护手册,找老师要
12. 测试异常流
重复注册
12.1 定位日志路径:
$find ./ -name cat*.out
./server/tomcat/passport/logs/catalina.out
./server/tomcat/promotion/logs/catalina.out
./server/tomcat/center/logs/catalina.out
./server/tomcat/ux/logs/catalina.out
12.2 进入日志文件夹:
$cd ./server/tomcat/ux/logs
12.3 定位报文所在文件及所在
行:
日志可能会同时写到好多个文件,进行分类备份
$grep '味全' *
或者
$grep -n '味全' *
查找当前目录下所有文件中,出现过“味全”两字的行,列出文件名、行号和行的内容
12.4 查看接口详情(上下文)
$more catalina.out
18万多行,需要分页+查询匹配进行查看
先more分页从前展现:
$more +182572 ./catalina.out
然后用“/”进行模糊匹配定位
/味全
14. 把日志文件截取
- 确定文件大小
文件很小,全量下载
文件很大,切割需要的部分下载
查看文件大小
$du -sh catalina.out
223M catalina.out
查看文件的行数(一般按照行进行拆分)
$wc catalina.out
185744 5007025 233130352 catalina.out
行数:185744
单词数:5007025
字节大小:233130352
定位需要日志开始的大致行号
$grep -n '味全' catalina.out
按行切分日志文件:
$split -l 185000 catalina.out catalina.out_wl_
$ls -l catalina.out*
-rw-r----- 1 shccs01 bss 233130352 5月 13 10:37 catalina.out
-rw-r--r-- 1 shccs01 bss 233039295 5月 13 11:02 catalina.out_wl_aa
-rw-r--r-- 1 shccs01 bss 91057 5月 13 11:02 catalina.out_wl_ab
再查看一下大小:
$du -sh catalina.out*
223M catalina.out
223M catalina.out_wl_aa
92K catalina.out_wl_ab
再统计一下行:
[shccs01 ~/server/tomcat/ux/logs]$wc catalina.out_wl_aa
185000 5000897 233039295 catalina.out_wl_aa
[shccs01 ~/server/tomcat/ux/logs]$wc catalina.out_wl_ab
744 6128 91057 catalina.out_wl_ab
15. 把日志文件下载
下载该文件:catalina.out_wl_ab
16.1 sz下载和rz上传
sz catalina_wl_ab
17. sftp session进行上传和下载
19. 合并文件:
$ls
a.log application data_bak logs server softerwar_bak test
]$ls > a.log
$ls
a.log application data_bak logs server softerwar_bak test
$cat a.log
a.log
application
data_bak
logs
server
softerwar_bak
test
$split -l 3 a.log a_
$ls
a_aa a_ab a_ac a.log
$cat a_aa
a.log
application
data_bak
$cat a_ab
logs
server
softerwar_bak
$cat a_ac
test
$cat a_*
a.log
application
data_bak
logs
server
softerwar_bak
test
$cat a_* > b.log
$cat b.log
a.log
application
data_bak
logs
server
softerwar_bak
test
17. 边测试边看日志(只看最新报文)
$tail -200f ./catalina.out
加回车打空行,便于查看新增内容