Пример #1
0
        public HttpResponseMessage InitializeNewCluster()
        {
            var oldClusterManager = SetClusterManagerToNullAndGetOldValue();

            oldClusterManager?.Dispose();

            var newClusterManager = ClusterManagerFactory.Create(SystemDatabase, DatabasesLandlord, nullifyLastAppliedIndex: true);

            newClusterManager.InitializeTopology(isPartOfExistingCluster: true);

            ((Reference <ClusterManager>)Configuration.Properties[typeof(ClusterManager)]).Value = newClusterManager;
            return(GetEmptyMessage(HttpStatusCode.NoContent));
        }
Пример #2
0
        public HttpResponseMessage RemoveClustering()
        {
            if (ClusterManager.Engine.CurrentTopology.AllNodes.Count() > 1)
            {
                return(GetMessageWithString("Remove clustering is available on single node clusters only.", HttpStatusCode.BadRequest));
            }

            // delete Raft persistent storage and init new one
            ClusterManager.CleanupAllClusteringData(SystemDatabase);

            var newClusterManager = ClusterManagerFactory.Create(SystemDatabase, DatabasesLandlord);

            ((Reference <ClusterManager>)Configuration.Properties[typeof(ClusterManager)]).Value = newClusterManager;

            return(GetEmptyMessage(HttpStatusCode.NoContent));
        }
        public HttpResponseMessage InitializeNewCluster(string id)
        {
            var oldClusterManager = SetClusterManagerToNullAndGetOldValue();

            if (id != null)
            {
                oldClusterManager.CleanupAllClusteringData(SystemDatabase);
            }
            oldClusterManager?.Dispose();

            var newClusterManager = ClusterManagerFactory.Create(SystemDatabase, DatabasesLandlord);

            if (string.IsNullOrEmpty(id))
            {
                newClusterManager.InitializeTopology(isPartOfExistingCluster: true);
            }
            else
            {
                newClusterManager.InitializeEmptyTopologyWithId(Guid.Parse(id));
            }

            ((Reference <ClusterManager>)Configuration.Properties[typeof(ClusterManager)]).Value = newClusterManager;
            return(GetEmptyMessage(HttpStatusCode.NoContent));
        }