报错内容
看报错日志应该是你配置的副本集名称与实际的不匹配
使用的是单机版的
方便贴一下你的配置吗?
你的 MongoDB 是不是部署的是副本集模式?
很奇怪,看报错应该是副本集名称不匹配来着。
是否方便贴一下完整点的日志?我帮你反馈给研发同事。
47, mfa: emqx_plugin_libs_pool:start_pool/3, msg: start_ecpool_error, pool_name: ‘emqx_authn_mongodb:4:5’, reason: {{shutdown,{failed_to_start_child,worker_sup,{shutdown,{failed_to_start_child,{worker,1},{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}}}},{child,undefined,{pool_sup,‘emqx_authn_mongodb:4:5’},{ecpool_pool_sup,start_link,[‘emqx_authn_mongodb:4:5’,emqx_connector_mongo,[{mongo_type,single},{hosts,[<<“10.38.80.70:8635”>>]},{pool_size,8},{options,[{pool_size,8},{max_overflow,0}]},{worker_options,[{w_mode,unsafe},{login,<<“rwuser”>>},{password,<<“”>>},{database,<<“monitor”>>},{auth_source,<<“admin”>>},{ssl,false}]}]]},transient,false,infinity,supervisor,[ecpool_pool_sup]}}
2022-12-14T21:05:10.504803+08:00 [error] crasher: initial call: supervisor:mc_pool_sup/1, pid: <0.3554.0>, registered_name: mc_pool_sup, exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,decode_msg,9,[{file,“gen_server.erl”},{line,481}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3553.0>,<0.3552.0>,<0.3550.0>,ecpool_sup,<0.2462.0>], message_queue_len: 0, messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 4185, stack_size: 29, reductions: 8468; neighbours:
2022-12-14T21:05:10.504652+08:00 [error] Generic server mc_pool_sup terminating. Reason: {configured_mongo_set_name_mismatch,undefined,<<“replica”>>}. Last message: {‘EXIT’,<0.3553.0>,{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}. State: {state,{local,mc_pool_sup},simple_one_for_one,{[worker_pool],#{worker_pool => {child,undefined,worker_pool,{poolboy,start_link,[]},transient,false,5000,worker,[poolboy]}}},{maps,#{}},1000,3600,[],0,never,mc_pool_sup,[]}.
2022-12-14T21:05:10.504456+08:00 [error] crasher: initial call: ecpool_worker:init/1, pid: <0.3553.0>, registered_name: [], exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,init_it,6,[{file,“gen_server.erl”},{line,407}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3552.0>,<0.3550.0>,ecpool_sup,<0.2462.0>], message_queue_len: 0, messages: [], links: [<0.3554.0>,<0.3555.0>,<0.3552.0>], dictionary: [], trap_exit: true, status: running, heap_size: 610, stack_size: 29, reductions: 323; neighbours:
2022-12-14T21:05:10.504411+08:00 [error] Supervisor: {<0.3550.0>,ecpool_pool_sup}. Context: start_error. Reason: {shutdown,{failed_to_start_child,{worker,1},{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}}. Offender: id=worker_sup,pid=undefined.
2022-12-14T21:05:10.504172+08:00 [error] crasher: initial call: mc_topology:init/1, pid: <0.3555.0>, registered_name: [], exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,init_it,6,[{file,“gen_server.erl”},{line,407}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3553.0>,<0.3552.0>,<0.3550.0>,ecpool_sup,<0.2462.0>], message_queue_len: 1, messages: [{‘$gen_cast’,init_seeds}], links: [<0.3553.0>], dictionary: [], trap_exit: false, status: running, heap_size: 987, stack_size: 29, reductions: 6425; neighbours:
2022-12-14T21:05:10.504216+08:00 [error] Supervisor: {<0.3552.0>,ecpool_worker_sup}. Context: start_error. Reason: {configured_mongo_set_name_mismatch,undefined,<<“replica”>>}. Offender: id={worker,1},pid=undefined.
2022-12-14T21:05:10.503939+08:00 [error] Configured mongo set name does not match actual mongo install set name. Configured: undefined; Actual: <<“replica”>>
2022-12-14T21:05:07.041080+08:00 [error] line: 47, mfa: emqx_plugin_libs_pool:start_pool/3, msg: start_ecpool_error, pool_name: ‘emqx_authn_mongodb:4:5’, reason: {{shutdown,{failed_to_start_child,worker_sup,{shutdown,{failed_to_start_child,{worker,1},{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}}}},{child,undefined,{pool_sup,‘emqx_authn_mongodb:4:5’},{ecpool_pool_sup,start_link,[‘emqx_authn_mongodb:4:5’,emqx_connector_mongo,[{mongo_type,single},{hosts,[<<“10.38.80.70:8635”>>]},{pool_size,8},{options,[{pool_size,8},{max_overflow,0}]},{worker_options,[{w_mode,unsafe},{login,<<“rwuser”>>},{password,<<“”>>},{database,<<“monitor”>>},{auth_source,<<“admin”>>},{ssl,false}]}]]},transient,false,infinity,supervisor,[ecpool_pool_sup]}}
2022-12-14T21:05:07.041039+08:00 [error] crasher: initial call: supervisor:mc_pool_sup/1, pid: <0.3728.0>, registered_name: mc_pool_sup, exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,decode_msg,9,[{file,“gen_server.erl”},{line,481}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3727.0>,<0.3726.0>,<0.3724.0>,ecpool_sup,<0.2462.0>], message_queue_len: 0, messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 4185, stack_size: 29, reductions: 8468; neighbours:
2022-12-14T21:05:07.040902+08:00 [error] Generic server mc_pool_sup terminating. Reason: {configured_mongo_set_name_mismatch,undefined,<<“replica”>>}. Last message: {‘EXIT’,<0.3727.0>,{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}. State: {state,{local,mc_pool_sup},simple_one_for_one,{[worker_pool],#{worker_pool => {child,undefined,worker_pool,{poolboy,start_link,[]},transient,false,5000,worker,[poolboy]}}},{maps,#{}},1000,3600,[],0,never,mc_pool_sup,[]}.
2022-12-14T21:05:07.040700+08:00 [error] crasher: initial call: ecpool_worker:init/1, pid: <0.3727.0>, registered_name: [], exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,init_it,6,[{file,“gen_server.erl”},{line,407}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3726.0>,<0.3724.0>,ecpool_sup,<0.2462.0>], message_queue_len: 0, messages: [], links: [<0.3728.0>,<0.3729.0>,<0.3726.0>], dictionary: [], trap_exit: true, status: running, heap_size: 610, stack_size: 29, reductions: 323; neighbours:
2022-12-14T21:05:07.040666+08:00 [error] Supervisor: {<0.3724.0>,ecpool_pool_sup}. Context: start_error. Reason: {shutdown,{failed_to_start_child,{worker,1},{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}}. Offender: id=worker_sup,pid=undefined.
2022-12-14T21:05:07.040485+08:00 [error] crasher: initial call: mc_topology:init/1, pid: <0.3729.0>, registered_name: [], exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,init_it,6,[{file,“gen_server.erl”},{line,407}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3727.0>,<0.3726.0>,<0.3724.0>,ecpool_sup,<0.2462.0>], message_queue_len: 1, messages: [{‘$gen_cast’,init_seeds}], links: [<0.3727.0>], dictionary: [], trap_exit: false, status: running, heap_size: 987, stack_size: 29, reductions: 6427; neighbours:
2022-12-14T21:05:07.040504+08:00 [error] Supervisor: {<0.3726.0>,ecpool_worker_sup}. Context: start_error. Reason: {configured_mongo_set_name_mismatch,undefined,<<“replica”>>}. Offender: id={worker,1},pid=undefined.
2022-12-14T21:05:07.040266+08:00 [error] Configured mongo set name does not match actual mongo install set name. Configured: undefined; Actual: <<“replica”>>
2022-12-14T21:05:04.501403+08:00 [warning] line: 411, message: <<“resource down: emqx_authn_mongodb:4”>>, mfa: emqx_alarm:do_actions/3, msg: alarm_is_activated, name: <<“emqx_authn_mongodb:4”>>
2022-12-14T21:05:04.501052+08:00 [error] crasher: initial call: supervisor:mc_pool_sup/1, pid: <0.3411.0>, registered_name: mc_pool_sup, exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,decode_msg,9,[{file,“gen_server.erl”},{line,481}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3410.0>,<0.3409.0>,<0.3407.0>,ecpool_sup,<0.2462.0>], message_queue_len: 0, messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 4185, stack_size: 29, reductions: 8468; neighbours:
2022-12-14T21:05:04.500886+08:00 [error] line: 47, mfa: emqx_plugin_libs_pool:start_pool/3, msg: start_ecpool_error, pool_name: ‘emqx_authn_mongodb:4:5’, reason: {{shutdown,{failed_to_start_child,worker_sup,{shutdown,{failed_to_start_child,{worker,1},{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}}}},{child,undefined,{pool_sup,‘emqx_authn_mongodb:4:5’},{ecpool_pool_sup,start_link,[‘emqx_authn_mongodb:4:5’,emqx_connector_mongo,[{mongo_type,single},{hosts,[<<“10.38.80.70:8635”>>]},{pool_size,8},{options,[{pool_size,8},{max_overflow,0}]},{worker_options,[{w_mode,unsafe},{login,<<“rwuser”>>},{password,<<“”>>},{database,<<“monitor”>>},{auth_source,<<“admin”>>},{ssl,false}]}]]},transient,false,infinity,supervisor,[ecpool_pool_sup]}}
2022-12-14T21:05:04.500838+08:00 [error] Generic server mc_pool_sup terminating. Reason: {configured_mongo_set_name_mismatch,undefined,<<“replica”>>}. Last message: {‘EXIT’,<0.3410.0>,{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}. State: {state,{local,mc_pool_sup},simple_one_for_one,{[worker_pool],#{worker_pool => {child,undefined,worker_pool,{poolboy,start_link,[]},transient,false,5000,worker,[poolboy]}}},{maps,#{}},1000,3600,[],0,never,mc_pool_sup,[]}.
2022-12-14T21:05:04.500555+08:00 [error] crasher: initial call: ecpool_worker:init/1, pid: <0.3410.0>, registered_name: [], exit: {{configured_mongo_set_name_mismatch,undefined,<<“replica”>>},[{gen_server,init_it,6,[{file,“gen_server.erl”},{line,407}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}]}, ancestors: [<0.3409.0>,<0.3407.0>,ecpool_sup,<0.2462.0>], message_queue_len: 0, messages: [], links: [<0.3411.0>,<0.3412.0>,<0.3409.0>], dictionary: [], trap_exit: true, status: running, heap_size: 610, stack_size: 29, reductions: 323; neighbours:
2022-12-14T21:05:04.500379+08:00 [error] Supervisor: {<0.3407.0>,ecpool_pool_sup}. Context: start_error. Reason: {shutdown,{failed_to_start_child,{worker,1},{configured_mongo_set_name_mismatch,undefined,<<“replica”>>}}}. Offender: id=worker_sup,pid=undefined.
你好,这个应该还是 MongoDB 本身的配置问题,你可以通过 shell 连接到 MongoDB 然后运行这个命令看看:
db.runCommand({isMaster: 1 })
// 1
{
“hosts”: [
“192.168.54.33:8635”
],
“setName”: “replica”,
“setVersion”: NumberInt(“1”),
“ismaster”: true,
“secondary”: false,
“primary”: “192.168.54.33:8635”,
“me”: “192.168.54.33:8635”,
“electionId”: ObjectId(“7fffffff0000000000000001”),
“lastWrite”: {
“opTime”: {
“ts”: Timestamp(1671156515, 4),
“t”: NumberLong(“1”)
},
“lastWriteDate”: ISODate(“2022-12-16T02:08:35.000Z”),
“majorityOpTime”: {
“ts”: Timestamp(1671156515, 4),
“t”: NumberLong(“1”)
},
“majorityWriteDate”: ISODate(“2022-12-16T02:08:35.000Z”)
},
“maxBsonObjectSize”: NumberInt(“16777216”),
“maxMessageSizeBytes”: NumberInt(“48000000”),
“maxWriteBatchSize”: NumberInt(“100000”),
“localTime”: ISODate(“2022-12-16T02:08:35.693Z”),
“logicalSessionTimeoutMinutes”: NumberInt(“30”),
“minWireVersion”: NumberInt(“0”),
“maxWireVersion”: NumberInt(“7”),
“readOnly”: false,
“ok”: 1,
“operationTime”: Timestamp(1671156515, 4),
“$clusterTime”: {
“clusterTime”: Timestamp(1671156515, 4),
“signature”: {
“hash”: BinData(0, “h5uKStqmxkZ/lPiNktOVeXArq5Q=”),
“keyId”: NumberLong(“7137475887712174082”)
}
}
}
可以了,是单机副本集,设置replica连接上了