您的位置:首页 > 数据库 > Mongodb

mongodb创建replica set时,需要先配置主机名

2013-10-17 11:48 471 查看
今天在新环境部署mongodb集群,忘记先配置hostname,引发了一个错误。配置rs的完整过程,见配置mongodb rs

未配置主机名之前,在primary上执行

rs.initiate()


错误信息是:

> rs.initiate()
{
"info2" : "no configuration explicitly specified -- making one",
"me" : "the-host-name:2222",
"errmsg" : "couldn't initiate : can't find self in the replset config",
"ok" : 0
}

然后需要编辑/etc/hosts文件,将上面红字的主机名映射进去即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: