Monika Shah
2018-02-26 04:50:57 UTC
I am using mongoshard.bat file to start mongodb shard server. It was
working yesterday, but giving connection error for last few attempt
Getting connection error while executing following batch file.
Error message
============
"Error: couldn't connect to serve*r 127.0.0.1:37017
<http://127.0.0.1:37017>,* connection attempt failed :
c****@src/mongo/shell/mongo.js:251:13 @(connect):1:6* exception: connect
failed"
mongoshard.bat file
================
set mongo_home_path=C:/Program Files/MongoDB/Server/3.6.2/bin
set root_path=e:/mongodb
set data_path=d:/MongoDB/shard
echo Start 3 mongod for replicatSet #
start /b "s1-a" "%mongo_home_path%/mongod" --replSet s1 --logappend
--logpath "%data_path%/s1/a/s1_a.log" --dbpath "%data_path%/s1/a" --port
37017 --oplogSize 200 --shardsvr
start /b "s1-b" "%mongo_home_path%/mongod" --replSet s1 --logappend
--logpath "%data_path%/s1/b/s1_b.log" --dbpath "%data_path%/s1/b" --port
37018 --oplogSize 200 --shardsvr
start /b "s1-c" "%mongo_home_path%/mongod" --replSet s1 --logappend
--logpath "%data_path%/s1/c/s1_c.log" --dbpath "%data_path%/s1/c" --port
37019 --oplogSize 200 --shardsvr
timeout /t 5
echo Start 3 mongod for replicatSet #
start /b "s2-a" "%mongo_home_path%/mongod" --replSet s2 --logappend
--logpath "%data_path%/s2/a/s2_a.log" --dbpath "%data_path%/s2/a" --port
47017 --oplogSize 200 --shardsvr
start /b "s2-b" "%mongo_home_path%/mongod" --replSet s2 --logappend
--logpath "%data_path%/s2/b/s2_b.log" --dbpath "%data_path%/s2/b" --port
47018 --oplogSize 200 --shardsvr
start /b "s2-c" "%mongo_home_path%/mongod" --replSet s2 --logappend
--logpath "%data_path%/s2/c/s2_c.log" --dbpath "%data_path%/s2/c" --port
47019 --oplogSize 200 --shardsvr
timeout /t 5
echo Start 3 config servers
start /b "cfg-a" "%mongo_home_path%/mongod" --logappend --logpath
"%data_path%/cfg-a/cfg_a.log" --dbpath "%data_path%/cfg-a" --replSet conf
--port 57017 --configsvr
start /b "cfg-b" "%mongo_home_path%/mongod" --logappend --logpath
"%data_path%/cfg-b/cfg_b.log" --dbpath "%data_path%/cfg-b" --replSet conf
--port 57018 --configsvr
start /b "cfg-c" "%mongo_home_path%/mongod" --logappend --logpath
"%data_path%/cfg-c/cfg_c.log" --dbpath "%data_path%/cfg-c" --replSet conf
--port 57019 --configsvr
timeout /t 20
echo Configure shard #1
start /b "configure S1" "%mongo_home_path%/mongo" --port 37017
"%root_path%/configS1.js"
echo Configure shard #2
start /b "configure S2" "%mongo_home_path%/mongo" --port 47017
"%root_path%/configS2.js"
start /b "configure shard" "%mongo_home_path%/mongo" --port 57017
"%root_path%/configS.js"
start /b "mongos" "%mongo_home_path%/mongos" --port 61017 --logappend
--logpath "%data_path%/mongos.log" --configdb "conf/localhost:57017,
localhost:57018,localhost:57019"
start /b "configure shard" "%mongo_home_path%/mongo" --shell --port 61017
"%root_path%/configShard_alt.js"
===================================================================
Where, configS1.js contains
===========================
configS1 = {
"_id" : "s1",
"members" : [
{
"_id" : 1,
"host" : "localhost:37017"
},
{
"_id" : 2,
"host" : "localhost:37018"
},
{
"_id" : 3,
"host" : "localhost:37019"
}
]
};
rs.initiate(configS1);
===========================
configS.js
======================
rs.initiate(
{
_id: "conf",
configsvr: true,
members: [
{ _id : 0, host : "localhost:57017" },
{ _id : 1, host : "localhost:57018" },
{ _id : 2, host : "localhost:57019" }
]
}
)
==================================
--
Monika Shah
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOYegx7NUQHTO9KKK9%3DwUA0UqhvK7Qz%3DfxHqMsbZP4RP3aoUWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
working yesterday, but giving connection error for last few attempt
Getting connection error while executing following batch file.
Error message
============
"Error: couldn't connect to serve*r 127.0.0.1:37017
<http://127.0.0.1:37017>,* connection attempt failed :
c****@src/mongo/shell/mongo.js:251:13 @(connect):1:6* exception: connect
failed"
mongoshard.bat file
================
set mongo_home_path=C:/Program Files/MongoDB/Server/3.6.2/bin
set root_path=e:/mongodb
set data_path=d:/MongoDB/shard
echo Start 3 mongod for replicatSet #
start /b "s1-a" "%mongo_home_path%/mongod" --replSet s1 --logappend
--logpath "%data_path%/s1/a/s1_a.log" --dbpath "%data_path%/s1/a" --port
37017 --oplogSize 200 --shardsvr
start /b "s1-b" "%mongo_home_path%/mongod" --replSet s1 --logappend
--logpath "%data_path%/s1/b/s1_b.log" --dbpath "%data_path%/s1/b" --port
37018 --oplogSize 200 --shardsvr
start /b "s1-c" "%mongo_home_path%/mongod" --replSet s1 --logappend
--logpath "%data_path%/s1/c/s1_c.log" --dbpath "%data_path%/s1/c" --port
37019 --oplogSize 200 --shardsvr
timeout /t 5
echo Start 3 mongod for replicatSet #
start /b "s2-a" "%mongo_home_path%/mongod" --replSet s2 --logappend
--logpath "%data_path%/s2/a/s2_a.log" --dbpath "%data_path%/s2/a" --port
47017 --oplogSize 200 --shardsvr
start /b "s2-b" "%mongo_home_path%/mongod" --replSet s2 --logappend
--logpath "%data_path%/s2/b/s2_b.log" --dbpath "%data_path%/s2/b" --port
47018 --oplogSize 200 --shardsvr
start /b "s2-c" "%mongo_home_path%/mongod" --replSet s2 --logappend
--logpath "%data_path%/s2/c/s2_c.log" --dbpath "%data_path%/s2/c" --port
47019 --oplogSize 200 --shardsvr
timeout /t 5
echo Start 3 config servers
start /b "cfg-a" "%mongo_home_path%/mongod" --logappend --logpath
"%data_path%/cfg-a/cfg_a.log" --dbpath "%data_path%/cfg-a" --replSet conf
--port 57017 --configsvr
start /b "cfg-b" "%mongo_home_path%/mongod" --logappend --logpath
"%data_path%/cfg-b/cfg_b.log" --dbpath "%data_path%/cfg-b" --replSet conf
--port 57018 --configsvr
start /b "cfg-c" "%mongo_home_path%/mongod" --logappend --logpath
"%data_path%/cfg-c/cfg_c.log" --dbpath "%data_path%/cfg-c" --replSet conf
--port 57019 --configsvr
timeout /t 20
echo Configure shard #1
start /b "configure S1" "%mongo_home_path%/mongo" --port 37017
"%root_path%/configS1.js"
echo Configure shard #2
start /b "configure S2" "%mongo_home_path%/mongo" --port 47017
"%root_path%/configS2.js"
start /b "configure shard" "%mongo_home_path%/mongo" --port 57017
"%root_path%/configS.js"
start /b "mongos" "%mongo_home_path%/mongos" --port 61017 --logappend
--logpath "%data_path%/mongos.log" --configdb "conf/localhost:57017,
localhost:57018,localhost:57019"
start /b "configure shard" "%mongo_home_path%/mongo" --shell --port 61017
"%root_path%/configShard_alt.js"
===================================================================
Where, configS1.js contains
===========================
configS1 = {
"_id" : "s1",
"members" : [
{
"_id" : 1,
"host" : "localhost:37017"
},
{
"_id" : 2,
"host" : "localhost:37018"
},
{
"_id" : 3,
"host" : "localhost:37019"
}
]
};
rs.initiate(configS1);
===========================
configS.js
======================
rs.initiate(
{
_id: "conf",
configsvr: true,
members: [
{ _id : 0, host : "localhost:57017" },
{ _id : 1, host : "localhost:57018" },
{ _id : 2, host : "localhost:57019" }
]
}
)
==================================
--
Monika Shah
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOYegx7NUQHTO9KKK9%3DwUA0UqhvK7Qz%3DfxHqMsbZP4RP3aoUWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.