[root@c2 ~]# openstack user list
Internal Server Error (HTTP 500)
[root@c2 ~]# tail -f /var/log/httpd/
access_log error_log keystone_access.log keystone.log
[root@c2 ~]# tail -f /var/log/httpd/keystone.log
2021-03-10 19:13:45.459788 File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 534, in _setup_for_connection
2021-03-10 19:13:45.459793 sql_connection=sql_connection, **engine_kwargs)
2021-03-10 19:13:45.459796 File "/usr/lib/python2.7/site-packages/debtcollector/renames.py", line 43, in decorator
2021-03-10 19:13:45.459821 return wrapped(*args, **kwargs)
2021-03-10 19:13:45.459826 File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/engines.py", line 201, in create_engine
2021-03-10 19:13:45.459891 test_conn = _test_connection(engine, max_retries, retry_interval)
2021-03-10 19:13:45.459897 File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/engines.py", line 387, in _test_connection
2021-03-10 19:13:45.459905 six.reraise(type(de_ref), de_ref)
2021-03-10 19:13:45.459908 File "" , line 3, in reraise
2021-03-10 19:13:45.459934 DBConnectionError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'c2' ([Errno 111] Connection refused)") (Background on this error at: http://sqlalche.me/e/e3q8)
“Can’t connect to MySQL server on ‘c2’ ([Errno 111] Connection refused)”)
[root@c2 ~]# netstat -natp | grep 3306
tcp 0 0 192.168.100.11:3306 0.0.0.0:* LISTEN 34446/mysqld
vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.86.13
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
systemctl restart mysql
netstat -natp | grep 3306
tcp 0 0 192.168.86.13:3306 0.0.0.0:* LISTEN 43934/mysqld
[root@c2 ~]# openstack user list
Internal Server Error (HTTP 500)
[root@c2 ~]# tail -f /var/log/httpd/keystone.log
2021-03-10 19:20:58.511672 result.read()
2021-03-10 19:20:58.511676 File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 1066, in read
2021-03-10 19:20:58.511681 first_packet = self.connection._read_packet()
2021-03-10 19:20:58.511685 File "/usr/lib/python2.7/site-packages/pymysql/connections.py", line 683, in _read_packet
2021-03-10 19:20:58.511689 packet.check_error()
2021-03-10 19:20:58.511693 File "/usr/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
2021-03-10 19:20:58.511883 err.raise_mysql_exception(self._data)
2021-03-10 19:20:58.511892 File "/usr/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
2021-03-10 19:20:58.511930 raise errorclass(errno, errval)
2021-03-10 19:20:58.512041 ProgrammingError: (pymysql.err.ProgrammingError) (1146, u"Table 'keystone.project' doesn't exist") [SQL: u'SELECT project.id AS project_id, project.name AS project_name, project.domain_id AS project_domain_id, project.description AS project_description, project.enabled AS project_enabled, project.extra AS project_extra, project.parent_id AS project_parent_id, project.is_domain AS project_is_domain \\nFROM project \\nWHERE project.name = %(name_1)s AND project.domain_id = %(domain_id_1)s'] [parameters: {
u'domain_id_1': '<>' , u'name_1': u'Default'}] (Background on this error at: http://sqlalche.me/e/f405)
原因:初始化数据库失败。keystone数据库中无数据表。
##:这里初始化后原先的数据会有所改变,要重新将前面的命令执行一遍
[root@c2 ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone
[root@c2 ~]# openstack user list
The request you have made requires authentication. (HTTP 401) (Request-ID: req-b244d241-da8d-4771-a796-20578d7bb415)
[root@c2 ~]# openstack user list
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 3b11417c481a45768e3e781dcb709e9a | admin |
+----------------------------------+-------+