OpenStack离线Train版安装系列—8.控制节点-Horizon服务组件

本系列文章包含从OpenStack离线源制作到完成OpenStack安装的全部过程。
在本系列教程中使用的OpenStack的安装版本为第20个版本Train(简称T版本),2020年5月13日,OpenStack社区发布了第21个版本Ussuri(简称U版本)。

OpenStack离线安装系列—0制作yum源
OpenStack离线安装系列—1控制节点-环境准备
OpenStack离线安装系列—2计算节点-环境准备
OpenStack离线安装系列—3控制节点-Keystone认证服务组件
OpenStack离线安装系列—4控制节点-Glance镜像服务组件
OpenStack离线安装系列—5控制节点-Placement服务组件
OpenStack离线安装系列—6.1控制节点-Nova计算服务组件
OpenStack离线安装系列—6.2计算节点-Nova计算服务组件
OpenStack离线安装系列—6.3控制节点-Nova计算服务组件
OpenStack离线安装系列—7.1控制节点-Neutron网络服务组件
OpenStack离线安装系列—7.2计算节点-Neutron网络服务组件
OpenStack离线安装系列—7.3控制节点-Neutron网络服务组件
OpenStack离线安装系列—8.控制节点-Horizon服务组件
OpenStack离线安装系列—9.启动一个实例

未完待续。。。。。。


控制节点Horizon服务组件安装

官方参考:
OpenStack官方安装指南:服务组件
horizon-install
horizon-install-rdo
horizon-verify-rdo

博客:
CentOS7安装OpenStack(Rocky版)-07.安装horizon服务组件(控制节点dashboard)
OpenStack Train版-10.安装horizon服务(计算节点)
OpenStack Train版-安装部署教程

一、服务说明

OpenStack仪表板Dashboard服务的项目名称是Horizon,它所需的唯一服务是身份服务keystone,开发语言是python的web框架Django。
从Stein版本开始,Horizon支持以下服务:

  • cinder:块状存储
  • glance:镜像管理
  • neutron:网络
  • nova:计算
  • swift:对象存储

如果已配置好服务keystone的endpoint,那么Horizon将对其进行检测并自动启用其支持。
Horizon还通过插件支持更多其他OpenStack服务。

注:
①可以选择在计算节点(compute01)上安装仪表板服务horizon。由于horizon运行需要apache,为了不影响控制节点上的keystone等其他服务使用的apache,亦可在计算节点上安装。
②安装之前确认以前安装的服务是否正常启动。

③本系列教程是在控制节点安装。

二、安装与配置dashboard相关软件

yum install openstack-dashboard -y

三、配置文件修改

(1)/etc/openstack-dashboard/local_settings
检查确认有以下配置

  • 方法一
vim /etc/openstack-dashboard/local_settings
ALLOWED_HOSTS = ['*', ]
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 2,
}
OPENSTACK_HOST = "controller"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "default"

CACHES = {
    'default': {
         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
         'LOCATION': 'controller:11211',
    }
}

OPENSTACK_NEUTRON_NETWORK = {
    'enable_router': False,
    'enable_quotas': False,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_fip_topology_check': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_vpn': False,
}

TIME_ZONE = "Asia/Shanghai"
  • 方法二
# 其他方式
sed -i.bak '/^OPENSTACK_HOST/s#127.0.0.1#controller#' /etc/openstack-dashboard/local_settings
sed -i '/^OPENSTACK_KEYSTONE_DEFAULT_ROLE/s#".*"#"user"#' /etc/openstack-dashboard/local_settings
sed -i "/^ALLOWED_HOSTS/s#\[.*\]#['*']#" /etc/openstack-dashboard/local_settings
sed -i '/^#SESSION_ENGINE/s/#//' /etc/openstack-dashboard/local_settings
sed -i "/^SESSION_ENGINE/s#'.*'#'django.contrib.sessions.backends.cache'#" /etc/openstack-dashboard/local_settings

OPENSTACK_KEYSTONE_BACKEND = {
215     'name': 'native',
216     'can_edit_user': True,
217     'can_edit_group': True,
218     'can_edit_project': True,
219     'can_edit_domain': True,
220     'can_edit_role': True,
221 }

注:注意一些python语法格式。

  • 方法三

将配置文件写好,先备份原文件,然后直接替换。

cp -a /etc/openstack-dashboard/local_settings{,.bak}
/bin/cp -rf  ./local_settings /etc/openstack-dashboard/local_settings

(2)openstack-dashboard.conf/etc/httpd/conf.d/openstack-dashboard.conf
如果没有则新添加

vim /etc/httpd/conf.d/openstack-dashboard.conf
#add follow
WSGIApplicationGroup %{GLOBAL}

(3)重启Apache服务、会话存储服务

systemctl restart httpd.service memcached.service
systemctl status httpd.service memcached.service
#由于dashboard的运行机制是把网站下的所有文件删除之后再重新复制,所以重启httpd需要等待一段时间。  

此时,dashboard虽可以访问,且url中不许哟啊输入dashboard。但是在进行系统的项目管理的时候打不开页面会报错。
下面将重建并修改配置openstack-dashboard.conf。

# sw 'Rebuild openstack-dashboard.conf'
cd /usr/share/openstack-dashboard
python manage.py make_web_conf --apache > /etc/httpd/conf.d/openstack-dashboard.conf

ln -s /etc/openstack-dashboard /usr/share/openstack-dashboard/openstack_dashboard/conf

cp -a /usr/share/openstack-dashboard/openstack_dashboard/defaults.py{,.bak}
cp -a /usr/share/openstack-dashboard/openstack_dashboard/test/settings.py{,.bak}
cp -a /usr/share/openstack-dashboard/static/dashboard/js/9937cc9f2cae.js{,.bak}

# sw 'Change WEBROOT'
#vim /usr/share/openstack-dashboard/openstack_dashboard/defaults.py
#line32
#WEBROOT = '/'  # from openstack_auth
sed -i "32c WEBROOT = '/dashboard'  # from openstack_auth" /usr/share/openstack-dashboard/openstack_dashboard/defaults.py

#vim /usr/share/openstack-dashboard/openstack_dashboard/test/settings.py
#line32
#WEBROOT = '/'
sed -i "32c WEBROOT = '/dashboard'" /usr/share/openstack-dashboard/openstack_dashboard/test/settings.py

#vim /usr/share/openstack-dashboard/static/dashboard/js/9937cc9f2cae.js
#line1
#var STATIC_URL="/dashboard/static/";var WEBROOT="/";/*!
sed -i '1c var STATIC_URL="/dashboard/static/";var WEBROOT="/dashboard/";/*!' /usr/share/openstack-dashboard/static/dashboard/js/9937cc9f2cae.js

# sw 'Configuration of /etc/httpd/conf.d/openstack-dashboard.conf'
cp -a  /etc/httpd/conf.d/openstack-dashboard.conf{,.bak}
#sed -in '3a WSGIApplicationGroup %{GLOBAL}' /etc/httpd/conf.d/openstack-dashboard.conf
sed -i '19c WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi' /etc/httpd/conf.d/openstack-dashboard.conf
sed -i '20c WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi' /etc/httpd/conf.d/openstack-dashboard.conf
sed -i '25c Alias /dashboard/static /usr/share/openstack-dashboard/static' /etc/httpd/conf.d/openstack-dashboard.conf

systemctl restart httpd.service memcached.service
systemctl status httpd.service memcached.service

source /root/admin-openrc
openstack flavor create --id 0 --vcpus 1 --ram 256 --disk 0 1U256M0G
openstack flavor create --id 1 --vcpus 1 --ram 1024 --disk 0 1U1GM0G
openstack flavor list

四、官方步骤安装Train版本,常见问题

https://blog.csdn.net/weixin_28738845/article/details/103348658

https://www.cnblogs.com/omgasw/p/11990435.html

https://blog.51cto.com/11694088/2460460?cid=742064

https://yinwucheng.com/?p=478

https://yinwucheng.com/?p=489

https://www.cnblogs.com/omgasw/p/12016839.html

https://blog.csdn.net/weixin_42758707/article/details/100055061

1.访问/dashboard后跳转到/auth/login报404(操作下面2步可以解决dashboard访问404问题,请跳过此步骤)
解决方法:重建Apache服务的dashboard配置文件

cd /usr/share/openstack-dashboard
python manage.py make_web_conf --apache > /etc/httpd/conf.d/openstack-dashboard.conf

2.登录到dashboard将出现权限错误
解决方法如下:建立策略文件(policy.json)的软链接

ln -s /etc/openstack-dashboard /usr/share/openstack-dashboard/openstack_dashboard/conf

3.身份管理里面的项目、用户、组和角色都无法打开
日志提示:Daemon process called ‘keystone-public’ cannot be accessed by this WSGI application: /usr/bin/keystone-wsgi-public
编辑以下文件,找到WEBROOT = ‘/’ 修改为WEBROOT = ‘/dashboard’ (官方未提及坑点之一)

vim /usr/share/openstack-dashboard/openstack_dashboard/defaults.py
vim /usr/share/openstack-dashboard/openstack_dashboard/test/settings.py
vim /usr/share/openstack-dashboard/static/dashboard/js/9937cc9f2cae.js

4.重启Apache服务、会话存储服务

systemctl restart httpd.service memcached.service
systemctl status httpd.service memcached.service

5.检查dashboard是否可用
浏览器直接访问:http://192.168.232.101 地址后面不需要加dashboard。
是否需要输入域default取决于,OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT的值
域:default;用户名:admin;密码:admin。

修改WEBROOT


  737  2020/04/26-14:17:43 by root: vim /usr/share/openstack-dashboard/static/dashboard/js/9937cc9f2cae.js
  738  2020/04/26-14:18:18 by root: vim /usr/share/openstack-dashboard/static/dashboard/js/64d85423c263.js
  739  2020/04/26-14:18:29 by root: vim /usr/share/openstack-dashboard/static/dashboard/js/b5e88d434bd1.js

修改httpd

  741  2020/04/26-14:19:45 by root: vim /etc/httpd/conf.d/openstack-dashboard.conf
#    WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi.py
    WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
    WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
#    Alias /static /usr/share/openstack-dashboard/static
     Alias /dashboard/static /usr/share/openstack-dashboard/static

修改local_settings

749  2020/04/26-14:26:50 by root: vim /etc/openstack-dashboard/local_settings

中的角色配置要与建立相关。
6.keystone创建的时候角色名称修改为_member_

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 数字20 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读