小编Ela*_*ngo的帖子

MongoDB 3.0.1复制设置

我使用的是MongoDB 3.0.1版本.我正在尝试在我们的机器中设置mongodb replicaiton.我在隔膜机上使用了三个mongodb进行复制.

machine1 - master
machine2 - slave
machine3 - slave
Run Code Online (Sandbox Code Playgroud)

我推荐这个网址 http://docs.mongodb.org/manual/tutorial/deploy-replica-set/

我已经为mongodb.conf文件中的每台机器配置了

replSet = rs1
fork = true
Run Code Online (Sandbox Code Playgroud)

我使用此命令在主机中添加了两个成员

rs.add(192.168.1.2)
rs.add(192.168.1.3)
Run Code Online (Sandbox Code Playgroud)

但我在主机中插入一个文件,但没有复制其他两个从机.我检查奴隶机器抛出以下错误

> show dbs
2015-05-18T12:43:22.020+0530 E QUERY    Error: listDatabases failed:{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" }
    at Error (<anonymous>)
    at Mongo.getDBs (src/mongo/shell/mongo.js:47:15)
    at shellHelper.show (src/mongo/shell/utils.js:630:33)
    at shellHelper (src/mongo/shell/utils.js:524:36)
    at (shellhelp2):1:1 at src/mongo/shell/mongo.js:47
> 
> rs.conf()
2015-05-18T12:43:38.692+0530 E QUERY    Error: Could not retrieve replica set config: {
    "info" : "run rs.initiate(...) …
Run Code Online (Sandbox Code Playgroud)

mongodb

7
推荐指数
1
解决办法
1万
查看次数

Javascript JSON到Excel文件下载

我有Json数据,我需要使用javascript将json数据转换为Excel文件,

参考网址:http://jsfiddle.net/hybrid13i/JXrwM/

我正在使用此代码:

function JSONToTSVConvertor(JSONData, ReportTitle, ShowLabel, myTemplateName){

    //If JSONData is not an object then JSON.parse will parse the JSON string in an Object
    var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
    var TSV = '';    
    //Set Report title in first row or line
    //TSV += ReportTitle + '\r\n\n';
    //This condition will generate the Label/Header
    if (ShowLabel) {
        var row = "";
        //This loop will extract the label from 1st index of on array …
Run Code Online (Sandbox Code Playgroud)

javascript json

6
推荐指数
4
解决办法
3万
查看次数

MongoDB抛出删除消息"DELETED_BECAUSE_YOU_DIDNT_PASSWORD_PROTECT_YOUR_MONGODB"

我使用的是MongoDB 2.0.4版本,我在mongodb中登录shell命令工作正常.但现在mongodb会自动删除.我正在使用此命令

> mongo
MongoDB shell version: 2.0.4
connecting to: test
> show dbs
DELETED_BECAUSE_YOU_DIDNT_PASSWORD_PROTECT_YOUR_MONGODB 0.203125GB
admin   0.203125GB
local   (empty)
> 
Run Code Online (Sandbox Code Playgroud)

我不知道数据库是否删除,但显示数据库列表和大小.如何备份我的数据库请帮帮我.

mongodb

0
推荐指数
1
解决办法
551
查看次数

标签 统计

mongodb ×2

javascript ×1

json ×1