openstack排错
一、排错方法:
1、查看日志路径为/var/log,具体哪个组件出了问题进入其目录查看。
2、debug
root@sc-ctrl01:~# keystone --debug user-list root@sc-ctrl01:~# nova --debug list
3、grep
root@sc-ctrl01:~# grep -ri error /var/log/*
二、具体错误:
1、登录dashboard显示错误,
查看日志/var/log/upstart/neutron-server.log
2015-01-06 17:41:07.571 11110 ERROR neutron.openstack.common.rpc.common [-] AMQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.
是因为neutron寻找rabbitMQ服务错误,定位到localhost:5672。解决:在/etc/neutron/neutron.conf中检查所有和rabbitmq相关配置:
rabbit_host =10.1.101.11
rabbit_password = password
rabbit_port = 5672
rabbit_hosts =controller:5672
rabbit_userid = guest
然后重启neutron服务和rabbitmq服务。
cd /etc/init.d/; for i in $( ls neutron-* ); do sudo service $i restart; done
service rabbitmq-server restart
------------------------------------
查看rabbitmq服务是否允许在rabbit服务器
# systemctl status rabbitmq-server.service -l
查看rabbitmq状态
#rabbitmqctl status
查看guest是否存在:
# rabbitmqctl list_users |grep guest
修改密码:
#rabbitmqctl change_password guest somepassword
查看compute节点是否可以和rabbit 服务器建立连接
#lsof -i :5672|grep 'compute_node_ip'
2、创建虚拟机失败:错误: 创建实例 "vm001" 失败: 请稍后再试 [错误: No valid host was found. ].
先查看compute是否已经起了,在controller节点执行nova service-list
root@ubuntu:~# nova service-list
+------------------+--------+----------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+--------+----------+---------+-------+----------------------------+-----------------+
| nova-conductor | ubuntu | internal | enabled | up | 2015-01-08T01:10:32.000000 | - |
| nova-cert | ubuntu | internal | enabled | up | 2015-01-08T01:10:35.000000 | - |
| nova-consoleauth | ubuntu | internal | enabled | up | 2015-01-08T01:10:27.000000 | - |
| nova-scheduler | ubuntu | internal | enabled | up | 2015-01-08T01:10:27.000000 | - |
+------------------+--------+----------+---------+-------+----------------------------+-----------------+
可以看到nova-compute服务没有起,
我是在Ubuntu虚拟机上部署,因为hypervisor/CPU不支持虚拟化,可以通过命令$ egrep -c '(vmx|svm)' /proc/cpuinfo查看,如果返回0就是不支持。
所以要将/etc/nova/nova-compute.conf内容替换为:
[DEFAULT]
compute_driver=libvirt.LibvirtDriver
[libvirt]
virt_type=qemu
然后重启service nova-compute restart,现在nova-compute就up了。
3、创建虚拟机失败: 错误: 创建实例 "vm001" 失败: 请稍后再试 [错误: Virtual Interface creation failed].
修改controller节点的/etc/neutron/neutron.conf
nova_url = http://10.1.101.11:8774/v2/v2为nova_url = http://10.1.101.11:8774/v2
因为我部署时用命令sed -i -e s/# nova_url = http:\/\/127.0.0.1:8774/nova_url = http:\/\/$MASTER:8774\/v2/g /etc/neutron/neutron.conf
导致的,没有好好检查。
4、创建虚拟机失败:Error: 创建实例 "vmtest" 失败: 请稍后再试 [错误: Timed out waiting for a reply to message ID c13fc53762ca47ce8e5253e5afb753c8].
应该是nova服务挂掉了
root@sc-ctrl01:~# nova-manage service list Binary Host Zone Status State Updated_At nova-cert sc-ctrl01 internal enabled :-) 2015-03-17 05:30:01 nova-consoleauth sc-ctrl01 internal enabled :-) 2015-03-17 05:30:01 nova-scheduler sc-ctrl01 internal enabled :-) 2015-03-17 05:30:00 nova-conductor sc-ctrl01 internal enabled :-) 2015-03-17 05:29:59 nova-compute sc-com01 nova enabled XXX 2015-03-17 05:18:37
重启nova-compute服务
5、Authorization Failed: [Errno 111] Connection refused
可能是环境变量设置错误
租户不存在
OS_AUTH_URL写错
6、ERROR 2006 (HY000) at line 1: MySQL server has gone away
客户机和服务器之间的连接断开了,可能是因为sql操作时间过长,或者传输数据太大(例如使用insert...value语句过长,这种情况将/etc/mysql/my.cf中的max_allowed_packet修改为64M或更大,也可以在程序中将数据分批插入)
7、start: Rejected send message, 1 matched rules; type="method_call", sender=":1.6" (uid=1001 pid=2153 comm="start mysql ") interface
="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1
comm="/sbin/init")
需要root权限才行
sudo -i到root,然后再执行之前的命令。