Exemple #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;
 }
        /// <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);
        }
 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;
 }
Exemple #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);
        }
 /// <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;
 }
Exemple #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);
        }