执行 RDO juno openstack-packstack-dev1462 版本部署的时候,执行mongodb 部署失败,报如下的错误:
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 服务无法连接:
……
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 :
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN
从配置文件来看,存在两个配置文件/etc/mongodb.conf 和 /etc/mongod.conf。
/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 软件自带的。
查看进程运行命令。
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 部署代码有关:
if $mongodb::globals::manage_package_repo {
$service_name = pick($::mongodb::globals::service_name, ‘mongod’)
$config = ‘/etc/mongod.conf’
$dbpath = ‘/var/lib/mongodb’
$logpath = ‘/var/log/mongodb/mongod.log’
$pidfilepath = ‘/var/run/mongodb/mongod.pid’
$bind_ip = pick($::mongodb::globals::bind_ip, [‘127.0.0.1’])
$fork = true
} else {
# RedHat/CentOS doesn’t come with a prepacked mongodb
# so we assume that you are using EPEL repository.
$config = ‘/etc/mongodb.conf’
$dbpath = ‘/var/lib/mongodb’
$logpath = ‘/var/log/mongodb/mongodb.log’
根据是否使用 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 脚本,问题解决。
解决 OpenvSwitch terminating with signal 14 (Alarm clock) 错误
创建实例报 Virtual Interface creation failed 的错误
Neutron 网络架构讲解_VLAN 网络
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/98248.html