跳转至

8. 安装仪表盘服务horizon

0. 介绍

# Dashboard(horizon)是一个web的接口,使得云平台管理员以及用户可以管理不同的openstack资源以及服务
# 它是使用django框架开发的,它没有自己的数据库、web页面展示,全程依赖调用其他服务的api

1. 安装

#compute1

yum install openstack-dashboard python-memcached -y

2. 修改配置文件

vim /etc/openstack-dashboard/local_settings
#根据官网文档修改,略

1. 导入老师的配置文件

#1.从老师课件中找到配置文件并上传

#2.备份原来的配置文件
cp /etc/openstack-dashboard/local_settings{,.bak}

#3.导入配置文件
cat local_settings > /etc/openstack-dashboard/local_settings

2. 查看配置文件

cat /etc/openstack-dashboard/local_settings
[root@compute1 ~]# cat /etc/openstack-dashboard/local_settings|grep -Ev '^#|^$' |cat -n
     1  import os
     2  from django.utils.translation import ugettext_lazy as _
     3  from openstack_dashboard import exceptions
     4  from openstack_dashboard.settings import HORIZON_CONFIG
     5  DEBUG = False
     6  TEMPLATE_DEBUG = DEBUG
     7  WEBROOT = '/dashboard/'
     8  ALLOWED_HOSTS = ['*', ]
     9  OPENSTACK_API_VERSIONS = {
    10      "identity": 3,
    11      "image": 2,
    12      "volume": 2,
    13      "compute": 2,
    14  }
    15  OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
    16  OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'default'
    17  LOCAL_PATH = '/tmp'
    18  SECRET_KEY='65941f1393ea1c265ad7'
    19  SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
    20  CACHES = {
    21      'default': {
    22          'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
    23          'LOCATION': 'controller:11211',
    24      },
    25  }
    26  EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
    27  OPENSTACK_HOST = "controller"
    28  OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
    29  OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
    30  OPENSTACK_KEYSTONE_BACKEND = {
    31      'name': 'native',
    32      'can_edit_user': True,
    33      'can_edit_group': True,
    34      'can_edit_project': True,
    35      'can_edit_domain': True,
    36      'can_edit_role': True,
    37  }
    38  OPENSTACK_HYPERVISOR_FEATURES = {
    39      'can_set_mount_point': False,
    40      'can_set_password': False,
    41      'requires_keypair': False,
    42  }
    43  OPENSTACK_CINDER_FEATURES = {
    44      'enable_backup': False,
    45  }
    46  OPENSTACK_NEUTRON_NETWORK = {
    47      'enable_router': False,
    48      'enable_quotas': False,
    49      'enable_ipv6': False,
    50      'enable_distributed_router': False,
    51      'enable_ha_router': False,
    52      'enable_lb': False,
    53      'enable_firewall': False,
    54      'enable_vpn': False,
    55      'enable_fip_topology_check': False,
    56      # Neutron can be configured with a default Subnet Pool to be used for IPv4
    57      # subnet-allocation. Specify the label you wish to display in the Address
    58      # pool selector on the create subnet step if you want to use this feature.
    59      'default_ipv4_subnet_pool_label': None,
    60      # Neutron can be configured with a default Subnet Pool to be used for IPv6
    61      # subnet-allocation. Specify the label you wish to display in the Address
    62      # pool selector on the create subnet step if you want to use this feature.
    63      # You must set this to enable IPv6 Prefix Delegation in a PD-capable
    64      # environment.
    65      'default_ipv6_subnet_pool_label': None,
    66      # The profile_support option is used to detect if an external router can be
    67      # configured via the dashboard. When using specific plugins the
    68      # profile_support can be turned on if needed.
    69      'profile_support': None,
    70      #'profile_support': 'cisco',
    71      # Set which provider network types are supported. Only the network types
    72      # in this list will be available to choose from when creating a network.
    73      # Network types include local, flat, vlan, gre, and vxlan.
    74      'supported_provider_types': ['*'],
    75      # Set which VNIC types are supported for port binding. Only the VNIC
    76      # types in this list will be available to choose from when creating a
    77      # port.
    78      # VNIC types include 'normal', 'macvtap' and 'direct'.
    79      # Set to empty list or None to disable VNIC type selection.
    80      'supported_vnic_types': ['*'],
    81  }
    82  OPENSTACK_HEAT_STACK = {
    83      'enable_user_pass': True,
    84  }
    85  IMAGE_CUSTOM_PROPERTY_TITLES = {
    86      "architecture": _("Architecture"),
    87      "kernel_id": _("Kernel ID"),
    88      "ramdisk_id": _("Ramdisk ID"),
    89      "image_state": _("Euca2ools state"),
    90      "project_id": _("Project ID"),
    91      "image_type": _("Image Type"),
    92  }
    93  IMAGE_RESERVED_CUSTOM_PROPERTIES = []
    94  API_RESULT_LIMIT = 1000
    95  API_RESULT_PAGE_SIZE = 20
    96  SWIFT_FILE_TRANSFER_CHUNK_SIZE = 512 * 1024
    97  DROPDOWN_MAX_ITEMS = 30
    98  TIME_ZONE = "Asia/Shanghai"
    99  POLICY_FILES_PATH = '/etc/openstack-dashboard'
   100  LOGGING = {
   101      'version': 1,
   102      # When set to True this will disable all logging except
   103      # for loggers specified in this configuration dictionary. Note that
   104      # if nothing is specified here and disable_existing_loggers is True,
   105      # django.db.backends will still log unless it is disabled explicitly.
   106      'disable_existing_loggers': False,
   107      'handlers': {
   108          'null': {
   109              'level': 'DEBUG',
   110              'class': 'logging.NullHandler',
   111          },
   112          'console': {
   113              # Set the level to "DEBUG" for verbose output logging.
   114              'level': 'INFO',
   115              'class': 'logging.StreamHandler',
   116          },
   117      },
   118      'loggers': {
   119          # Logging from django.db.backends is VERY verbose, send to null
   120          # by default.
   121          'django.db.backends': {
   122              'handlers': ['null'],
   123              'propagate': False,
   124          },
   125          'requests': {
   126              'handlers': ['null'],
   127              'propagate': False,
   128          },
   129          'horizon': {
   130              'handlers': ['console'],
   131              'level': 'DEBUG',
   132              'propagate': False,
   133          },
   134          'openstack_dashboard': {
   135              'handlers': ['console'],
   136              'level': 'DEBUG',
   137              'propagate': False,
   138          },
   139          'novaclient': {
   140              'handlers': ['console'],
   141              'level': 'DEBUG',
   142              'propagate': False,
   143          },
   144          'cinderclient': {
   145              'handlers': ['console'],
   146              'level': 'DEBUG',
   147              'propagate': False,
   148          },
   149          'keystoneclient': {
   150              'handlers': ['console'],
   151              'level': 'DEBUG',
   152              'propagate': False,
   153          },
   154          'glanceclient': {
   155              'handlers': ['console'],
   156              'level': 'DEBUG',
   157              'propagate': False,
   158          },
   159          'neutronclient': {
   160              'handlers': ['console'],
   161              'level': 'DEBUG',
   162              'propagate': False,
   163          },
   164          'heatclient': {
   165              'handlers': ['console'],
   166              'level': 'DEBUG',
   167              'propagate': False,
   168          },
   169          'ceilometerclient': {
   170              'handlers': ['console'],
   171              'level': 'DEBUG',
   172              'propagate': False,
   173          },
   174          'swiftclient': {
   175              'handlers': ['console'],
   176              'level': 'DEBUG',
   177              'propagate': False,
   178          },
   179          'openstack_auth': {
   180              'handlers': ['console'],
   181              'level': 'DEBUG',
   182              'propagate': False,
   183          },
   184          'nose.plugins.manager': {
   185              'handlers': ['console'],
   186              'level': 'DEBUG',
   187              'propagate': False,
   188          },
   189          'django': {
   190              'handlers': ['console'],
   191              'level': 'DEBUG',
   192              'propagate': False,
   193          },
   194          'iso8601': {
   195              'handlers': ['null'],
   196              'propagate': False,
   197          },
   198          'scss': {
   199              'handlers': ['null'],
   200              'propagate': False,
   201          },
   202      },
   203  }
   204  SECURITY_GROUP_RULES = {
   205      'all_tcp': {
   206          'name': _('All TCP'),
   207          'ip_protocol': 'tcp',
   208          'from_port': '1',
   209          'to_port': '65535',
   210      },
   211      'all_udp': {
   212          'name': _('All UDP'),
   213          'ip_protocol': 'udp',
   214          'from_port': '1',
   215          'to_port': '65535',
   216      },
   217      'all_icmp': {
   218          'name': _('All ICMP'),
   219          'ip_protocol': 'icmp',
   220          'from_port': '-1',
   221          'to_port': '-1',
   222      },
   223      'ssh': {
   224          'name': 'SSH',
   225          'ip_protocol': 'tcp',
   226          'from_port': '22',
   227          'to_port': '22',
   228      },
   229      'smtp': {
   230          'name': 'SMTP',
   231          'ip_protocol': 'tcp',
   232          'from_port': '25',
   233          'to_port': '25',
   234      },
   235      'dns': {
   236          'name': 'DNS',
   237          'ip_protocol': 'tcp',
   238          'from_port': '53',
   239          'to_port': '53',
   240      },
   241      'http': {
   242          'name': 'HTTP',
   243          'ip_protocol': 'tcp',
   244          'from_port': '80',
   245          'to_port': '80',
   246      },
   247      'pop3': {
   248          'name': 'POP3',
   249          'ip_protocol': 'tcp',
   250          'from_port': '110',
   251          'to_port': '110',
   252      },
   253      'imap': {
   254          'name': 'IMAP',
   255          'ip_protocol': 'tcp',
   256          'from_port': '143',
   257          'to_port': '143',
   258      },
   259      'ldap': {
   260          'name': 'LDAP',
   261          'ip_protocol': 'tcp',
   262          'from_port': '389',
   263          'to_port': '389',
   264      },
   265      'https': {
   266          'name': 'HTTPS',
   267          'ip_protocol': 'tcp',
   268          'from_port': '443',
   269          'to_port': '443',
   270      },
   271      'smtps': {
   272          'name': 'SMTPS',
   273          'ip_protocol': 'tcp',
   274          'from_port': '465',
   275          'to_port': '465',
   276      },
   277      'imaps': {
   278          'name': 'IMAPS',
   279          'ip_protocol': 'tcp',
   280          'from_port': '993',
   281          'to_port': '993',
   282      },
   283      'pop3s': {
   284          'name': 'POP3S',
   285          'ip_protocol': 'tcp',
   286          'from_port': '995',
   287          'to_port': '995',
   288      },
   289      'ms_sql': {
   290          'name': 'MS SQL',
   291          'ip_protocol': 'tcp',
   292          'from_port': '1433',
   293          'to_port': '1433',
   294      },
   295      'mysql': {
   296          'name': 'MYSQL',
   297          'ip_protocol': 'tcp',
   298          'from_port': '3306',
   299          'to_port': '3306',
   300      },
   301      'rdp': {
   302          'name': 'RDP',
   303          'ip_protocol': 'tcp',
   304          'from_port': '3389',
   305          'to_port': '3389',
   306      },
   307  }
   308  REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES',
   309                                'LAUNCH_INSTANCE_DEFAULTS']
[root@compute1 ~]#

3. 启动

systemctl start httpd.service

4. 验证

# http://192.168.178.31/dashboard
# 发现一直转圈,进不去!然后出现如下报错!

img_2.png

5. 解决办法

1. 修改配置文件

vim /etc/httpd/conf.d/openstack-dashboard.conf
#添加第4行内容  WSGIApplicationGroup %{GLOBAL}
[root@compute1 ~]# vim /etc/httpd/conf.d/openstack-dashboard.conf^C
[root@compute1 ~]#
[root@compute1 ~]#
[root@compute1 ~]# cat -n /etc/httpd/conf.d/openstack-dashboard.conf
     1  WSGIDaemonProcess dashboard
     2  WSGIProcessGroup dashboard
     3  WSGISocketPrefix run/wsgi
     4  WSGIApplicationGroup %{GLOBAL}
     5  WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
     6  Alias /dashboard/static /usr/share/openstack-dashboard/static
     7
     8  <Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
     9    Options All
    10    AllowOverride All
    11    Require all granted
    12  </Directory>
    13
    14  <Directory /usr/share/openstack-dashboard/static>
    15    Options All
    16    AllowOverride All
    17    Require all granted
    18  </Directory>
    19

2. 重启httpd服务

systemctl restart httpd

6. 再次验证

# 填入 域:default  用户名:admin 密码:ADMIN_PASS

img_3.png

#进入后,界面如下

img_4.png


最后更新: 2022-02-20 04:00:12