Taosdemo.go reported "Unable to establish connection"
装机环境: TDEngine server: ubuntu TDEngine client: win10
运行Taosdemo.go时,能成功创建数据库和表, 但执行插入数据时,报错“Unable to establish connection”。日志已附上。 taoslog.zip
从log中可以看到,在执行sql insert command的时候,是向“user-OptiPlex-3020:6030”发送消息 (这是不对的,我并没有配置这个FQDN, 这应该是导致这个问题的原因),而执行drop/create db操作时,是向“tdengine:6030”发送消息 (tdengine是我配置的FQDN)。

FQDN已配置
请问你执行 taosdemo.go 的时候有指定 host 吗?
没有指定,执行的命令如下: `PS C:\Hedy\demo\hello> go run taosdemo.go
============= args parse result: ============= hostName: tdengine serverPort: 6030 usr: root password: taosdata dbName: test tablePrefix: d numOftables: 2 numOfRecordsPerTable: 10 numOfRecordsPerReq: 3 numOfThreads: 1 startTimestamp: 2020-10-01 08:00:00[1601510400000] startTimestamp: 2020-10-01 08:00:00[1601510400000]
Please press enter key to continue....`
没有指定,为什么 hostName 不是默认值 127.0.0.1 而是 tdengine 啊? tdengine是有效工作的 FQDN 吗? taos.exe 可以访问 tdengine 吗?
哦 理解上有些偏差。 tdengine 是在代码中指定的。taos.exe可以访问到tdengine。
成功创建数据库和表, 但执行插入数据时,报错“Unable to establish connection”
===
通常是 6030-6042 TCP/UDP 端口开放不全导致的
从log中看,执行插入数据时 用的还是6030的端口呀,6030端口是处于监听状态的。从taos shell中执行insert 语句,是可以成功的。
在Windows 上的 taos shell 功能都可以用吗?
是的
我看版本是2.0.12,可以试一下新版本吗?
TDEngine server和windows上的client都已升级到2.0.14.0。 升级的方式是先卸载(配置文件,log和数据库也都删除了)再安装。现在在Windows上,在taos shell中执行sql语句时报“DB error: Invalid app version”, 这要怎么解决?
`taos> create table p1(ts timestamp, a1 int);
Query OK, 0 row(s) affected (0.053000s)
taos> select * from p1;
DB error: Invalid app version (2.259000s)`
请执行
taos -V
taosd -V
输出是什么?
TDEngine server上执行的结果如下: `user@172:~$ taosd -V
community version: 2.0.14.0 compatible_version: 2.0.0.0
gitinfo: 6c3e1629e6b52fe7a3341ba5ff7a6f7cce9c5a53 gitinfoI: NULL buildinfo: Built at 2021-01-15 20:39
user@172:~$ taos -V version: 2.0.14.0 `
机器重启后,TDEngine service不能正常启动了,于是再次卸载和安装,目前遇到的问题是:在window机器上的taos shell客户端中执行sql,报错:Unable to resolve FQDN (2.267000s) `taos> use test; Query OK, 0 row(s) affected (0.001000s)
taos> insert into test.d0 values ( 1601510401000, 200.347290, 766, 0.297340 ) ( 1601510402000, 200.487167, 122, 0.404345 ) ( 1601510403000, 200.716034, 767, 0.501566 ) -> ;
DB error: Unable to resolve FQDN (2.267000s) taos> select * from test.d0;
DB error: Unable to resolve FQDN (0.014000s)`
log中发下如下信息: 01/25 17:01:10.708000 0x00000374 UTL ERROR failed to get the ip address, fqdn:172.20.248.54td1, since:不知道这样的主机。
td1是我新配的FQDN, 172.20.248.54是TDEngine service的IP。 在window机器上,是可以ping通td1的。
这是自己编译的 TDengine 吧?正式版的版本信息是:
community version: 2.0.14.0 compatible_version: 2.0.0.0
gitinfo: 79e4925
gitinfoI: 79e4925
buildinfo: Built at 2021-01-23 04:07:03
Unable to resolve FQDN 请根据 FAQ 文档自查一下
fqdn如果配置不正确的话,taos shell应该也连不上服务器吧?现在taos shell是可以连上服务器的
不完全是,因为 TDengine 用了多个端口,自动适配 TCP、UDP 协议,如果命令用到的端口打不开也是会 taos shell 能连上而某些命令不成功
不完全是,因为 TDengine 用了多个端口,自动适配 TCP、UDP 协议,如果命令用到的端口打不开也是会 taos shell 能连上而某些命令不成功
不同命令用的FQDN应该是同一个才是对的吧, 现在从log中看,执行create database的时候用的host是对的: 01/25 17:01:01.389000 0x00004014 RPC TSC 0000024AEAB301B8 0000000000000005, create-db is sent to td1:6030, len:172 sig:0x01000000:0x11000000:22193 但执行select的时候: `01/25 16:44:40.291000 0x000042c0 TSC 0000020815DBD750 SQL cmd:select will be processed, name:0.test.d0, type:72
01/25 16:44:40.291000 0x000042c0 TSC 0000020815DBD750 vgId:3, query on table:0.test.d0, tid:1, uid:844424946914387
01/25 16:44:40.292000 0x000042c0 TSC 0000020815DBD750 msg built success, len:720 bytes
01/25 16:44:40.292000 0x000042c0 RPC malloc mem:0000020815DC1C60 size:1552
01/25 16:44:40.292000 0x000042c0 UTL rsetId:1 p:0000020815DC1C60 rid:155 is added, count:2
01/25 16:44:40.305000 0x000042c0 UTL ERROR failed to get the ip address, fqdn:172.20.248.54td1, since:不知道这样的主机。
01/25 16:44:40.305000 0x000042c0 RPC ERROR TSC, failed to resolve FQDN:172.20.248.54td1
01/25 16:44:40.305000 0x000042c0 RPC ERROR TSC 0000000000000009, failed to set up connection(Unable to resolve FQDN)`
这应该不是配置的问题吧。 log已附上
172.20.248.54td1
hosts 文件里写错了吧?