前言:
仪表盘是一般项目的标配,有了仪表盘可以降低运维工作,并且很多的管理工作是可以可视化的。本节计划在控制节点安装openstack官网的仪表盘项目
openstack由于是一个开源的社区版本云计算项目,因此,它的web仪表盘是非常多得:
一,
安装dashboard WEB控制台
有两种安装方式一种是yum安装方式,一种是源码安装方式,在官网文档里都有所介绍,本文采用最简单的yum安装方式
官网文档:OpenStack Docs: Install and configure for Red Hat Enterprise Linux and CentOS
###注,dashboard是安装在控制节点(192.168.123.130)的,此项目是Django项目,比较占用内存,因此,内存至少需要8G
1,Install the packages:
yum install openstack-dashboard -y
2,
修改配置文件/etc/openstack-dashboard/local_settings
- Configure the dashboard to use OpenStack services on the
controller
node:
OPENSTACK_HOST = "openstack1"
#可以使用IP
- Allow your hosts to access the dashboard:
ALLOWED_HOSTS = ['*',]
#ALLOWED_HOSTS = ['openstack1','openstack2',] 这样也是可以的
- Configure the
memcached
session storage service:
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
#这一行新增
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'openstack1:11211',
}
}
#修改LOCATION为openstack1
- Enable the Identity API version 3:
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
- Enable support for domains:
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
#keystone多域设置,修改成True,注意大写T
- Configure API versions:
OPENSTACK_API_VERSIONS = {
"identity": 3,
"image": 2,
"volume": 2,
}
- Configure
Default
as the default domain for users that you create via the dashboard:
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"
#这里必须是default
- Configure
user
as the default role for users that you create via the dashboard:
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "admin"
#
[root@openstack1 ~]# openstack role list +----------------------------------+--------+ | ID | Name | +----------------------------------+--------+ | 89a2eb8f61ea44ec9d955ee33a0f7206 | member | | c3123014d1f5438e9abd182d1bf40850 | reader | | e90643cb08c946ffba1e69692b8a5baf | admin | +----------------------------------+--------+
#查出来的三个role里选一个使用,因为没有user这个角色
- If you chose networking option 1, disable support for layer-3 networking services:
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,
}
#以OPENSTACK_NEUTRON_NETWORK为关键字搜索,直接花括号里面的内容替换掉
- Optionally, configure the time zone:
TIME_ZONE = "Asia/Shanghai"
#时区这个没什么好说的,必定是这个啦
- Add the following line to
/etc/httpd/conf.d/openstack-dashboard.conf
if not included.
WSGIApplicationGroup %{GLOBAL}
整个文件是这样的,加到第四行即可:
[root@openstack1 ~]# cat /etc/httpd/conf.d/openstack-dashboard.conf WSGIDaemonProcess dashboard WSGIProcessGroup dashboard WSGISocketPrefix run/wsgi WSGIApplicationGroup %{GLOBAL} WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi Alias /dashboard/static /usr/share/openstack-dashboard/static <Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi> Options All AllowOverride All Require all granted </Directory> <Directory /usr/share/openstack-dashboard/static> Options All AllowOverride All Require all granted </Directory>
二,
登陆web仪表盘
账号是admin,密码是PASSWORD,登陆的URL是192.168.123.130/dashboard
因为openrc文件的内容是这个:
[root@openstack1 ~]# cat admin_rc.sh export OS_PROJECT_DOMAIN_NAME=Default export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=PASSWORD export OS_AUTH_URL=http://openstack1:5000/v3 export OS_IDENTITY_API_VERSION=3 export OS_IMAGE_API_VERSION=2