# dashboard登录出错，提示无法进入页面，服务器错误

~# vim /var/log/httpd/error_log

[Mon Mar 27 14:20:36.204588 2017] [:error] [pid 3224] “Unable to create a new session key. ”
[Mon Mar 27 14:20:36.204588 2017] [:error] [pid 3224]RuntimeError:Unable to create a new session key. It is likely that the cache is unavailable

I was getting this error running a local, development version of a Django project, because it was periodically having trouble connecting to a non-local cache. I realized that I could change my session backend to a file-based session to address the issue .

In the settings file for this local, development version of Django, I simply set the following value:

SESSION_ENGINE = ‘django.contrib.sessions.backends.file’
This is not the solution I would use in a production environment, and not the solution I would suggest to the original poster, but it took me a few minutes to figure out what the issue was and this is one of the only results that appeared when I Googled, so I figured I’d post here possibly to help out others with a similar issue.

Django中的Session有3种存储方式：放在数据库、缓存或者文件系统中，其中设置session在缓存中，可以使用django.contrib.session.backends.cache方法，或者django.contrib.session.backends.cache_db存放在缓存与数据库中，第一种方法不能保证session总能取到（比如缓存溢出时Session会丢失），另外一种方式就是存在文件系统上，就是将cache改为file，保存在缓存中能够获得较好的性能，但是可能会出现一些问题

~# telnet xxx.xxx.xxx.xxx 11211

~# telnet 10.0.0.11 11211
~# telnet controller 11211

~# telnet 127.0.0.1 11211

~# vim /etc/sysconfig/memcached

~# systemctl restart memcached.service

## 总结

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客