Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable the Couchbase Bucket Access Scanner to avoid micro outages
#!/bin/bash
#
# Disables the Couchbase access scanner on a list of buckets
# Access scanner can cause short outages when buckets are very large.
#
set -e -x
USER='Administrator'
PASS='<yourpassword>'
HOST=127.0.0.1
CB_URL="http://${HOST}:8091/diag/eval"
# Applies the access scanner setting to the running couchbase instance
disable_access_scanner() {
local bucket="$1"
if [ -x /opt/couchbase/bin/cbepctl ]; then
/opt/couchbase/bin/cbepctl "${HOST}:11210" -b "$bucket" -p "<password>" set flush_param access_scanner_enabled false
else
echo "Can't find the cbepctl command where it should be. Is this a couchbase node?"
exit 1
fi
}
# Persists the access scanner setting after a restart or reboot
# Does *not* apply the setting in the currently running instance.
disable_access_scanner_permanently() {
local bucket="$1"
local cb_cmd="ns_bucket:update_bucket_props(\"$bucket\", [{extra_config_string, \"access_scanner_enabled=false\"}])."
curl -s -XPOST -u "$USER:$PASS" "$CB_URL" -d "$cb_cmd"
echo
}
get_bucket_config() {
local bucket="$1"
curl -u "$USER:$PASS" "$CB_URL" -d 'ns_config:get().' -s # | grep "extra_config_string"
}
#get_bucket_config $bucket
for bucket in bucket1 bucket2 bucket3 ; do
disable_access_scanner $bucket
#disable_access_scanner_permanently $bucket
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment