help!addshard not work with auth

103 views
Skip to first unread message

超 王

unread,
Apr 26, 2012, 7:26:59 AM4/26/12
to mongodb-user
i use replicaSet+mongos+configSvr. with option --keyFile; (every
server use the same keyfile)

it looks ok when i enter replica set or mongo server. see below....

mongos output:************************************
> use admin
switched to db admin
> db.auth('sa','sa');
1
mongos> use admin


replicaset outout:**************************************
> use admin
switched to db admin
> db.auth('sa','sa');
1
SECONDARY>
*******************************************************************************
MY PROBLEM::::
when i enter mongos and do addshard it tell me,so how can i
solve the problem. or it is a bug? :
--------------------------------------------------------------------------------------------------------------------------------
Array
(
[ok] => 0
[errmsg] => couldn't connect to new shard mongos connectionpool:
connect failed
set477985/58.215.164.196:16858,58.215.164.113:32948,58.215.176.110:18244 :
connect failed to set
set477985/58.215.164.196:16858,58.215.164.113:32948,58.215.176.110:18244
)
----------------------------------------------------------------------------------------------------------------------------------

thank you~

Eliot Horowitz

unread,
Apr 26, 2012, 8:06:22 AM4/26/12
to mongod...@googlegroups.com
Are you sure the mongos can talk to those machines?
Can you try connecting via the shell from the machine running mongos?
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

超 王

unread,
Apr 26, 2012, 10:27:15 AM4/26/12
to mongodb-user
mongos only can talk with config server.
i want mongos talk with replica set.so do you know how to do it?

Eliot Horowitz

unread,
Apr 26, 2012, 11:25:48 AM4/26/12
to mongod...@googlegroups.com
What I was asking if the machine that mongos is on can talk to the replica set.
It seems from the error message it cannot.

2012/4/26 超 王 <wangch...@gmail.com>:

超 王

unread,
Apr 26, 2012, 1:33:38 PM4/26/12
to mongodb-user

...without auth.they can talk....
On 4月26日, 下午11时25分, Eliot Horowitz <el...@10gen.com> wrote:
> What I was asking if the machine that mongos is on can talk to the replica set.
> It seems from the error message it cannot.
>
> 2012/4/26 超 王 <wangchao0...@gmail.com>:

Eliot Horowitz

unread,
Apr 26, 2012, 10:29:54 PM4/26/12
to mongod...@googlegroups.com
With auth - can you connect from the mongo shell running on the mongos
server to the replica set?

2012/4/26 超 王 <wangch...@gmail.com>:

超 王

unread,
Apr 26, 2012, 11:02:07 PM4/26/12
to mongodb-user
no i can't.
auth failed

On 4月27日, 上午10时29分, Eliot Horowitz <el...@10gen.com> wrote:
> With auth - can you connect from the mongo shell running on the mongos
> server to the replica set?
>
> 2012/4/26 超 王 <wangchao0...@gmail.com>:

Eliot Horowitz

unread,
Apr 26, 2012, 11:03:11 PM4/26/12
to mongod...@googlegroups.com
Can you send the console session from the shell talking to the replica set?

2012/4/26 超 王 <wangch...@gmail.com>:

超 王

unread,
Apr 26, 2012, 11:46:32 PM4/26/12
to mongodb-user
can you give me a sample to do this ? so i can find where i am
wrong ...
the below data is the session you meaning ? (from /home/data/logs/
null) :)


Fri Apr 27 11:34:30 [Balancer] warning: could not initialize balancer,
please check that all shards and config servers are up: can't
authenticate to shard server
Fri Apr 27 11:34:30 [Balancer] will retry to initialize balancer in
one minute
Fri Apr 27 11:35:26 [mongosMain] connection accepted from
127.0.0.1:52814 #3
Fri Apr 27 11:35:30 [Balancer] about to contact config servers and
shards
Fri Apr 27 11:35:30 [Balancer] warning: could not initialize balancer,
please check that all shards and config servers are up: can't
authenticate to shard server
Fri Apr 27 11:35:30 [Balancer] will retry to initialize balancer in
one minute
Fri Apr 27 11:35:33 [conn3] authenticate: { authenticate: 1.0, user:
"sa", nonce: "b8738649afb9c2c3", key:
"5bf3c64fe4eb911b38b587f52ca0fe23" }
Fri Apr 27 11:35:45 [conn3] authenticate: { authenticate: 1.0, user:
"lockmind", nonce: "c50a3eeb3452dc0f", key:
"b71a8c1970710ed995a5076bb9045558" }
Fri Apr 27 11:36:17 [conn3] authenticate: { authenticate: 1.0, user:
"sa", nonce: "57f1f8987148b3a6", key:
"8feb1d1e55e2a512e794a1257d452ead" }
Fri Apr 27 11:36:30 [Balancer] about to contact config servers and
shards
Fri Apr 27 11:36:30 [Balancer] warning: could not initialize balancer,
please check that all shards and config servers are up: can't
authenticate to shard server
Fri Apr 27 11:36:30 [Balancer] will retry to initialize balancer in
one minute
Fri Apr 27 11:36:53 [conn3] end connection 127.0.0.1:52814
Fri Apr 27 11:37:30 [Balancer] about to contact config servers and
shards
Fri Apr 27 11:37:30 [Balancer] warning: could not initialize balancer,
please check that all shards and config servers are up: can't
authenticate to shard server
Fri Apr 27 11:37:30 [Balancer] will retry to initialize balancer in
one minute
Fri Apr 27 11:38:30 [Balancer] about to contact config servers and
shards
Fri Apr 27 11:38:30 [Balancer] warning: could not initialize balancer,
please check that all shards and config servers are up: can't
authenticate to shard server
Fri Apr 27 11:38:30 [Balancer] will retry to initialize balancer in
one minute
Fri Apr 27 11:39:30 [Balancer] about to contact config servers and
shards
Fri Apr 27 11:39:30 [Balancer] warning: could not initialize balancer,
please check that all shards and config servers are up: can't
authenticate to shard server

On 4月27日, 上午11时03分, Eliot Horowitz <el...@10gen.com> wrote:
> Can you send the console session from the shell talking to the replica set?
>
> 2012/4/26 超 王 <wangchao0...@gmail.com>:

超 王

unread,
Apr 27, 2012, 12:02:19 AM4/27/12
to mongodb-user
ok i have find the problem。plz have a look here!

****************************************************************************************
mongos> use t
switched to db t
mongos> db.aaa.find();
error: { "$err" : "can't authenticate to shard server", "code" :
15847 }
mongos> db.aaa.find();
{ "_id" : ObjectId("4f9a1526a597181bc3c59427"), "aaa" : 1111 }

is this a bug of mongos ?

超 王

unread,
Apr 27, 2012, 3:52:48 AM4/27/12
to mongodb-user
there still have a problem . i can't connect to addshard until restart
mongo server.

Fri Apr 27 15:47:04 [conn3] single query: admin.$cmd { addShard:
"set319257/192.168.11.216:31443,192.168.10.218:25346,192.168.12.169:18829" }
ntoreturn: -1 options : 0
Fri Apr 27 15:47:04 [conn3] _check : set319257/
Fri Apr 27 15:47:06 [conn3] User Assertion: 10009:ReplicaSetMonitor no
master found for set: set319257
Fri Apr 27 15:47:06 [conn3] User Assertion: 13328:mongos
connectionpool: connect failed
set319257/192.168.11.216:31443,192.168.10.218:25346,192.168.12.169:18829 :
connect failed to set
set319257/192.168.11.216:31443,192.168.10.218:25346,192.168.12.169:18829
Fri Apr 27 15:47:06 [conn3] addshard request { addShard:
"set319257/192.168.11.216:31443,192.168.10.218:25346,192.168.12.169:18829" }
failed: couldn't connect to new shard mongos connectionpool: connect
failed
set319257/192.168.11.216:31443,192.168.10.218:25346,192.168.12.169:18829 :
connect failed to set
set319257/192.168.11.216:31443,192.168.10.218:25346,192.168.12.169:18829
Fri Apr 27 15:47:06 [conn3] Request::process ns: admin.$cmd msg id:7
attempt: 0
Fri Apr 27 15:47:06 [conn3] single query: admin.$cmd
{ replSetGetStatus: 1, forShell: 1 } ntoreturn: 1 options : 0
Fri Apr 27 15:47:14 [conn3] Socket recv() conn closed? 127.0.0.1:35519
Fri Apr 27 15:47:14 [conn3] SocketException: remote: 127.0.0.1:35519
error: 9001 socket exception [0] server [127.0.0.1:35519]
Fri Apr 27 15:47:14 [conn3] end connection 127.0.0.1:35519

超 王

unread,
Apr 27, 2012, 4:11:52 AM4/27/12
to mongodb-user
add some info :

if i restart mongos. addshard will be success.

Fri Apr 27 16:08:48 [conn1] ReplicaSetMonitor::_checkConnection:
192.168.12.169:15281 { setName: "set409395", ismaste
r: true, secondary: false, hosts: [ "192.168.12.169:15281",
"192.168.10.218:10851", "192.168.11.216:21097" ], primary
: "192.168.12.169:15281", me: "192.168.12.169:15281",
maxBsonObjectSize: 16777216, ok: 1.0 }
Fri Apr 27 16:08:48 [conn1] ReplicaSetMonitor::_checkConnection:
192.168.10.218:10851 { setName: "set409395", ismaste
r: false, secondary: true, hosts: [ "192.168.10.218:10851",
"192.168.12.169:15281", "192.168.11.216:21097" ], primary
: "192.168.12.169:15281", me: "192.168.10.218:10851",
maxBsonObjectSize: 16777216, ok: 1.0 }
Fri Apr 27 16:08:48 [conn1] _check :
set409395/192.168.10.218:10851,192.168.11.216:21097,192.168.12.169:15281
Fri Apr 27 16:08:48 [conn1] successfully connected to new host
192.168.12.169:15281 in replica set set409395
Fri Apr 27 16:08:48 BackgroundJob starting: ConnectBG
Fri Apr 27 16:08:48 [conn1] trying to add new host
192.168.12.169:15281 to replica set set409395
Fri Apr 27 16:08:48 [conn1] successfully connected to new host
192.168.11.216:21097 in replica set set409395
Fri Apr 27 16:08:48 BackgroundJob starting: ConnectBG
Fri Apr 27 16:08:48 [conn1] trying to add new host
192.168.11.216:21097 to replica set set409395
Fri Apr 27 16:08:48 [conn1] successfully connected to new host
192.168.10.218:10851 in replica set set409395
Fri Apr 27 16:08:48 BackgroundJob starting: ConnectBG
Fri Apr 27 16:08:48 [conn1] trying to add new host
192.168.10.218:10851 to replica set set409395
Fri Apr 27 16:08:48 [conn1] changing hosts to { 0:
"192.168.11.216:21097", 1: "192.168.12.169:15281", 2: "192.168.10.
218:10851" } from set409395/
Fri Apr 27 16:08:48 [conn1] ReplicaSetMonitor::_checkConnection:
192.168.11.216:21097 { setName: "set409395", ismaste
r: false, secondary: true, hosts: [ "192.168.11.216:21097",
"192.168.12.169:15281", "192.168.10.218:10851" ], primary
: "192.168.12.169:15281", me: "192.168.11.216:21097",
maxBsonObjectSize: 16777216, ok: 1.0 }
Fri Apr 27 16:08:48 [conn1] successfully connected to seed
192.168.11.216:21097 for replica set set409395
Fri Apr 27 16:08:48 BackgroundJob starting: ConnectBG
Fri Apr 27 16:08:48 [conn1] starting new replica set monitor for
replica set set409395 with seed of 192.168.11.216:21
097,192.168.10.218:10851,192.168.12.169:15281
Fri Apr 27 16:08:48 [conn1] single query: admin.$cmd { addShard:
"set409395/192.168.11.216:21097,192.168.10.218:1085
1,192.168.12.169:15281" } ntoreturn: -1 options : 0

超 王

unread,
Apr 29, 2012, 6:15:36 AM4/29/12
to mongodb-user
i found it is a bug in mongo 2.0 . at now time . i can simply restart
mongos to get it work. :)

On 4月27日, 上午11时03分, Eliot Horowitz <el...@10gen.com> wrote:
> Can you send the console session from the shell talking to the replica set?
>
> 2012/4/26 超 王 <wangchao0...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages