Rs.initiate (config); {"OK": 0, "errmsg": "Couldn ' t initiate:need all members up to initiate, not

Source: Internet
Author: User
Tags config mongodb iptables
One: Problem description

Today in initializing MongoDB replica set times wrong:

[Root@ser6-51 ~]# MONGO

MongoDB Shell version:2.6.9

Connecting To:test

> Use admin;

Switched to DB admin

> config = {_id: "Myreplset", members:[

... {_id:0,host: "192.168.6.51:27017"},

... {_id:1,host: "192.168.6.52:27017"},

... {_id:2,host: "192.168.6.70:27017"}]

...  }

{

"_id": "Myreplset",

"Members": [

{

"_id": 0,

"Host": "192.168.6.51:27017"

},

{

"_id": 1,

"Host": "192.168.6.52:27017"

},

{

"_id": 2,

"Host": "192.168.6.70:27017"

}

]

}

> rs.initiate (config);

{

"OK": 0,

"ErrMsg": "Couldn ' t initiate:need all members up to initiate, not ok:192.168.6.52:27017"

} Two: Cause of the error

MongoDB does not start or does not have an open firewall port


Three: The solution to open MongoDB.  The reason I went wrong here is that there is no open firewall port. Vi/etc/sysconfig/iptables

Add a line:

-A input-m state--state new-m tcp-p TCP--dport 27017-j ACCEPT

Restarting the firewall

[root@ser6-52 mongodb]#/etc/init.d/iptables Restart

Iptables:setting chains to Policy Accept:filter [OK]

iptables:flushing firewall rules: [OK]

iptables:unloading modules: [OK]

iptables:applying firewall rules: [OK]

--This article references from: Mongodb2.4.3 cluster installation Notes


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.