node上传文件到FTP服务器报Error: Timed out while making data connection

错误原因

在局域网内搭建了一个FTP服务器,因为项目使用node-ftp封装的一个FTP文件上传和下载服务,在上传文件的时候报如下错误:

(node:29020) UnhandledPromiseRejectionWarning: Error: Timed out while making data connection
at Timeout. (D:\git project\nexrender\packages\nexrender-provider-ftp\node_modules\ftp\lib\connection.js:901:12)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
(Use node --trace-warnings ... to show where the warning was created)
(node:29020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

问题分析

  1. 在服务器上开放了21端口
  2. 在本地使用cmd连接ftp服务是能够正常连接和上传下载文件的

解决办法

关闭防火墙,服务器是CentOS7,关闭的步骤如下

#查看防火墙开放的端口
firewall-cmd --list-ports
#8008/tcp 21/tcp 80/tcp
#查看防火墙的状态
firewall-cmd --state
#running
#关闭防火墙
systemctl stop firewalld
#查看防火墙状态
firewall-cmd --state
#not running
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING是Kafka中的一个错误,表示在连接状态为CONNECTING时等待连接超时。这个错误通常是由于ZooKeeper连接超时引起的。要解决这个问题,可以尝试以下几种方法: 1. 检查ZooKeeper服务器的可用性:确保ZooKeeper服务器正在运行,并且可以通过Kafka配置文件中指定的主机和端口进行访问。 2. 增加连接超时时间:可以通过在Kafka配置文件中增加以下参数来增加连接超时时间: ```shell zookeeper.connection.timeout.ms=6000 ``` 这将把连接超时时间增加到6秒。根据实际情况,您可以适当调整超时时间。 3. 检查网络连接:确保Kafka服务器和ZooKeeper服务器之间的网络连接正常。您可以尝试使用telnet命令测试与ZooKeeper服务器的连接: ```shell telnet <ZooKeeper服务器主机> <ZooKeeper服务器端口> ``` 如果telnet命令无法连接到ZooKeeper服务器,则可能存在网络连接问题。 4. 检查防火墙设置:如果您的系统上启用了防火墙,请确保防火墙允许Kafka服务器和ZooKeeper服务器之间的通信。 5. 检查Kafka配置文件:确保Kafka配置文件中的ZooKeeper连接字符串正确配置。您可以检查以下参数: ```shell zookeeper.connect=<ZooKeeper服务器主机>:<ZooKeeper服务器端口> ``` 这些方法应该能够帮助您解决kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING错误。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

修炼之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值