---
title: "mongodb 简单的备份"
author: "cocos"
date: "2011-07-28T18:30:30Z"
tags: []
categories: ["开源软件"]
slug: "mongodb"
draft: false
lastmod: "2011-07-28T18:30:49Z"
id: 1135087
url: "https://cocos.iteye.com/blog/1135087"
---

#!/bin/sh  
binpath="/usr/local/mongodb/bin"  
backpath="/data1/mongodbgwy/back"  
port=29017  
$binpath/mongodump  --port $port -o  $backpath/mongodb\_\`date +%Y%m%d\`  
find $backpath/* -type d  -prune -mtime 30  -name mongodb*  -exec rm -rf {} \\;