protected override void BeginProcessing() { if (string.IsNullOrEmpty(Server)) { Server = ProviderUtil.GetLocalAddress(); } const string exceptionString = "Invalid context, to Add-Shard you must be in \n NoSDB:\\databasecluster\\Shards \n "; SessionState s1 = SessionState; string[] pathChunks = ProviderUtil.SplitPath(s1.Path.CurrentLocation.Path, s1.Drive.Current); if (!(s1.Drive.Current is NosDBPSDriveInfo)) { throw new Exception(exceptionString); } if (ConfigurationConnection.ConfigCluster == null) { throw new Exception(ProviderUtil.CONFIG_NOT_CONNECTED_EXCEPTION); } NodeDetail thisNode; new NoSDbDetail(pathChunks, s1.Drive.Current).TryGetNodeDetail(out thisNode); if (!thisNode.NodeType.Equals(PathType.Shards)) { throw new Exception(exceptionString); } }
protected override void BeginProcessing() { if (string.IsNullOrEmpty(Server)) { Server = ProviderUtil.GetLocalAddress(); } }
protected override void BeginProcessing() { if (string.IsNullOrEmpty(Server)) { Server = ProviderUtil.GetLocalAddress(); } var rcm = new RemoteConfigurationManager(); rcm.Initilize(StandAlone?MiscUtil.LOCAL:MiscUtil.CLUSTERED, Server, Port, new ConfigurationChannelFormatter(), new SSPIClientAuthenticationCredential()); if (!_standAlone) { if (rcm.VerifyConfigurationCluster()) { ConfigurationConnection.ConfigCluster = rcm.GetConfigurationClusterConfiguration(); ConfigurationConnection.ClusterConfiguration = rcm.GetDatabaseClusterConfig(true); ConfigurationConnection.Current = rcm; ConfigurationConnection.UpdateDatabaseClusterInfo(); } else { throw new Exception("Database cluster does not exist on the specified server."); } } else { var localConfig = rcm.GetDatabaseClusterConfig(false); if (localConfig != null) { var configCluster = new ConfigServerConfiguration { Name = MiscUtil.STAND_ALONE, Port = Port, Servers = new ServerNodes() }; configCluster.Servers.AddNode(new ServerNode { Name = Server, Priority = 1 }); ConfigurationConnection.ConfigCluster = configCluster; ConfigurationConnection.ClusterConfiguration = localConfig; ConfigurationConnection.Current = rcm; ConfigurationConnection.UpdateClusterConfiguration(); ConfigurationConnection.UpdateDatabaseClusterInfo(); } else { throw new Exception("Standalone database does not exist on the specified server."); } } }