由于修改了远程服务器SSH端口,在用rsync做数据同步时报如下错误:

[root@localhost mysql]# rsync -arz ./alldatabases_2017-10-30.sql [email protected]:/data/backup/13.3.21.14/

ssh: connect to host 120.24.174.90 port 22: Connection refused

rsync: connection unexpectedly closed (0 bytes received so far) [sender]

rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]


解决:需要增加参数-e,如下:

[root@localhost mysql]# rsync -arz -e 'ssh -p 65003' ./alldatabases_2017-10-30.sql [email protected]:/data/backup/13.3.21.14/