Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deleting replicas by default on undeploy #167

Closed
rjrudin opened this issue Mar 8, 2017 · 3 comments
Closed

Support deleting replicas by default on undeploy #167

rjrudin opened this issue Mar 8, 2017 · 3 comments
Milestone

Comments

@rjrudin
Copy link
Contributor

rjrudin commented Mar 8, 2017

This will happen if replicas were created via ConfigureForestReplicasCommand, but won't happen if they were configured any other way, such as via the custom forest support.

@rjrudin
Copy link
Contributor Author

rjrudin commented Mar 8, 2017

Basic code for doing this (in ml-app-deployer):

DatabaseManager mgr = new DatabaseManager(client);
List forestNames = mgr.getForestNames("failover-example-content");
ForestManager forestManager = new ForestManager(client);
for (String name : forestNames) {
if (forestManager.forestExists(name)) {
ForestStatus status = forestManager.getForestStatus(name);
if (status.isPrimary() && status.hasReplicas()) {
System.out.println("Delete: " + name);
forestManager.deleteReplicas(name);
}
}
}

@rjrudin
Copy link
Contributor Author

rjrudin commented Mar 8, 2017

And a Gradle task as an immediate hack if needed:

task deleteReplicas(type: com.marklogic.gradle.task.MarkLogicTask) {
doLast {
def forestManager = new com.marklogic.mgmt.forests.ForestManager(getManageClient());
for (String name : new com.marklogic.mgmt.databases.DatabaseManager(getManageClient()).getForestNames(mlAppConfig.getContentDatabaseName())) {
if (forestManager.forestExists(name)) {
def status = forestManager.getForestStatus(name);
if (status.isPrimary() && status.hasReplicas()) {
forestManager.deleteReplicas(name);
}
}
}
}
}

mlUndeploy.dependsOn deleteReplicas

@rjrudin rjrudin added this to the 2.6.0 milestone Mar 12, 2017
@rjrudin
Copy link
Contributor Author

rjrudin commented Mar 13, 2017

This is resolved via marklogic/ml-app-deployer#140

@rjrudin rjrudin closed this as completed Mar 13, 2017
rjrudin added a commit that referenced this issue Aug 23, 2024
…emas

DEVEXP-150: No error thrown when no schemas to load and invalid client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant