Home > Back-end >  Encounter a problem, how in the Java background copy an image to another server
Encounter a problem, how in the Java background copy an image to another server

Time:12-01

Demand is like that, I have two servers, a back-end systems in server 1, I upload an image to the server through the system 1, and then like a review in the system, after review by the image directly to server 2, the question now is I don't know how to upload the picture from the server 1 server 2, had not thought, strives for the great god do me a favor

CodePudding user response:

I can only think of this centralized approach
1. Through the system of the rsync command, such as timing synchronization path of the specified file (approval file path?
2. Using NFS, such as the two servers the same NFS mount, to achieve the sharing,
3. The server 2 provides a upload file API, server 1 2 upload file API call server files,

CodePudding user response:

reference 1st floor kimsung response:

I can only think of this concentration method1. Through the system of the rsync command, such as timing synchronization path of the specified file (approval file path?
2. Using NFS, such as the two servers the same NFS mount, to achieve the sharing,
3. The server 2 provides a upload file API, 1 call server upload files 2 API file transfer,

Thank you thank you thank you

CodePudding user response:

A solution: to build a file server, FTP server, for example, machine 1 and machine 2 pictures of access to the FTP server, need not passed around,

CodePudding user response:

With Shared storage

CodePudding user response:

1. Simple, resource mapping for server 1, 2 call server when using downloaded to the local flow to download

CodePudding user response:

reference 5 floor javageekcoder reply:
1. Simple, resource mapping for server 1, 2 call server when adopt the way of flow download download to local

If there were dozens of servers, you this plan is not working properly, so I suggest:
Looking for a server, in addition to open a Tomcat (preferably prescribe a domain name for the Tomcat)
Separate function of the project to write a document, deployed on the Tomcat, then all the cluster nodes to share this document service

CodePudding user response:

How much of a file?
A single file only a few hundred k, it is recommended to use HTTP
Implement a receives the file server 2 API service: receive json, base64 into the picture files, stored in a place you'd like to deposit;
Implement a upload files on server 1 API service: the image into base64 encoding, in json format to server 2,
The server using the HTTP transmission between 1 and 2

CodePudding user response:

Netty see

CodePudding user response:

Base64 transmit the binary file into a string
  • Related