【问题标题】:Deploying and executing programs on distributed remote machines在分布式远程机器上部署和执行程序
【发布时间】:2011-06-28 23:18:19
【问题描述】:

我正在开发一个将在 Amazon EC2 机器上运行的分布式程序。

理想情况下,我会在本地机器上开发,触发脚本以在远程机器上部署源代码(我拥有 ssh 访问权限的所有 Linux 机器),在每台机器上触发编译命令远程机器,然后在每个实例上运行程序,同时控制正在运行的程序(能够暂停它们)。

我想知道是否已经存在任何用于此类任务的工具(使用 MPI 除外,但这是另一个问题),如果没有,我应该遵循哪些最佳实践。

【问题讨论】:

    标签: linux deployment distributed


    【解决方案1】:

    根据您的部署规模,有许多替代方案。我个人没有尝试过的一个有趣的方法是glu。还有众所周知的 puppet、chef 系列配置管理工具,它们具有一些过程控制组件。

    【讨论】:

      【解决方案2】:

      你不会写 Perl 吗?

      Net::OpenSSH::Parallel 允许编写脚本,通过 SSH 在多个服务器上并行运行命令,这很容易:

      #!/usr/bin/perl
      
      use Net::OpenSSH::Parallel;
      
      my @hosts = (...);
      
      my $pssh = Net::OpenSSH::Parallel->new;
      $pssh->add_host($_) for @hosts;
      
      $pssh->all(rsync_put => '/local/path', '/server/path');
      $pssh->all(cmd => 'cd /server/path && make');
      $pssh->all(join => '*'); # waits for all the servers to reach this point.
      $pssh->all(cmd => 'cd /server/path && ./your_program');
      
      $pssh->run;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-10-16
        • 2016-02-24
        • 1970-01-01
        • 1970-01-01
        • 2015-05-01
        • 2014-11-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多