问题
I am getting this error when try to insert 2M objects via node.js into Couchbase. 1M works fine.
C:\Users\Administrator\Desktop\node_modules\couchbase\lib\bucket.js: 728 throw new Error('cannot perform operations on a shutdown bucket');
I am using Couchbase 3.0.1, node.js 2.0.2 SDK.
This is the code:
var Couchbase = require('couchbase');
var myCluster = new Couchbase.Cluster('couchbase://10.0.0.103,10.0.0.102,10.0.0.101,');
var myBucket = myCluster.openBucket('rre');
for (var i = 0;i<1000000;i++)
{
myBucket.insert('dwhtryrdue_'+i, {
"guid": "003dddbf-da50-46d4-a2aa-319677b5d2be",
"CampaignID": 22,
"ZoneID": 29,
"AdvertiserID": 30,
"BannerID": 36,
"UserID": 32,
"ClickIP": "Bette",
"ClickHost": "Jerry",
"ClickReferringURL": "Dejesus",
"ClickDateTime": "2014-06-09T12:53:22 -00:00",
"ClickCountry": "Central African Republic",
"ClickState": "Kentucky",
"ClickBrowser": "Chrome"
}, function(err, res) {
});
}
回答1:
This error may also happen when there is a password set for the specified bucket.
To verify that open the Couchbase Console -> Navigate to the Data Buckets tab -> Drop-down your bucket -> Click the Edit button -> The third section in the popup dialog is Access Control, which has a password textbox.
Hope this helps,
György
回答2:
Resolved the issue by increasing the timeout: myBucket.operationTimeout = 120 * 1000;
回答3:
You need to check the compatibility between the couchbase server
version and the couchbase npm package
version.
On my machine:
- The couchbase server was
4.5.1-2844 Enterprise Edition (build-2844)
. - The couchbase npm package version was
4.6.2
.
My soluton was simply downgrading the couchbase npm package back to 2.5.1
with: npm i --save couchbase@2.5.1
.
Or you can upgrade the couchbase server version (haven't tested).
回答4:
I got the error in 2019, I resolved it by authenticating my cluster as now authorization should only be granted at cluster level but no need for bucket level authorization.
" cluster.authenticate('usernameForCluster', 'passwordForCluster'); "
来源:https://stackoverflow.com/questions/27610173/couchbase-cannot-perform-operations-on-a-shutdown-bucket