【问题标题】:How to schedule site crawls in Google Cloud?如何在 Google Cloud 中安排网站抓取?
【发布时间】:2020-04-03 22:17:03
【问题描述】:

我想在 Google Cloud 中存储网络爬虫软件 Screaming Frog 的副本。这将在 Compute Engine 实例或 Kubernetes 容器中。

可以使用 linux shell 在我的计算机上本地运行尖叫青蛙爬行:

screamingfrogseospider --crawl https://www.example.com --headless --save-crawl --output-folder /tmp/cli

是否可以在 Google Cloud 中做类似的事情?

理想情况下,我想安排某种 cron 任务,使上述 shell 命令运行,从而爬取网站;将生成的抓取保存到 Google Cloud 存储中的存储桶中。

我该怎么做?

另外,我可以使用 Python 等编程语言在 GCP 中设置和安排 cron 任务吗? 这个想法是让我组织中的人员能够登录到 UI(可能内置于 Flask)并自行安排爬网。然后 Flask 将连接到 Google Cloud 并配置任务。

【问题讨论】:

    标签: python google-cloud-platform google-compute-engine


    【解决方案1】:

    您可以使用 GCP 云调度程序。 在此链接中,您可以找到如何使用 cron 调度程序 [https://cloud.google.com/scheduler/docs/start-and-stop-compute-engine-instances-on-a-schedule] 启动和停止计算引擎的示例。在 GCE 启动脚本中,您可以设置站点爬取命令。

    另一个选择是Cloud composer,你可以在需要的时候编写一个调度的DAG,并使用airflow bash操作符运行shell命令(Cloud composer是GCP气流实现)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-24
      • 2020-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      相关资源
      最近更新 更多