예제 #1
0
 /// <summary>
 ///     获得备份的配置
 /// </summary>
 /// <param name="mongoDump"></param>
 /// <returns></returns>
 public static string GetMongodumpCommandLine(MongoDumpInfo mongoDump)
 {
     //mongodump.exe 备份程序
     var dosCommand = @"mongodump -h @hostaddr:@port -d @dbname";
     dosCommand = dosCommand.Replace("@hostaddr", mongoDump.HostAddr);
     dosCommand = dosCommand.Replace("@port", mongoDump.Port.ToString());
     dosCommand = dosCommand.Replace("@dbname", mongoDump.DbName);
     if (mongoDump.CollectionName != string.Empty)
     {
         //-c CollectionName Or --collection CollectionName
         dosCommand += " --collection " + mongoDump.CollectionName;
     }
     if (mongoDump.OutPutPath != string.Empty)
     {
         //3.0.0 RC10 不允许带有空格的路径了?
         //dosCommand += " --out \"" + mongoDump.OutPutPath + "\"";
         dosCommand += " --out " + mongoDump.OutPutPath;
     }
     if (mongoDump.IsGZip)
     {
         //Since 3.2.0
         dosCommand += " --gzip";
     }
     if (mongoDump.IsArchive)
     {
         //Since 3.2.0
         dosCommand += " --archive";
         if (!string.IsNullOrEmpty(mongoDump.ArchiveFilename))
         {
             dosCommand += "=" + mongoDump.ArchiveFilename;
         }
     }
     return dosCommand;
 }
예제 #2
0
        /// <summary>
        ///     获得备份的配置
        /// </summary>
        /// <param name="mongoDump"></param>
        /// <returns></returns>
        public static string GetMongodumpCommandLine(MongoDumpInfo mongoDump)
        {
            //mongodump.exe 备份程序
            var dosCommand = @"mongodump -h @hostaddr:@port -d @dbname";

            dosCommand = dosCommand.Replace("@hostaddr", mongoDump.HostAddr);
            dosCommand = dosCommand.Replace("@port", mongoDump.Port.ToString());
            dosCommand = dosCommand.Replace("@dbname", mongoDump.DbName);
            if (mongoDump.CollectionName != string.Empty)
            {
                //-c CollectionName Or --collection CollectionName
                dosCommand += " --collection " + mongoDump.CollectionName;
            }
            if (mongoDump.OutPutPath != string.Empty)
            {
                //3.0.0 RC10 不允许带有空格的路径了?
                //dosCommand += " --out \"" + mongoDump.OutPutPath + "\"";
                dosCommand += " --out " + mongoDump.OutPutPath;
            }
            if (mongoDump.IsGZip)
            {
                //Since 3.2.0
                dosCommand += " --gzip";
            }
            if (mongoDump.IsArchive)
            {
                //Since 3.2.0
                dosCommand += " --archive";
                if (!string.IsNullOrEmpty(mongoDump.ArchiveFilename))
                {
                    dosCommand += "=" + mongoDump.ArchiveFilename;
                }
            }
            return(dosCommand);
        }
예제 #3
0
 public static MongoDumpInfo GetMongoDump(bool isDb)
 {
     var mongoDump = new MongoDumpInfo();
     var mongosrv = RuntimeMongoDbContext.GetCurrentServer().Instance;
     mongoDump.HostAddr = mongosrv.Address.Host;
     mongoDump.Port = mongosrv.Address.Port;
     mongoDump.DbName = RuntimeMongoDbContext.GetCurrentDataBaseName();
     if (!isDb) mongoDump.CollectionName = RuntimeMongoDbContext.GetCurrentCollectionName();
     return mongoDump;
 }
예제 #4
0
        public static MongoDumpInfo GetMongoDump(bool isDb)
        {
            var mongoDump = new MongoDumpInfo();
            var mongosrv  = RuntimeMongoDbContext.GetCurrentServer().Instance;

            mongoDump.HostAddr = mongosrv.Address.Host;
            mongoDump.Port     = mongosrv.Address.Port;
            mongoDump.DbName   = RuntimeMongoDbContext.GetCurrentDataBaseName();
            if (!isDb)
            {
                mongoDump.CollectionName = RuntimeMongoDbContext.GetCurrentCollectionName();
            }
            return(mongoDump);
        }
예제 #5
0
 /// <summary>
 ///     获得备份的配置
 /// </summary>
 /// <param name="mongoDump"></param>
 /// <returns></returns>
 public static string GetMongodumpCommandLine(MongoDumpInfo mongoDump)
 {
     //mongodump.exe 备份程序
     var dosCommand = @"mongodump -h @hostaddr:@port -d @dbname";
     dosCommand = dosCommand.Replace("@hostaddr", mongoDump.HostAddr);
     dosCommand = dosCommand.Replace("@port", mongoDump.Port.ToString());
     dosCommand = dosCommand.Replace("@dbname", mongoDump.DbName);
     if (mongoDump.CollectionName != string.Empty)
     {
         //-c CollectionName Or --collection CollectionName
         dosCommand += " --collection " + mongoDump.CollectionName;
     }
     if (mongoDump.OutPutPath != string.Empty)
     {
         //3.0.0 RC10 不允许带有空格的路径了?
         //dosCommand += " --out \"" + mongoDump.OutPutPath + "\"";
         dosCommand += " --out " + mongoDump.OutPutPath;
     }
     return dosCommand;
 }
예제 #6
0
        /// <summary>
        ///     获得备份的配置
        /// </summary>
        /// <param name="mongoDump"></param>
        /// <returns></returns>
        public static string GetMongodumpCommandLine(MongoDumpInfo mongoDump)
        {
            //mongodump.exe 备份程序
            var dosCommand = @"mongodump -h @hostaddr:@port -d @dbname";

            dosCommand = dosCommand.Replace("@hostaddr", mongoDump.HostAddr);
            dosCommand = dosCommand.Replace("@port", mongoDump.Port.ToString());
            dosCommand = dosCommand.Replace("@dbname", mongoDump.DbName);
            if (mongoDump.CollectionName != string.Empty)
            {
                //-c CollectionName Or --collection CollectionName
                dosCommand += " --collection " + mongoDump.CollectionName;
            }
            if (mongoDump.OutPutPath != string.Empty)
            {
                //3.0.0 RC10 不允许带有空格的路径了?
                //dosCommand += " --out \"" + mongoDump.OutPutPath + "\"";
                dosCommand += " --out " + mongoDump.OutPutPath;
            }
            return(dosCommand);
        }