dsizd368332
dsizd368332
2017-07-21 09:08

文件从Google Compute引擎传输到Google Storage

已采纳

I have read the documentation for Google Cloud Storage(GCS) and I am very confused.

Let me describe the situation:

Before I am using a simple php script to back up data from and SQL Table. At every one hour. Afterwards I sent it to my ftp server. Now Now I would like instead to be sent to a google nearline cold storage.

Before the script was simple, nothing fancy just a little PHP

passthru('curl --connect-timeout 30 --max-time 3600 -T '.$file_path.' "ftp://'.$ftp_server['user'].':'.$ftp_server['pass'].'@'.$ftp_server['ip'].':'.$ftp_server['port'].$ftp_server['path'].'/'.$filename.'.gz"', $status_result);

Now I read the google cloud API and I am very confused of actually how to change my PHP script, so that it sends the gz files to the nearline cold storage.

I read this: https://developers.google.com/api-client-library/php/

and I have the following questions

  • It says that I have to include the google API, how do I do that? In the example it said that I should use the command "$ composer require google/cloud" and then write in my PHP files: "use Google\Cloud\ServiceBuilder;" But I haven't use composer on the server. The server is written on pure PHP.

    1. If I have a simple php file (history_dump.php for example), how do I include the google cloud API as external link?
    2. The way I have done it now is SQL -> csv -> gz, I don't want to change that can I send gz files to GCS? How?

Thank you in advance

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答