【问题标题】:SOLR on Elastic Beanstalk弹性豆茎上的 SOLR
【发布时间】:2013-05-25 23:33:40
【问题描述】:

我想在 Elastic Beanstalk 上运行 SOLR 服务器。但我在网络上找不到那么多。

一定有可能,因为有些人已经在使用它了。 (https://forums.aws.amazon.com/thread.jspa?threadID=91276 即)

我有什么想法可以做到这一点吗?

好吧,我可以通过某种方式将 solr warfile 上传到环境中,但是它变得复杂了。 配置文件和索引目录放在哪里,让每个实例都能访问到?

【问题讨论】:

    标签: solr amazon-elastic-beanstalk


    【解决方案1】:

    编辑:请记住,这个答案来自 2013 年。这里提到的产品可能已经进化了。我更新了文档链接以反映 solr clustering wiki 中的更改。我鼓励您在阅读此信息后继续您的研究。

    原件: 如果您打算只使用单服务器部署,那么在 beanstalk 实例上运行 solr 才真正有意义。在您想要扩展您的应用程序的那一刻,您需要配置您的 beanstalk 环境以创建 solr cluster 或迁移到 CloudSearch 之类的东西。如果您不熟悉 ec2 生命周期和 solr 部署,那么 CloudSearch 几乎肯定会为您节省时间(阅读成本)。

    如果您确实想在单个实例上运行 solr,那么您可以使用 rake 通过将文件添加到名为 .ebextensions/solr.config 的本地 repo 并包含以下内容来启动它:

    container_commands:
      01create_post_dir:
        command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
        ignoreErrors: true
      02killjava:
        command: "killall java"
        test: "ps uax | grep java | grep root"
        ignoreErrors: true
    
    files:
      "/opt/elasticbeanstalk/hooks/appdeploy/post/99_start_solr.sh":
        mode: "755"
        owner: "root"
        group: "root"
        content: |
            #!/usr/bin/env bash
            . /opt/elasticbeanstalk/support/envvars
            cd $EB_CONFIG_APP_CURRENT
            su -c "RAILS_ENV=production bundle exec rake sunspot:solr:start" $EB_CONFIG_APP_USER
            su -c "RAILS_ENV=production bundle exec rake db:seed" $EB_CONFIG_APP_USER
            su -c "RAILS_ENV=production bundle exec rake sunspot:reindex" $EB_CONFIG_APP_USER
    

    请记住,如果您使用自动缩放,这会导致混乱

    【讨论】:

      猜你喜欢
      • 2016-01-13
      • 2015-04-02
      • 2019-04-21
      • 2015-03-20
      • 2014-12-22
      • 2021-05-15
      • 2016-01-04
      • 1970-01-01
      • 2018-02-25
      相关资源
      最近更新 更多