sqlserver资源连接不上是什么问题?

环境信息

  • EMQX 版本:4.4.5
  • 操作系统及版本:CentOS7.0
  • 其他

问题描述

sqlserver资源连接不上

配置文件及日志

2022-08-22T16:44:25.841266+08:00 [error] Supervisor: {local,odbc_sup}. Context: child_terminated. Reason: timeout. Offender: id=[],pid=<0.5394.9>.
2022-08-22T16:44:25.841707+08:00 [error] Initiate ‘sqlserver:resource:3ba2e53f’ failed {{shutdown,{failed_to_start_child,worker_sup,{shutdown,{failed_to_start_child,{worker,1},connection_closed}}}},{child,undefined,{pool_sup,‘sqlserver:resource:3ba2e53f’},{ecpool_pool_sup,start_link,[‘sqlserver:resource:3ba2e53f’,emqx_backend_sqlserver_actions,[{pool_size,8},{server,<<“192.168.1.229:1433”>>},{username,<<“te”>>},{password,<<“xxxxxxxx”>>},{database,<<“test”>>},{driver,<<“ms-sql”>>}]]},transient,false,infinity,supervisor,[ecpool_pool_sup]}}
2022-08-22T16:44:25.841907+08:00 [error] cluster_call error found, ResL: [{{emqx_backend_sqlserver_actions,on_resource_create},{error,{start_pool_failed,‘sqlserver:resource:3ba2e53f’},[{emqx_rule_actions_utils,start_pool,3,[{file,“emqx_rule_actions_utils.erl”},{line,119}]},{emqx_backend_sqlserver_actions,on_resource_create,2,[{file,“emqx_backend_sqlserver_actions.erl”},{line,250}]},{emqx_rule_engine,init_resource,4,[{file,“emqx_rule_engine.erl”},{line,634}]},{erpc,execute_call,4,[{file,“erpc.erl”},{line,392}]}]}}]
~

这说的是连不上,建议你先用 sql server 命令行工具,一样的参数先连上,把连接调通。

我用telnet访问能通,应该没问题呀,我的本地连接sqlserver是没问题的
[root@rs012 xinetd.d]# telnet 192.168.1.229 1433
Trying 192.168.1.229…
Connected to 192.168.1.229.
Escape character is ‘^]’.
Connection closed by foreign host.

因为emqx没有集成sqlserver的odbc,需要用户手动安装。可以查看使用文档https://docs.emqx.com/zh/enterprise/v4.3/rule/backend_sqlserver.html 里的centos配置odbc驱动的部分。

1 个赞

可以了,谢谢大佬!