[英]Couchbase: Cannot perform operations on a shutdown bucket
I am getting this error when try to insert 2M objects via node.js into Couchbase.尝试通过 node.js 将 2M 对象插入 Couchbase 时出现此错误。 1M works fine. 1M 工作正常。
C:\\Users\\Administrator\\Desktop\\node_modules\\couchbase\\lib\\bucket.js: 728 throw new Error('cannot perform operations on a shutdown bucket'); 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.我正在使用 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) {
});
}
通过增加超时解决了这个问题:myBucket.operationTimeout = 120 * 1000;
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.验证打开 Couchbase 控制台 -> 导航到数据桶选项卡 -> 下拉您的存储桶 -> 单击编辑按钮 -> 弹出对话框中的第三部分是访问控制,它有一个密码文本框。
Hope this helps,希望这可以帮助,
György吉尔吉
You need to check the compatibility between the couchbase server
version and the couchbase npm package
version.您需要检查couchbase server
版本和couchbase npm package
版本之间的兼容性。
On my machine:在我的机器上:
4.5.1-2844 Enterprise Edition (build-2844)
. couchbase 服务器是4.5.1-2844 Enterprise Edition (build-2844)
。4.6.2
. couchbase npm 包版本是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
.我的解决方案只是将 couchbase npm 包降级回2.5.1
: npm i --save couchbase@2.5.1
。
Or you can upgrade the couchbase server version (haven't tested).或者您可以升级 couchbase 服务器版本(尚未测试)。
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.我在 2019 年遇到了错误,我通过对我的集群进行身份验证来解决它,因为现在应该只在集群级别授予授权,但不需要存储桶级别的授权。
" cluster.authenticate('usernameForCluster', 'passwordForCluster'); " " cluster.authenticate('usernameForCluster', 'passwordForCluster');"
You need to authenticate using USERNAME and PASSWORD, incase you setup a custom cluster.您需要使用 USERNAME 和 PASSWORD 进行身份验证,以防您设置自定义集群。 So, in the code ...所以,在代码中...
var myCluster = new Couchbase.Cluster('couchbase://10.0.0.103,10.0.0.102,10.0.0.101,');
myCluster.authenticate('Administrator', 'adminadmin'); // Add this credential
var myBucket = myCluster.openBucket('rre');
By default, the USERNAME is Administrator and PASSWORD will be the cluster password( adminadmin , in my case).默认情况下,用户名是管理员,密码是集群密码(在我的例子中是adminadmin )。
PS-This solution is in particular to Error: cannot perform operations on a shutdown bucket PS-此解决方案特别针对Error: cannot perform operations on a shutdown bucket
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.