Пример #1
0
        /// <summary>
        ///     增加分片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdAddSharding_Click(object sender, EventArgs e)
        {
            var lstAddress = new List <string>();

            foreach (string item in lstHost.Items)
            {
                lstAddress.Add(item.Trim());
            }
            var           resultlst = new List <CommandResult>();
            CommandResult result;

            if (chkAdvance.Checked)
            {
                result = CommandHelper.AddSharding(_prmSvr, txtReplsetName.Text, lstAddress, txtName.Text,
                                                   NumMaxSize.Value);
            }
            else
            {
                result = CommandHelper.AddSharding(_prmSvr, txtReplsetName.Text, lstAddress, string.Empty, 0);
            }
            resultlst.Add(result);
            MyMessageBox.ShowMessage("Add Sharding", "Result:" + (result.Ok ? "OK" : "Fail"),
                                     MongoHelper.ConvertCommandResultlstToString(resultlst));
            lstSharding.Items.Clear();
            foreach (var lst in Operater.GetShardInfo(_prmSvr, "_id"))
            {
                lstSharding.Items.Add(lst.Value);
            }
            lstHost.Items.Clear();
        }