Cafemmo Club
← Quay lại danh sách

Lỗi khi sync giữa 2 server bằng lệnh shell_exec trong PHP

Thanh Nguyen08/01/20221402 lượt xem12 bình luận
Chào các cụ. Chả là e có 1 site download, vừa rồi bị report đến server storage đã phải chuyển nhà 1 lần rồi. Nay e muốn tạo 1 server backup cho con storage kia. Yêu cầu là khi nào upload file lên server storage chính thì sẽ đồng thời sync sang server backup Trên server backup e viết lệnh trong PHP ntn: $out_put = shell_exec('rsync -avzhe ssh root@storage_server_id:/var/www/html/domain/uploads/filename /var/www/html/domain/uploads/ 2>&1'); Khi chạy nó báo lỗi: Host key verification failed. rsync: connection unexpectedly closed (0 bytes received so far) [Receiver] rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.2] e đã tạo ssh-keygen trên server backup thành công. Bằng chứng là nếu e chạy trực tiếp lệnh: rsync -avzhe ssh root@storage_server_id:/var/www/html/domain/uploads/filename /var/www/html/domain/uploads/ trên server backup thì nó chạy thành công và không yêu cầu mật khẩu của server storage chính Các cụ có kinh nghiệm vụ này hướng dẫn e phát

Bình luận

Đang tải...

Đang kiểm tra đăng nhập...

Lỗi khi sync giữa 2 server bằng lệnh shell_exec trong PHP · Cafemmo Club