一:前言
对于一个以前做java全栈工程师而言,而且没学过Linux,很少用虚拟机(还是在大学的时候简单的用过),去配置openstack我想我入的坑肯定比有基础的一定要多,躺在每个坑中徘徊思索的时间一定比老鸟们久。所以现在总结一下openstack在配置过程中的几大坑点,让各位在配置过程中不再问天问大地,灵魂一片片凋落。
1. 如果是新手一定要学会用快照,一定要多用快照,从镜像安装完成开始,最好每一个章节模块配置完成后都用上一个快照,人生苦短,快照帮你性感。
2.一定要仔细看配种配置以及环境要求,比如控制节点: 1 处理器, 4 GB 内存, 及5 GB 存储,环境没达到只能当练手。
3.一定要选择自己要配置的版本,openstack目前版本不定更新,所以如果不固定版本,只从官方文档打开,将给配置带来很多问题。
二:入坑指南
1.坑一SQL数据库
在为数据库的root设置适当密码时一定要注意,一步错误后面将直接无法赋予权限,那么应该怎么设置嘞?看下面。
建议直接运行命令# echo -e "\nY\n123456\n123456\nY\nn\nY\nY\n" | mysql_secure_installation来代替原来的mysql_secure_installation。这样将免去中间的设置。
2.坑二配置Linuxbridge代理
这两个地方在compute和controller中将配置什么嘞?
直接揭晓答案吧,physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME在controller和compute中都配置第二个网盘的名字。
local_ip = OVERLAY_INTERFACE_IP_ADDRESS看名字local_ip本地ip嘛,所以在controller和compute中分别配置各自的静态ip。
3.坑三Networking 服务neutron agent-list中不显示compute
这个可能原因有很多,但从我的错误来看,,你关闭了防火墙吗??你关闭了SELinux吗?? SELinux怎么关闭??
查看SELinux状态:
1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
2、getenforce ##也可以用这个命令检查
关闭SELinux:
1、临时关闭(不用重启机器):
setenforce 0 ##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式
2、修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可
4.坑点四openstack中dashboard页面RuntimeError: Unable to create a new session key. It is likely that the cache is unavailable.
环境是centos7,直接跑在服务器上。
按照官网一步步安装openstack,到验证dashborad时出错。
登录http://192.168.1.73/dashboard ,输入域名,用户名,密码,出现错误,无法进入界面
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'
重启服务,然后重新登录成功。
三: 提问榜
以上是我在部署openstack过程中遇到的几个疑问点,可能“乱拳打死老师傅”一般避开了各位的疑难点,各位可在留言中向我提问,愿意向各位讨教!----yh