简体   繁体   中英

How do I get access to a Google Compute VM Filesystem remotely using the Java API?

I'm building a framework application for managing files between compute engines based on their roles. I've been able to find a lot of information for managing the compute engines themselves, but nothing for getting access to them to manage files.

There is no Google API for reading and writing to instance filesystems from outside the instance. You will need to run a service on the instance (ftp, sftp, whatever) if you want external access to its filesystem.

Fratzke, first of all your question is incomplete, what platform are you using on compute engine instances, do you want only read only access ?

Note if you want a persistence disk to be shared among many compute engine instances, you can do that only in read only mode. The google documentation clearly states that :

It is possible to attach a persistent disk to more than one instance. However, if you attach a persistent disk to multiple instances, all instances must attach the persistent disk in read-only mode. It is not possible to attach the persistent disk to multiple instances in read-write mode.

However, you can share files between multiple instances using the managed services like google cloud storage , google cloud datastore etc. Answer for similar question is already on SO. Refer this links:

Share a persistent disk between Google Compute Engine VMs

Edit:
If you want to access a filesystem on a multiple instances remotely using JAVA, then they have to make filesystem available with a service. Such a service is typically a background job, which handles incoming requests and returns a response, eg for authentication, authorization, reading and writing. The specification of the request/response pattern is called a protocol - eg NFS on UNIX/LINUX. U cn write ur own file service provider & run it on the instnces. As transport layer for such an endeavor sockets (TCP/IP) can be used. good transport layer would be the http protocol, eg with a restful service.

Edit - 2

Nother possibility is using sshfs , mount the filesystem on each instance and use them within your java code as mounted network shared drive.

Hope this helps you ...Warm Regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM