Exemplo n.º 1
0
 public static void StartShard(ManagementInfo managementInfo)
 {
     try
     {
         RemoteConfigurationManager remoteConfigurationManager = InitializeRemoteConfigurationManager(managementInfo);
         remoteConfigurationManager.StartShard(managementInfo.ShardName);
     }
     catch (ManagementException)
     {
         throw;
     }
     catch (Exception exception)
     {
         throw new ManagementException(exception.Message, exception);
     }
 }
Exemplo n.º 2
0
 public static void MoveCollection(ManagementInfo managementInfo)
 {
     try
     {
         RemoteConfigurationManager remoteConfigurationManager = InitializeRemoteConfigurationManager(managementInfo);
         remoteConfigurationManager.MoveCollection(true, managementInfo.DatabaseName,
                                                   managementInfo.CollectionName, managementInfo.ShardName);
     }
     catch (ManagementException)
     {
         throw;
     }
     catch (Exception exception)
     {
         throw new ManagementException(exception.Message, exception);
     }
 }
Exemplo n.º 3
0
        public static void StopNode(ManagementInfo managementInfo)
        {
            try
            {
                RemoteConfigurationManager remoteConfigurationManager = InitializeRemoteConfigurationManager(managementInfo);

                var serverNode = new ServerNode {
                    Name = managementInfo.ServerName
                };

                remoteConfigurationManager.StopNode(managementInfo.ShardName, serverNode);
            }
            catch (ManagementException)
            {
                throw;
            }
            catch (Exception exception)
            {
                throw new ManagementException(exception.Message, exception);
            }
        }
Exemplo n.º 4
0
        private static RemoteConfigurationManager InitializeRemoteConfigurationManager(ManagementInfo managementInfo)
        {
            if (managementInfo.ConfigServerIp == null)
            {
                managementInfo.ConfigServerIp = NetworkUtil.GetLocalIPAddress().ToString();
            }

            if (managementInfo.ConfigServerPort == 0)
            {
                managementInfo.ConfigServerPort = NetworkUtil.DEFAULT_CS_HOST_PORT;
            }

            IClientAuthenticationCredential clientAuthenticationCredential = new SSPIClientAuthenticationCredential();

            var remoteConfigurationManager = new RemoteConfigurationManager();

            remoteConfigurationManager.Initilize(MiscUtil.CLUSTERED, managementInfo.ConfigServerIp, managementInfo.ConfigServerPort, new ConfigurationChannelFormatter(), clientAuthenticationCredential);

            return(remoteConfigurationManager);
        }