在Elastic Beanstalk中安装/设置Mongos [英] Mongos Install/Setup in Elastic Beanstalk

查看:32
本文介绍了在Elastic Beanstalk中安装/设置Mongos的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在分片的过程中,我们希望能够有多个mongos实例.建议似乎是在每个应用程序服务器上放置mongos.我当时以为只是在他们自己的服务器上进行负载平衡,但是本文 http://craiggwilson.com/2013/10/21/load-balanced-mongos/表示存在此问题.

Looking down the road at sharding, we would like to be able to have multiple mongos instances. The recommendation seems to be to put mongos on each application server. I was thinking I'd just load balance them on their own servers, but this article http://craiggwilson.com/2013/10/21/load-balanced-mongos/ indicates that there are issue with this.

因此,我将其返回到应用程序服务器上.但是,我们正在使用Elastic Beanstalk.我可以以软件包安装的形式安装Mongo.但是,这给Mongos带来了一个问题.我还无法找出如何使用mongodb.conf文件使mongos启动.对于复制的服务器或配置服务器,conf文件中的其他条目可能会使它以我想要的方式启动.但是我对蒙哥斯无法做到这一点.如果我安装了Mongo,它实际上会以mongodb的形式启动.我需要终止这种行为,并使其以Mongos的身份启动,指向我的配置服务器.

So I'm back to having it on the application servers. However, we are using Elastic Beanstalk. I could install Mongo on this as a package install. But, this creates an issue with Mongos. I have not been able to find out how to get a mongos startup going using the mongodb.conf file. For replicated servers, or config servers, additional entries in the conf file can cause it to start up the way I want. But I can't do that with Mongos. If I install Mongo, it actually starts up as mongodb. I need to kill that behaviour, and get it to start as Mongos, pointed at my config servers.

我所能想到的是:

杀死mongodb启动脚本,该脚本以普通"模式自动启动数据库. 创建一个新的upstart脚本,启动mongos,指向配置服务器.

Kill the mongodb startup script, that autostarts the database in 'normal' mode. Create a new upstart script that starts up mongos, pointed at the config servers.

对此有何想法?还是有人知道我是否只是呆板,可以将一个新的mongodb.conf文件复制到beantalk上,该服务器将以mongos的身份启动服务器?

Any thoughts on this? Or does anyone know if I'm just being obtuse, and I can copy a new mongodb.conf file into place on beanstalk that will start up the server as mongos?

我们并没有计划立即进行此操作,但是我们需要做一些准备,好像我没有适当的准备,事后我需要完全重建我的beantalk服务器.我宁愿部署并安装所有软件.

We are not planning on doing this right off the bat, but we need to prepare somewhat, as if I don't have the pieces in place, I'll need to completely rebuild my beanstalk servers after the fact. I'd rather deploy ready to go, with all the software installed.

推荐答案

我创建了一个名为".ebextensions"的文件夹和一个名为"aws.config"的文件.该文件的内容如下:-

I created a folder called ".ebextensions" and a file called "aws.config". The contents of this file is as follows: -

files: 
  "/etc/yum.repos.d/mongodb.repo":
    mode: "000644"
    content: |
      [MongoDB]
      name=MongoDB Repository
      baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
      gpgcheck=0
      enabled=1
container_commands:
  01_enable_rootaccess:
    command: echo Defaults:root \!requiretty >> /etc/sudoers
  02_install_mongo:
    command: yum install -y mongo-10gen-server
    ignoreErrors: true
  03_turn_mongod_off:
    command: sudo chkconfig mongod off
  04_create_mongos_startup_script:
    command: sudo sh -c "echo '/usr/bin/mongos -configdb $MONGO_CONFIG_IPS -fork -logpath /var/log/mongo/mongos.log --logappend' > /etc/init.d/mongos.sh"
  05_update_mongos_startup_permissions:
    command: sudo chmod +x /etc/init.d/mongos.sh
  06_start_mongos:
    command: sudo bash /etc/init.d/mongos.sh

此文件的作用是:-

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆