guardian / machine-images

DEPRECATED: Scripts for building machine images (principally AMIs)
34 stars 7 forks source link

Add script for installing standalone MongoDB binaries #85

Closed niklasvincent closed 8 years ago

niklasvincent commented 8 years ago

We've noticed during our disaster recovery simulations that a step that is stealing precious time getting back up and running is to get the MongoDB binaries in order to reset the OpLog and setting up the cluster again.

The way we've set up the fully Ops Manager orchestrated instances is that they download their binaries from Ops Manager, so by default there are no binaries available on the machine when they have just booted up.

This PR adds a small script /opt/features/mongo24/scripts/install-binaries-only.sh that downloads and unpacks the binaries for a specific MongoDB release.

Future usage might be to add the version(s) of MongoDB we know we need to the AMI so that they are readily available during a recovery situation.

# /opt/features/mongo24/scripts/install-binaries-only.sh -v 2.4.15
URL does not exist: http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.4.15.tgz

# /opt/features/mongo24/scripts/install-binaries-only.sh -v 2.4.14
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 90.9M  100 90.9M    0     0  45.8M      0  0:00:01  0:00:01 --:--:-- 45.8M

# ls -al /opt/mongodb
total 12
drwxr-xr-x 3 root root 4096 Feb  8 11:46 .
drwxr-xr-x 6 root root 4096 Feb  8 11:46 ..
drwxr-xr-x 3 root root 4096 Feb  8 11:46 2.4.14

 # ls -al /opt/mongodb/2.4.14/bin
 total 238104
 drwxr-xr-x 2 root root     4096 Feb  8 11:46 .
 drwxr-xr-x 3 root root     4096 Feb  8 11:46 ..
 -rwxr-xr-x 1  500  500 18336048 Apr 27  2015 bsondump
 -rwxr-xr-x 1  500  500  9556936 Apr 27  2015 mongo
 -rwxr-xr-x 1  500  500 18395656 Apr 27  2015 mongod
 -rwxr-xr-x 1  500  500 18393456 Apr 27  2015 mongodump
 -rwxr-xr-x 1  500  500 18348368 Apr 27  2015 mongoexport
 -rwxr-xr-x 1  500  500 18397504 Apr 27  2015 mongofiles
 -rwxr-xr-x 1  500  500 18360624 Apr 27  2015 mongoimport
 -rwxr-xr-x 1  500  500 18340112 Apr 27  2015 mongooplog
 -rwxr-xr-x 1  500  500 18340112 Apr 27  2015 mongoperf
 -rwxr-xr-x 1  500  500 18398320 Apr 27  2015 mongorestore
 -rwxr-xr-x 1  500  500 13888984 Apr 27  2015 mongos
 -rwxr-xr-x 1  500  500 18303144 Apr 27  2015 mongosniff
 -rwxr-xr-x 1  500  500 18385552 Apr 27  2015 mongostat
 -rwxr-xr-x 1  500  500 18340112 Apr 27  2015 mongotop
philmcmahon commented 8 years ago

:+1:

philmcmahon commented 8 years ago

Re prebaking the binaries into the ami - they are around 90MB, that could add a non negligible amount of time to the packer build time, and maybe have an impact on the amount of time it takes to start up an instance from the ami, I'm not sure. Maybe a better solution would be to put them in an S3 bucket somewhere? That would be faster than downloading them from mongo each time.

niklasvincent commented 8 years ago

@philmcmahon I've changed the the script to try a public S3 bucket first and then use the official internet mirror if it can't find the version in the bucket.

philmcmahon commented 8 years ago

:+1: