17-diagnose.md 7.3 KB
Newer Older
D
dingbo 已提交
1
---
2 3
sidebar_label: Diagnose
title: Diagnose Problems
D
dingbo 已提交
4 5
---

6
## Diagnose Network Connection
D
dingbo 已提交
7

8
When the client is unable to access the server, the network connection between the client side and the server side needs to be checked to find out the root cause and resolve problems.
D
dingbo 已提交
9

10
The diagnostic for network connection can be executed between Linux and Linux or between Linux and Windows.
D
dingbo 已提交
11

12
Diagnostic steps:
D
dingbo 已提交
13

14 15 16
1. If the port range to be diagnosed are being occupied by a `taosd` server process, please firstly stop `taosd.
2. On the server side, execute command `taos -n server -P <port> -l <pktlen>` to monitor the port range starting from the port specified by `-P` parameter with the role of "server.
3. On the client side, execute command `taos -n client -h <fqdn of server> -P <port> -l <pktlen>` to send testing package to the specified server and port.
D
dingbo 已提交
17
 
18
-l <pktlen\>: The size of the testing package, in bytes. The value range is [11, 64,000] and default value is 1,000. Please be noted that the package length must be same in the above 2 commands executed on server side and client side respectively.
D
dingbo 已提交
19

20
Output of the server side is as below for example:
D
dingbo 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

```bash
# taos -n server -P 6000
12/21 14:50:13.522509 0x7f536f455200 UTL work as server, host:172.27.0.7 startPort:6000 endPort:6011 pkgLen:1000

12/21 14:50:13.522659 0x7f5352242700 UTL TCP server at port:6000 is listening
12/21 14:50:13.522727 0x7f5351240700 UTL TCP server at port:6001 is listening
...
...
...
12/21 14:50:13.523954 0x7f5342fed700 UTL TCP server at port:6011 is listening
12/21 14:50:13.523989 0x7f53437ee700 UTL UDP server at port:6010 is listening
12/21 14:50:13.524019 0x7f53427ec700 UTL UDP server at port:6011 is listening
12/21 14:50:22.192849 0x7f5352242700 UTL TCP: read:1000 bytes from 172.27.0.8 at 6000
12/21 14:50:22.192993 0x7f5352242700 UTL TCP: write:1000 bytes to 172.27.0.8 at 6000
12/21 14:50:22.237082 0x7f5351a41700 UTL UDP: recv:1000 bytes from 172.27.0.8 at 6000
12/21 14:50:22.237203 0x7f5351a41700 UTL UDP: send:1000 bytes to 172.27.0.8 at 6000
12/21 14:50:22.237450 0x7f5351240700 UTL TCP: read:1000 bytes from 172.27.0.8 at 6001
12/21 14:50:22.237576 0x7f5351240700 UTL TCP: write:1000 bytes to 172.27.0.8 at 6001
12/21 14:50:22.281038 0x7f5350a3f700 UTL UDP: recv:1000 bytes from 172.27.0.8 at 6001
12/21 14:50:22.281141 0x7f5350a3f700 UTL UDP: send:1000 bytes to 172.27.0.8 at 6001
...
...
...
12/21 14:50:22.677443 0x7f5342fed700 UTL TCP: read:1000 bytes from 172.27.0.8 at 6011
12/21 14:50:22.677576 0x7f5342fed700 UTL TCP: write:1000 bytes to 172.27.0.8 at 6011
12/21 14:50:22.721144 0x7f53427ec700 UTL UDP: recv:1000 bytes from 172.27.0.8 at 6011
12/21 14:50:22.721261 0x7f53427ec700 UTL UDP: send:1000 bytes to 172.27.0.8 at 6011
```

51
Output of the client side is as below for example:
D
dingbo 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

```bash
# taos -n client -h 172.27.0.7 -P 6000
12/21 14:50:22.192434 0x7fc95d859200 UTL work as client, host:172.27.0.7 startPort:6000 endPort:6011 pkgLen:1000

12/21 14:50:22.192472 0x7fc95d859200 UTL server ip:172.27.0.7 is resolved from host:172.27.0.7
12/21 14:50:22.236869 0x7fc95d859200 UTL successed to test TCP port:6000
12/21 14:50:22.237215 0x7fc95d859200 UTL successed to test UDP port:6000
...
...
...
12/21 14:50:22.676891 0x7fc95d859200 UTL successed to test TCP port:6010
12/21 14:50:22.677240 0x7fc95d859200 UTL successed to test UDP port:6010
12/21 14:50:22.720893 0x7fc95d859200 UTL successed to test TCP port:6011
12/21 14:50:22.721274 0x7fc95d859200 UTL successed to test UDP port:6011
```

69
The output needs to be checked carefully for the system operator to find out root cause and solve the problem.
D
dingbo 已提交
70

71
## Startup Status and RPC Diagnostic
D
dingbo 已提交
72

73
`taos -n startup -h <fqdn of server>` can be used to check the startup status of a `taosd` process. This is a comman task for a system operator to do to determine whether `taosd` has been started successfully, especially in case of cluster.
D
dingbo 已提交
74

75
`taos -n rpc -h <fqdn of server>` can be used to check whether the port of a started `taosd` can be accessed or not. If `taosd` process doesn't respond or work abnormally, this command can be used to initiate a rpc communication with the specified fqdn to determine whether it's network problem or `taosd` is abnormal.
D
dingbo 已提交
76

77
## Sync and Arbitrator Diagnostic
D
dingbo 已提交
78

79
```bash
D
dingbo 已提交
80 81 82 83
taos -n sync -P 6040 -h <fqdn of server>
taos -n sync -P 6042 -h <fqdn of server>
```

84
The above commands can be executed on Linux Shell to check whether the port for sync works well and whether the sync module of the server side works well. Besides, `-P 6042` is used to check whether the arbitrator is configured properly and works well.
D
dingbo 已提交
85

86
## Network Speed Diagnostic
D
dingbo 已提交
87 88 89

`taos -n speed -h <fqdn of server> -P 6030 -N 10 -l 10000000 -S TCP`

90
From version 2.2.0.0, the above command can be executed on Linux Shell to test the network speed, it sends uncompressed package to a running `taosd` server process or a simulated server process started by `taos -n server` to test the network speed. Parameters can be used when testing network speed are as below:
D
dingbo 已提交
91

92 93 94 95 96 97
-n:When set to "speed", it means testing network speed
-h:The FQDN or IP of the server process to be connected to; if not set, the FQDN configured in `taos.cfg` is used
-P:The port of the server process to connect to, the default value is 6030
-N:The number of packages that will be sent in the test, range is [1,10000], default value is 100
-l:The size of each package in bytes, range is [1024, 1024 \* 1024 \* 1024], default value is 1024
-S:The type of network packages to send, can be either TCP or UDP, default value is 
D
dingbo 已提交
98

99
## FQDN Resolution Diagnostic
D
dingbo 已提交
100 101 102

`taos -n fqdn -h <fqdn of server>`

103
From version 2.2.0.0, the above command can be executed on Linux Shell to test the resolution speed of FQDN. It can be used to try to resolve a FQDN to an IP address and record the time spent in this process. The parameters that can be used for this purpose are as below:
D
dingbo 已提交
104

105 106
-n:When set to "fqdn", it means testing the speed of resolving FQDN
-h:The FQDN to be resolved. If not set, the `FQDN` parameter in `taos.cfg` is used by default.
D
dingbo 已提交
107

108
## Server Log
D
dingbo 已提交
109

110
The parameter `debugFlag` is used to control the log level of `taosd` server process. The default value is 131, for debug purpose it needs to be escalated to 135 or 143. 
D
dingbo 已提交
111

112
Once this parameter is set to 135 or 143, the log file grows very quickly especially when there is huge volume of data insertion and data query requests. If all the logs are stored together, some important information may be missed very easily, so on server side important information is stored at different place from other logs.一
D
dingbo 已提交
113

114 115
- The log at level of INFO, WARNING and ERROR is stored in `taosinfo` so that it is easy to find important information 
- The log at level of DEBUG (135) and TRACE (143) and other information not handled by `taosinfo` are stored in `taosdlog`
D
dingbo 已提交
116

117
## Client Log
D
dingbo 已提交
118

119
An independent log file, named as "taoslog+<seq num\>" is generated for each client program, i.e. a client process. The default value of `debugfalg` is also 131 and only log at level of INFO/ERROR/WARNING is recorded, it and needs to be changed to 135 or 143 so that log at DEBUG or TRACE level can be recorded for debugging purpose.
D
dingbo 已提交
120

121
The maximum length of a single log file is controlled by parameter `numOfLogLines` and only 2 log files are kept for each `taosd` server process.
D
dingbo 已提交
122

123
log file is written in async way to minimize the workload on disk, bu the penalty is that a few log lines may be lost in some extreme conditions.