Apr
16
[原]使用RDO juno dev1462 部署mongodb 失败的问题
执行 RDO juno openstack-packstack-dev1462 版本部署的时候,执行mongodb 部署失败,报如下的错误:
实际错误为访问mongo 服务无法连接:
1.问题分析
经排查,原因是启动后的mongodb 服务监听端口为127.0.0.1,而不是物理网卡的IP :
从配置文件来看,存在两个配置文件/etc/mongodb.conf 和 /etc/mongod.conf。
其中,/etc/mongodb.conf 是puppet 生成的,而/etc/mongod.conf 是mongodb 软件自带的。
查看进程运行命令。
可见,进程使用的是/etc/mongod.conf ,而该配置中监听的就是127.0.0.1 的IP,怀疑问题就是由此导致的。
问题根源与RDO 执行的puppet 部署代码有关:
根据是否使用 manage_package_repo 来决定配置文件的名称。对于EPEL 包,采用的是mongodb.conf ,但在EPEL 7 提供的mongodb-server.x86_64 2.6.9-1.el7 版本中,同样也是使用mongod.conf 作为配置文件的。
2.解决问题
把上面模块部署代码中的配置文件名字'/etc/mongodb.conf' 修改为'/etc/mongod.conf'即可:
再次运行RDO 脚本,问题解决。
引用
[root@controller01 ~]# packstack --answer-file=./packstack-answers-20150415-110139.txt
192.168.209.137_mongodb.pp: [ ERROR ]
Applying Puppet manifests [ ERROR ]
ERROR : Error appeared during Puppet run: 192.168.209.137_mongodb.pp
Error: Unable to connect to mongodb server! (192.168.209.137:27017)
You will find full trace in log /var/tmp/packstack/20150415-161743-hbPMV4/manifests/192.168.209.137_mongodb.pp.log
192.168.209.137_mongodb.pp: [ ERROR ]
Applying Puppet manifests [ ERROR ]
ERROR : Error appeared during Puppet run: 192.168.209.137_mongodb.pp
Error: Unable to connect to mongodb server! (192.168.209.137:27017)
You will find full trace in log /var/tmp/packstack/20150415-161743-hbPMV4/manifests/192.168.209.137_mongodb.pp.log
实际错误为访问mongo 服务无法连接:
引用
[root@controller01 ~]# cat /var/tmp/packstack/20150415-161743-hbPMV4/manifests/192.168.209.137_mongodb.pp.log
......
Notice: Failed to connect to mongodb within timeout window of 240 seconds; giving up.
Error: Unable to connect to mongodb server! (192.168.209.137:27017)
Error: /Stage[main]/Mongodb::Server::Service/Mongodb_conn_validator[mongodb]/ensure: change from absent to present failed: Unable to connect to mongodb server! (192.168.209.137:27017)
Notice: /Stage[main]/Mongodb::Server/Anchor[mongodb::server::end]: Dependency Mongodb_conn_validator[mongodb] has failures: true
Warning: /Stage[main]/Mongodb::Server/Anchor[mongodb::server::end]: Skipping because of failed dependencies
......
Notice: Failed to connect to mongodb within timeout window of 240 seconds; giving up.
Error: Unable to connect to mongodb server! (192.168.209.137:27017)
Error: /Stage[main]/Mongodb::Server::Service/Mongodb_conn_validator[mongodb]/ensure: change from absent to present failed: Unable to connect to mongodb server! (192.168.209.137:27017)
Notice: /Stage[main]/Mongodb::Server/Anchor[mongodb::server::end]: Dependency Mongodb_conn_validator[mongodb] has failures: true
Warning: /Stage[main]/Mongodb::Server/Anchor[mongodb::server::end]: Skipping because of failed dependencies
1.问题分析
经排查,原因是启动后的mongodb 服务监听端口为127.0.0.1,而不是物理网卡的IP :
[root@controller01 ~]# netstat -ln|grep 27017
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN
从配置文件来看,存在两个配置文件/etc/mongodb.conf 和 /etc/mongod.conf。
引用
[root@controller01 ~]# grep 'bind' /etc/mongo*
/etc/mongodb.conf:# Set this option to configure the mongod or mongos process to bind to and
/etc/mongodb.conf:# You may concatenate a list of comma separated values to bind mongod to multiple IP addresses.
/etc/mongodb.conf:bind_ip = 192.168.209.137
/etc/mongod.conf:bind_ip = 127.0.0.1
/etc/mongos.conf:bind_ip = 127.0.0.1
/etc/mongodb.conf:# Set this option to configure the mongod or mongos process to bind to and
/etc/mongodb.conf:# You may concatenate a list of comma separated values to bind mongod to multiple IP addresses.
/etc/mongodb.conf:bind_ip = 192.168.209.137
/etc/mongod.conf:bind_ip = 127.0.0.1
/etc/mongos.conf:bind_ip = 127.0.0.1
其中,/etc/mongodb.conf 是puppet 生成的,而/etc/mongod.conf 是mongodb 软件自带的。
查看进程运行命令。
引用
[root@controller01 ~]# ps -ef|grep mongo
mongodb 16628 1 0 17:24 ? 00:00:01 /usr/bin/mongod --quiet -f /etc/mongod.conf run
mongodb 16628 1 0 17:24 ? 00:00:01 /usr/bin/mongod --quiet -f /etc/mongod.conf run
可见,进程使用的是/etc/mongod.conf ,而该配置中监听的就是127.0.0.1 的IP,怀疑问题就是由此导致的。
问题根源与RDO 执行的puppet 部署代码有关:
根据是否使用 manage_package_repo 来决定配置文件的名称。对于EPEL 包,采用的是mongodb.conf ,但在EPEL 7 提供的mongodb-server.x86_64 2.6.9-1.el7 版本中,同样也是使用mongod.conf 作为配置文件的。
2.解决问题
把上面模块部署代码中的配置文件名字'/etc/mongodb.conf' 修改为'/etc/mongod.conf'即可:
再次运行RDO 脚本,问题解决。