备注:由于horizon运行需要apache,为了不影响控制节点上的keystone等其他服务使用的apache,故在计算节点(或其他节点如glance服务、neutron服务等)上安装。安装之前确认以前安装的服务是否正常启动。
1、安装配置组件
yum install openstack-dashboard -y
修改配置文件 /etc/openstack-dashboard/local_settings:(下面列出了此文件的全部内容)
import os
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard.settings import HORIZON_CONFIG
DEBUG = False
ALLOWED_HOSTS = [‘*‘]
LOCAL_PATH = ‘/tmp‘
SECRET_KEY=‘1326dfebd8b78f5ec568‘
SESSION_ENGINE = ‘django.contrib.sessions.backends.cache‘
CACHES = {
‘default‘: {
‘BACKEND‘: ‘django.core.cache.backends.memcached.MemcachedCache‘,
‘LOCATION‘: ‘controller:11211‘,
},
}
EMAIL_BACKEND = ‘django.core.mail.backends.console.EmailBackend‘
OPENSTACK_HOST = "controller"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {
"identity": 3,
"image": 2,
"volume": 3,
}
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_NEUTRON_NETWORK = {
‘enable_auto_allocated_network‘: False,
‘enable_distributed_router‘: False,
‘enable_fip_topology_check‘: True,
‘enable_ha_router‘: False,
‘enable_ipv6‘: True,
‘enable_quotas‘: False,
‘enable_rbac_policy‘: True,
‘enable_router‘: False,
‘enable_lb‘: False,
‘enable_firewall‘: False,
‘enable_***‘: False,
‘default_dns_nameservers‘: [],
‘supported_provider_types‘: [‘*‘],
‘segmentation_id_range‘: {},
‘extra_provider_types‘: {},
‘supported_vnic_types‘: [‘*‘],
‘physical_networks‘: [],
}
TIME_ZONE = "Asia/Shanghai"
LOGGING = {
‘version‘: 1,
‘disable_existing_loggers‘: False,
‘formatters‘: {
‘console‘: {
‘format‘: ‘%(levelname)s %(name)s %(message)s‘
},
‘operation‘: {
‘format‘: ‘%(message)s‘
},
},
‘handlers‘: {
‘null‘: {
‘level‘: ‘DEBUG‘,
‘class‘: ‘logging.NullHandler‘,
},
‘console‘: {
‘level‘: ‘DEBUG‘ if DEBUG else ‘INFO‘,
‘class‘: ‘logging.StreamHandler‘,
‘formatter‘: ‘console‘,
},
‘operation‘: {
‘level‘: ‘INFO‘,
‘class‘: ‘logging.StreamHandler‘,
‘formatter‘: ‘operation‘,
},
},
‘loggers‘: {
‘horizon‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘horizon.operation_log‘: {
‘handlers‘: [‘operation‘],
‘level‘: ‘INFO‘,
‘propagate‘: False,
},
‘openstack_dashboard‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘novaclient‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘cinderclient‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘keystoneauth‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘keystoneclient‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘glanceclient‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘neutronclient‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘swiftclient‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘oslo_policy‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘openstack_auth‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘django‘: {
‘handlers‘: [‘console‘],
‘level‘: ‘DEBUG‘,
‘propagate‘: False,
},
‘django.db.backends‘: {
‘handlers‘: [‘null‘],
‘propagate‘: False,
},
‘requests‘: {
‘handlers‘: [‘null‘],
‘propagate‘: False,
},
‘urllib3‘: {
‘handlers‘: [‘null‘],
‘propagate‘: False,
},
‘chardet.charsetprober‘: {
‘handlers‘: [‘null‘],
‘propagate‘: False,
},
‘iso8601‘: {
‘handlers‘: [‘null‘],
‘propagate‘: False,
},
‘scss‘: {
‘handlers‘: [‘null‘],
‘propagate‘: False,
},
},
}
SECURITY_GROUP_RULES = {
‘all_tcp‘: {
‘name‘: _(‘All TCP‘),
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘1‘,
‘to_port‘: ‘65535‘,
},
‘all_udp‘: {
‘name‘: _(‘All UDP‘),
‘ip_protocol‘: ‘udp‘,
‘from_port‘: ‘1‘,
‘to_port‘: ‘65535‘,
},
‘all_icmp‘: {
‘name‘: _(‘All ICMP‘),
‘ip_protocol‘: ‘icmp‘,
‘from_port‘: ‘-1‘,
‘to_port‘: ‘-1‘,
},
‘ssh‘: {
‘name‘: ‘SSH‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘22‘,
‘to_port‘: ‘22‘,
},
‘smtp‘: {
‘name‘: ‘SMTP‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘25‘,
‘to_port‘: ‘25‘,
},
‘dns‘: {
‘name‘: ‘DNS‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘53‘,
‘to_port‘: ‘53‘,
},
‘http‘: {
‘name‘: ‘HTTP‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘80‘,
‘to_port‘: ‘80‘,
},
‘pop3‘: {
‘name‘: ‘POP3‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘110‘,
‘to_port‘: ‘110‘,
},
‘imap‘: {
‘name‘: ‘IMAP‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘143‘,
‘to_port‘: ‘143‘,
},
‘ldap‘: {
‘name‘: ‘LDAP‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘389‘,
‘to_port‘: ‘389‘,
},
‘https‘: {
‘name‘: ‘HTTPS‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘443‘,
‘to_port‘: ‘443‘,
},
‘smtps‘: {
‘name‘: ‘SMTPS‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘465‘,
‘to_port‘: ‘465‘,
},
‘imaps‘: {
‘name‘: ‘IMAPS‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘993‘,
‘to_port‘: ‘993‘,
},
‘pop3s‘: {
‘name‘: ‘POP3S‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘995‘,
‘to_port‘: ‘995‘,
},
‘ms_sql‘: {
‘name‘: ‘MS SQL‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘1433‘,
‘to_port‘: ‘1433‘,
},
‘mysql‘: {
‘name‘: ‘MYSQL‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘3306‘,
‘to_port‘: ‘3306‘,
},
‘rdp‘: {
‘name‘: ‘RDP‘,
‘ip_protocol‘: ‘tcp‘,
‘from_port‘: ‘3389‘,
‘to_port‘: ‘3389‘,
},
}
2、重建Apache的dashboard文件
cd /usr/share/openstack-dashboard
python manage.py make_web_conf --apache > /etc/httpd/conf.d/openstack-dashboard.conf
重启服务:
systemctl restart httpd #计算节点
systemctl restart memcached #控制节点
3、友情提示
若出现不能正常访问,请操作以下步骤:
建立策略文件(policy.json)的软链接,否则登录到dashboard将出现权限错误和显示混乱
ln -s /etc/openstack-dashboard /usr/share/openstack-dashboard/openstack_dashboard/conf
4、登录验证
浏览器输入计算节点IP即可跳转到登录页面: