Coder Social home page Coder Social logo

automongobackup's People

Contributors

barchard avatar captainjackrana avatar contiero-roberto avatar cprato79 avatar david-harrison avatar dorogarcia avatar fluential avatar gurix avatar jalogisch avatar javiermon avatar kmullin avatar kwilczynski avatar micahwedemeyer avatar mriegler avatar phoolish avatar pirxpilot avatar sm11963 avatar tmtmtm avatar tomduckering avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automongobackup's Issues

Attempt to install mongodump if the executable is missing

mongodump executable may be missing and in order to improve the UX the script should attempt to install it using this logic

  • if dnf is present, try dnf install -y mongo-tools
  • if yum is present, try yum install -y mongo-tools
  • if apt-get is present, try apt-get install -y ???

Implementing this would avoid some confusions like the ones from #18

Nothing error where mongodb avent Replica node

+(automongobackup:454): select_secondary_member(): local __return=secondary
+(automongobackup:458): select_secondary_member(): members=($(mongo --quiet --host $DBHOST:$DBPORT --eval 'rs.conf().members.forEach(function(x){ print(x.host) })' $OPTSEC ))
++(automongobackup:458): select_secondary_member(): mongo --quiet --host 127.0.0.1:27017 --eval 'rs.conf().members.forEach(function(x){ print(x.host) })'
^C
root@mondogb:/var/backups/mongodb# mongo --quiet --host 127.0.0.1:27017 --eval 'rs.conf().members.forEach(function(x){ print(x.host) })'
2016-09-06T21:44:29.413+0200 TypeError: Cannot read property 'members' of null
root@mongodb:/var/backups/mongodb#

I havent any inforamtion about this error in logs.

error getting database names

I'm getting this error.

Failed: error getting database names: not authorized on admin to execute command { listDatabases: 1 }

Tried using users with "backup" role and "root" role. Logging in through the shell and doing "show dbs" works fine. Mongodb 3.2.

Secondary discover fail if authentication is enabled

Hi.

If you try to backup a replica set with authentication enabled and set primary as DBHOST, when the script executes line
members=( $(mongo --quiet --host $DBHOST:$DBPORT --eval 'rs.conf().members.forEach(function(x){ print(x.host) })') )
and line
is_secondary=$(mongo --quiet --host $member --eval 'rs.isMaster().secondary')
to discover a secondary, an authorization exception is raised. So, always the primary is chosen for the backup.

I resolved setting a new AUTH variable and putting it as parameter on previous commands. It works for me if, other than backup role, I assign clusterManager role to the user used to execute the dump. Compare the two files inside the zip attached to this issue to see my workaround.
By

Roberto

automongobackup.zip

How should I use this shell?

I just run ./automongobackup.sh then I got ERROR: mongodump failed to create dumpfile: /var/backups/mongodb/daily/2014-06-05_10h32m.Thursday

I don't know why failed, I have installed mongo and by root user.

Thanks for your time!

Permission denied

I am having this error when running the script.
./automongobackup.sh: line 332: /var/backups/mongodb/127.0.0.1-2102.log: Permission denied

OPLOG option doesnt work with DBNAME

Expected Behavior

If DBNAME option is used, OPLOG param should be ignored since mongodb doesn't allow oplog unless it is a full dump and throws error

Current Behavior

Error is not displayed while executing since it is running with --quiet option

Possible Solution

OPLOG param should be ignored if DBNAME param present

Steps to Reproduce (for bugs)

Context

Your Environment

  • Version used:
  • Server type and version:
  • Operating System and version:

Possibility of `POSTBACKUPERROR`? (Command to run if backup failed) Or way to achieve this behaviour?

Hello! Currently we can run a command when the backup finishes with the POSTBACKUP option. I'm wondering whether there's a way to run a command specifically when the backup fails, or if there's some way to detect if it failed from within the POSTBACKUP option?

My use case is: I have no idea how to set up mail on my server, and would like to use a simple nodejs script like this:

require('nodemailer').createTransport('smtps://blablablabh.com%40gmail.com:[email protected]').sendMail({to:'[email protected]', from:'automongobackup', subject:'automongobackup ERROR - check your logs!'});

I'm a bash noob, so if this is not something that's achievable, that's cool - I'll try wrangle together some workaround. Thanks!

Errors generated incorrectly when not in replica set

When this is a single 'master' server that is not in a replicaset and the config is set to:

# Choose other Server if is Replica-Set Master 
REPLICAONSLAVE="yes"

The following errors are generated:

exception: connect failed
exception: connect failed 
exception: connect failed
exception: connect failed
exception: HostAndPort: bad port #
exception: connect failed
exception: connect failed 
exception: connect failed
exception: connect failed
exception: connect failed
exception: connect failed

Please see my answer on ServerFault from 'Adam Knowles' at

http://serverfault.com/questions/353912/exceptions-from-automongobackup-yet-script-completes/373073#373073

Logfile deletion causes S3 uploads to crash

Hi, I love this script, and I'm using aws s3 --sync to upload $BACKUPDIR to s3, via the $POSTBACKUP hook. However, since the end of the script calls

rm -f "$LOGFILE" "$LOGERR"

The upload operation will fail partially through. This was surprisingly hard to debug (I thought files were missing due to cleanup or rotation). Anyway, having an option to disable the logfile purge, or wait until $POSTBACKUP finishes could be useful. (Which might be trick with aws s3's async behavior.)

In anycase, there might be someone else who finds this issue useful in the course of debugging. 🍏

how to reproduce this script for tenancy

i use this script in a rails application , but at this time the application is getting multitenant and i have to create folders for each tenant , i will trigger the script with a rake task with whenever gem ...
What is the query of mongodb that will take the datas in each model (with a tenant_id) and store it in a folder with the name or id of tenant ... at this time there is no need to store tenant model. Just for the models data belongs to tenants.

Your Environment

  • Version used:
  • Server type and version:
  • Operating System and version:

remove --quiet from mongodump

--quiet should be removed from mongodump. its not available in the actually version.

[root@vsm-prod backuptest]# mongodump --version
mongodump version 2.2.0

MAILCONTENT

Hello,

i set MAILCONTENT to quiet, but get emailed by cron anyway. when i look into the code, i just see some if queries regarding MAILCONTENT=log but nothing about stdout,files or quiet. Do i miss that part?

Running the bash script with does not start backups.

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

  • Version used:
  • Server type and version:
  • Operating System and version:

OS: Ubuntu 16.04
Mongo version 3.4

ISSUE:
Started running the bash script providing the hostname, port, user, password and auth database but it just creates an empty log file, empty folders in the location.
But it does not start any backup or doesn't write any logs can anyone please help me here.

problems with database authentication

I try to use this script to backup a specific database on mongohq with no sucess
I have set a user on the database i want to backup and it's running mongo 2.4.4.

I set up DBAUTHDB and then find that the problem was with option --authenticationDatabase, which just didn´t work as expected.

It however works fine if i replace --authenticationDatabase with --db

I don´t know if this is a issue with the script or with my configurations, since i don't see no reason why --authenticationDatabase doesn´t work for my case.

i edited the script to fit this problem, adding new field DBNAME and pass --db if field is set otherwise use --authenticationDatabase if DBAUTHDB is set.

if open to pull request just say something.
Nice script by the way ;)

hourly Backups do not work

I have problems with the hourly Backups.
I enabled oplog on mongod 3.2 standalone with the --master param on Ubuntu 14.04.
All other rotations are working: daily, week, ... but for hourly backups the script create no file. Also no error message. Any ideas?

DOHOURLY="yes"
HOURLYRETENTION=24

DODAILY="yes"
DAILYRETENTION=0

DOWEEKLY="yes"
WEEKLYDAY=6
WEEKLYRETENTION=4

DOMONTHLY="yes"
MONTHLYRETENTION=4

Confused On How to Schedule Hourly / Daily Backups Here

I configured this script to just do daily and hourly backups on a single instance of mongod w/o auth. Pretty simple. My question is when I enable both daily / hourly to "yes", how do I schedule this in cron.daily or crontab? Would I need to schedule this script every hour and if so, does that mean it will take a full backup (daily) every single hour I really just want an hourly backup? Confused on how the logic flows here. How do I get dailys at 1 AM and an hourly backup every hour? Are they just full hourly dumps?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.