第八步:安装openstack-dashboard

安装dashboard

https://docs.openstack.org/horizon/train/install/install-rdo.html #T版dashboard安装参考

openstack dashboard是使用django语言开发的;
openstack dashboard监听端口为80;

1、yum install openstack-dashboard -y   #安装在controller节点

2、vim /etc/openstack-dashboard/local_settings
OPENSTACK_HOST = "172.31.7.101"   
#指定为本机的监听地址

ALLOWED_HOSTS = ['172.31.7.101', 'openstack-vip.linux.local']
#只允许通过列表中指定的域名访问dashboard;允许通过指定的IP地址及域名访问dahsboard;['*']表示允许所有域名

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'  #指定session引擎
CACHES = {
    'default': {
         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
         'LOCATION': 'openstack-vip.linux.local:11211',  #指定memcache地址及端口
    } 
}
#配置session信息存放到memcache中;session信息不仅可以存放到memcache中,也可以存放到其他地方,参考文档:https://docs.openstack.org/horizon/latest/admin/sessions.html

OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
#配置keystone认证的API版本为v3

OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
#让dashboard支持域

OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 3,
}
#配置openstack的API版本

OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"
#设置keystone的默认域为default

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
#指定通过dashboard创建用户的权限为user role的权限,而不是admin role权限

OPENSTACK_NEUTRON_NETWORK = {
    'enable_router': False,
    'enable_quotas': False,     
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_vpn': False,
    'enable_fip_topology_check': False,
}
#如果使用的网络为二层网络,则关闭3层网络服务

TIME_ZONE = "Asia/Shanghai"
#修改时区

WEBROOT = '/dashboard'
#指定跟目录;如果不配置此项,则无法通过apache访问dashboard;当通过浏览器访问 http://172.31.7.101/dashboard 时会报404错误;告诉django程序,根目录为/dashboard,否则就会到 / 目录下做认证

3、vim /etc/httpd/conf.d/openstack-dashboard.conf
WSGIDaemonProcess dashboard
WSGIProcessGroup dashboard
WSGISocketPrefix run/wsgi
WSGIApplicationGroup %{GLOBAL}

4、systemctl restart httpd.service  
#dashboard服务是通过apache监听的,dashboard会把配置文件放到apache的配置文件目录,即 /etc/httpd/conf.d/openstack-dashboard.conf

5、http://172.31.7.101/dashboard    
#浏览器访问;域为配置文件中设置的default,用户名和密码可以使用admin用户登录或者myuser用户登录

6、在dashboard上创建个user角色,否则无法创建项目

haproxy配置

1、vim /etc/haproxy/haproxy.cfg
listen openstack-dashboard-80
 mode tcp
 bind 172.31.7.248:80
 server 172.31.7.101 172.31.7.101:80 check inter 3s fall 3 rise 5
 
2、systemctl restart haproxy.service 
posted on 2020-07-14 16:46  An.amazing.rookie  阅读(657)  评论(0编辑  收藏  举报