Reputation: 51
I want to create a database with the replicas attach for failover:
I can at the moment only create the DB then detach and delete the forest, then in the next command create the forest replicas.
CREATE DB
curl -v -X POST --anyauth -u us:pw http://localhost:8002/v1/rest-apis \
--header "Content-Type:application/json" \
-d '{"rest-api": { "name": "testdb", "database": "testdb", "modules
database": "testdb-modules", "forests-per-host": 2 } }'
CREATE REPLICA
curl -s --anyauth --user us:pw -X POST -i -H 'Content-type: application/json' http://localhost:8002/manage/v2/forests -d '
{
"forest-name": "testdb-8",
"host": "ip-10-10-30-243.eu-west-1.compute.internal",
"database": "testdb",
"forest-replicas": {
"forest-replica":[
{ "replica-name": "testdb-8-Rep01", "host": "ip-10-10-31-238.eu-west-1.compute.internal" },
{ "replica-name": "testdb-8-Rep02", "host": "ip-10-10-32-253.eu-west-1.compute.internal" }
]
}
} '
Also is there a 'curl' to detach a forest from a database.
Many thanks
Upvotes: 1
Views: 168
Reputation: 51
THIS WORKS BETTER
curl --anyauth --user user:password -X POST -i \ -d "state=attach" -d "database=Documents" \ -H "Content-type: application/x-www-form-urlencoded" \ http://localhost:8002/manage/v2/forests/example
Upvotes: 0
Reputation: 51
Sorted: Thanks David.
Had to enabled = false then true
As seen in the link below:
curl --anyauth --user us:pw -X PUT -d @./forest-properties.xml \
-i -H "Content-type: application/xml" \
http://localhost:8002/manage/v2/forests/testdb/properties
The database this then detached from the forest and so you can now delete the forest.
curl -X DELETE --anyauth --user us:pw http://localhost:8002/manage/v2/forests/testdb?level=full
Upvotes: 1
Reputation: 7770
"is there a command to detach a forest form a database"
I think you probably get what you want from this REST endpoint:
The page is quite complete in explaining the items you can control.
Perhaps this pattern: get -> modify -> put
Upvotes: 1