openstack中dashboard页面RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.

时间:2024-08-20 11:07:26

环境是centos7,直接跑在服务器上。

按照官网一步步安装openstack,到验证dashborad时出错。

登录http://192.168.1.73/dashboard ,输入域名,用户名,密码,出现错误,无法进入界面

openstack中dashboard页面RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.

tail -40 /etc/httpd/logs/error_log 查看打印

发现

[Sat Aug 12 19:42:16.701521 2017] [:error] [pid 10885] Could not process panel theme_preview: Dashboard with slug "developer" is not registered.
[Sat Aug 12 19:44:41.533207 2017] [:error] [pid 10885] Login successful for user "admin".
[Sat Aug 12 19:45:52.537140 2017] [:error] [pid 10885] Internal Server Error: /dashboard/auth/login/
[Sat Aug 12 19:45:52.556116 2017] [:error] [pid 10885] Traceback (most recent call last):
[Sat Aug 12 19:45:52.556129 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 223, in get_response
[Sat Aug 12 19:45:52.556135 2017] [:error] [pid 10885] response = middleware_method(request, response)
[Sat Aug 12 19:45:52.556140 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/middleware.py", line 50, in process_response
[Sat Aug 12 19:45:52.556145 2017] [:error] [pid 10885] request.session.save()
[Sat Aug 12 19:45:52.556148 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 53, in save
[Sat Aug 12 19:45:52.556153 2017] [:error] [pid 10885] return self.create()
[Sat Aug 12 19:45:52.556157 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 48, in create
[Sat Aug 12 19:45:52.556180 2017] [:error] [pid 10885] "Unable to create a new session key. "
[Sat Aug 12 19:45:52.556185 2017] [:error] [pid 10885] RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.
[Sat Aug 12 20:15:27.128247 2017] [:error] [pid 10885] Login successful for user "admin".
[Sat Aug 12 20:15:33.377599 2017] [:error] [pid 10885] Internal Server Error: /dashboard/auth/login/
[Sat Aug 12 20:15:33.377660 2017] [:error] [pid 10885] Traceback (most recent call last):
[Sat Aug 12 20:15:33.377665 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
[Sat Aug 12 20:15:33.377668 2017] [:error] [pid 10885] response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Sat Aug 12 20:15:33.377671 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
[Sat Aug 12 20:15:33.377674 2017] [:error] [pid 10885] return view(request, *args, **kwargs)
[Sat Aug 12 20:15:33.377677 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
[Sat Aug 12 20:15:33.377680 2017] [:error] [pid 10885] response = view_func(request, *args, **kwargs)
[Sat Aug 12 20:15:33.377682 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
[Sat Aug 12 20:15:33.377685 2017] [:error] [pid 10885] response = view_func(request, *args, **kwargs)
[Sat Aug 12 20:15:33.377688 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/openstack_auth/views.py", line 103, in login
[Sat Aug 12 20:15:33.377691 2017] [:error] [pid 10885] **kwargs)
[Sat Aug 12 20:15:33.377694 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
[Sat Aug 12 20:15:33.377697 2017] [:error] [pid 10885] return view(request, *args, **kwargs)
[Sat Aug 12 20:15:33.377699 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
[Sat Aug 12 20:15:33.377702 2017] [:error] [pid 10885] response = view_func(request, *args, **kwargs)
[Sat Aug 12 20:15:33.377704 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
[Sat Aug 12 20:15:33.377707 2017] [:error] [pid 10885] response = view_func(request, *args, **kwargs)
[Sat Aug 12 20:15:33.377709 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/auth/views.py", line 51, in login
[Sat Aug 12 20:15:33.377712 2017] [:error] [pid 10885] auth_login(request, form.get_user())
[Sat Aug 12 20:15:33.377714 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 110, in login
[Sat Aug 12 20:15:33.377717 2017] [:error] [pid 10885] request.session.cycle_key()
[Sat Aug 12 20:15:33.377720 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 285, in cycle_key
[Sat Aug 12 20:15:33.377723 2017] [:error] [pid 10885] self.create()
[Sat Aug 12 20:15:33.377725 2017] [:error] [pid 10885] File "/usr/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py", line 48, in create
[Sat Aug 12 20:15:33.377728 2017] [:error] [pid 10885] "Unable to create a new session key. "
[Sat Aug 12 20:15:33.377730 2017] [:error] [pid 10885] RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.

意思大概是:

因为它周期性连接到非本地缓存有问题。官网写的有bug。

把/etc/openstack-dashboard/local_settings 中 SESSION_ENGINE = 'django.contrib.sessions.backends.cache' 应改为
SESSION_ENGINE = 'django.contrib.sessions.backends.file'

重启服务,然后重新登录成功。

systemctl restart httpd.service memcached.service

openstack中dashboard页面RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.