1.执行如下命令查看操作系统日志文件。
vim /var/log/messages
关注其中近一个月出现的kernel、error、fatal等字样,根据系统报警信息进行处理。
2.检查数据库运行日志
•收集日志的主机网络通畅且未宕机,数据库安装用户互信正常。
•日志收集工具依赖操作系统工具如gstack,如果未安装该工具,则提示错误后,跳过该收集项。
3.收集某个时间段内的日志。
gs_collector --begin-time="20240407 18:00" --end-time="20240408 08:00" -h 192.168.0.142
gs_collector --begin-time="20240407 18:00" --end-time="20240408 08:00"
[omm@gauss001 ~]$ gs_collector --begin-time="20240407 18:00" --end-time="20240408 08:00"
Successfully parsed the configuration file.
create Dir.
Successfully create dir.
do system check interval 0 : count 1
Collecting OS information.
Failed to collect OS information.
do database check interval 0 : count 1
Collecting catalog statistics.
Failed collected catalog statistics.
do log check interval 0 : count 1
Collecting Log files.
Successfully collected Log files.
do Config check 0:1
Collecting Config files.
Successfully collected Config files.
Collecting files.
Successfully to collect files.
All results are stored in /data/cluster/logs/gaussdb/omm/collector_20240408_093215.tar.gz.
4.解压并查看日志。
[omm@gauss001 ~]$ tar xvf collector_20240408_093215.tar.gz
collector_20240408_093215/
collector_20240408_093215/Detail.log
collector_20240408_093215/Summary.log
collector_20240408_093215/192.168.0.142.tar.gz
(1)Detail.log
[omm@gauss001 collector_20240408_093215]$ more Detail.log
-----------------------------------------------------------------------
| |
| 192.168.0.142 - Collecting OS information - Failed |
| |
-----------------------------------------------------------------------
| SuccessfulTask | hostname ; ps ux ; free -m |
-----------------------------------------------------------------------
| FailedTask | iostat -xm 2 3 : | --没有安装sysstat软件包。
-----------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
| |
| 192.168.0.142 - Collecting catalog information - Failed |
| |
--------------------------------------------------------------------------------------------------------------------
| FailedTask | Collecting catalog information: [GAUSS-53503] : There is no coordinator inst in this host |
--------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------
| |
| 192.168.0.142 - Collecting pg_log information - Success |
| |
----------------------------------------------------------------------------
| SuccessfulTask | find log files; copy log files |
----------------------------------------------------------------------------
----------------------------------------------------------------------------
| |
| 192.168.0.142 - Collecting Config information - Success |
| |
----------------------------------------------------------------------------
| SuccessfulTask | collect Config information |
----------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
| |
| 192.168.0.142 - Copy Collect Info Files - Success |
| |
-------------------------------------------------------------------------------------------------------------------
| SuccessfulTask | Check Dir; Copy Collect Info Files; Compress Collect Info Files; Send Collect Info Files |
-------------------------------------------------------------------------------------------------------------------
(2)Summary.log
[omm@gauss001 collector_20240408_093215]$ more Summary.log
--------------------------------------------------------------------------------
| | | |
| TASK NAME | SUCCESS HOSTNAME | FAILED HOSTNAME |
| | | |
--------------------------------------------------------------------------------
|Collecting OS information-1 | | 192.168.0.142 |
--------------------------------------------------------------------------------
|Collecting catalog information-1 | | 192.168.0.142 |
--------------------------------------------------------------------------------
|Collecting pg_log information-1 | 192.168.0.142 | |
--------------------------------------------------------------------------------
|Collecting Config information-1 | 192.168.0.142 | |
--------------------------------------------------------------------------------
|Copy Collect Info Files-1 | 192.168.0.142 | |
--------------------------------------------------------------------------------
[omm@gauss001 collector_20240408_093215]$ tar xvf 192.168.0.142.tar.gz
192.168.0.142/
192.168.0.142/logfiles/
192.168.0.142/logfiles/log_20240408_093216907859.tar.gz
192.168.0.142/catalogfiles/
192.168.0.142/systemfiles/
192.168.0.142/systemfiles/OS_information_20240408_093215613953.txt
192.168.0.142/systemfiles/database_system_info_20240408_093215643918.txt
192.168.0.142/configfiles/
192.168.0.142/configfiles/config_20240408_093217458939/
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/pg_hba.conf
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/pg_control
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/gaussdb.state
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/postgresql.conf
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/pg_replslot/
192.168.0.142/configfiles/config_20240408_093217458939/dn_6001/pg_ident.conf
[omm@gauss001 collector_20240408_093215]$ cd 192.168.0.142
[omm@gauss001 192.168.0.142]$ ll
total 16
drwx------ 2 omm omm 4096 Apr 8 09:32 catalogfiles
drwx------ 3 omm omm 4096 Apr 8 09:32 configfiles
drwx------ 2 omm omm 4096 Apr 8 09:32 logfiles
drwx------ 2 omm omm 4096 Apr 8 09:32 systemfiles