Cameron Scrace
Cameron Scrace

Reputation: 13

Couchbase compaction settings via API

I'm trying to change Couchbase Servers compaction settings via the API. Specifically I want to set the time window that compactions can run. Doing this via the web console is trivial but I need to do it via a script and I can't figure out the syntax. I can change other values like the purge interval:

curl -u <adminuser>:<password> -d 'parallelDBAndViewCompaction=false&purgeInterval=3' <IP>:8091/controller/setAutoCompaction

But the values for allowedTimePeriod just get ignored. Has anyone been able to get this to work?

EDIT

Got it working, thanks!

You have to give all five values and the parallelDBandView value:

curl -u admin:password -d 'parallelDBAndViewCompaction=false&allowedTimePeriod[fromHour]=0&allowedTimePeriod[fromMinute]=0&allowedTimePeriod[toHour]=2&allowedTimePeriod[toMinute]=0&allowedTimePeriod[abortOutside]=false' ip:8091/controller/setAutoCompaction

Upvotes: 1

Views: 53

Answers (1)

DaveR
DaveR

Reputation: 9640

I checked the Compaction API documentation but the syntax looks out of date - from the source I can see that the four parameters you need are:

allowedTimePeriod[fromHour]
allowedTimePeriod[fromMinute]
allowedTimePeriod[toHour]
allowedTimePeriod[toMinute]

Upvotes: 1

Related Questions