Openstack Ocata安装(Compute service)

一、安装
1.1创建nova_api和nova数据库
并授予对数据库的正确访问权限

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '123qwe';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '123qwe';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '123qwe';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123qwe';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '123qwe';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '123qwe';

1.2输入admin凭据以访问仅管理CLI命令,创建计算服务凭据,创建nova用户,将admin角色添加到nova用户,创建nova服务实体,创建Compute API服务端点,创建一个Placement服务用户,将Placement用户添加到具有管理角色的服务项目中,在服务目录中创建Placement API条目,创建Placement API服务端点

source /home/admin-openrc.sh
openstack user create --domain default --password-prompt nova
openstack role add --project service --user nova admin
openstack service create --name nova \
  --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne \
  compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne \
  compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne \
  compute admin http://controller:8774/v2.1
openstack user create --domain default --password-prompt placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://controller/placement
openstack endpoint create --region RegionOne placement internal http://controller/placement
openstack endpoint create --region RegionOne placement admin http://controller/placement

1.3 安装和配置组件

yum -y install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api

编辑/etc/nova/nova.conf

vi /etc/nova/nova.conf

在该[DEFAULT]部分中,仅启用计算和元数据API,
在[api_database]和[database]部分,配置数据库访问,
在本[DEFAULT]节中,配置RabbitMQ 消息队列访问,
在[api]和[keystone_authtoken]部分,配置身份服务访问,
在本[DEFAULT]节中,配置my_ip选项以使用控制器节点的管理接口IP地址,
在本[DEFAULT]节中,启用对网络服务的支持,
在本[vnc]节中,配置VNC代理以使用控制器节点的管理接口IP地址,
在本[glance]节中,配置Image Service API的位置,
在该[oslo_concurrency]部分中,配置锁定路径,
在本[placement]节中,配置Placement API,

[DEFAULT]

enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123qwe@controller
my_ip = 172.16.4.185
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[api]

auth_strategy = keystone

[keystone_authtoken]

auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123qwe

[api_database]

connection = mysql+pymysql://nova:123qwe@controller/nova_api

[database]

connection = mysql+pymysql://nova:123qwe@controller/nova

[vnc]
enabled = true

vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip

[glance]

api_servers = http://controller:9292

[oslo_concurrency]

lock_path = /var/lib/nova/tmp

[placement]

os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 123qwe

由于包装错误,您必须通过将以下配置添加到以下内容来启用对Placement API的访问

vi /etc/httpd/conf.d/00-nova-placement-api.conf
Listen 8778

<VirtualHost *:8778>
  WSGIProcessGroup nova-placement-api
  WSGIApplicationGroup %{GLOBAL}
  WSGIPassAuthorization On
  WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
  WSGIScriptAlias / /usr/bin/nova-placement-api
  <IfVersion >= 2.4>
    ErrorLogFormat "%M"
  </IfVersion>
  ErrorLog /var/log/nova/nova-placement-api.log
  #SSLEngine On
  #SSLCertificateFile ...
  #SSLCertificateKeyFile ...

#add
  <Directory />
    Options All
    AllowOverride All
    Require all granted
  </Directory>

  <Directory /usr/bin/nova-placement-api>
    Options All
    AllowOverride All
    Require all granted
  </Directory>

</VirtualHost>

填充nova-api数据库,
注册cell0数据库,
创建cell1单元格,
填充新星数据库,
验证新星cell0和cell1是否正确注册,

su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
109e1d4b-536a-40d0-83c6-5f121b82b650
su -s /bin/sh -c "nova-manage db sync" nova
nova-manage cell_v2 list_cells

启动Compute服务并将其配置为在系统启动时启动

# systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
# systemctl start openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service

二、安装和配置计算节点
2.1 安装软件包

yum install openstack-nova-compute

2.2 编辑/etc/nova/nova.conf文件
该[DEFAULT]部分中,仅启用计算和元数据API,
在本[DEFAULT]节中,配置RabbitMQ 消息队列访问,
在[api]和[keystone_authtoken]部分,配置身份服务访问,
在本[DEFAULT]节中,配置my_ip选项,
在本[DEFAULT]节中,启用对网络服务的支持,
在本[vnc]节中,启用和配置远程控制台访问,
在本[glance]节中,配置Image Service API的位置,
在该[oslo_concurrency]部分中,配置锁定路径,
在本[placement]节中,配置Placement API,

[DEFAULT]

enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123qwe@controller
my_ip = 172.16.4.185
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]

auth_strategy = keystone

[keystone_authtoken]

auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123qwe

[vnc]

enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

[glance]

api_servers = http://controller:9292

[oslo_concurrency]

lock_path = /var/lib/nova/tmp

[placement]

os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:35357/v3
username = placement
password = 123qwe

2.3 确定您的计算节点是否支持虚拟机的硬件加速

egrep -c '(vmx | svm)' / proc / cpuinfo

如果此命令返回0或者更大的数字,则您的计算节点支持硬件加速,通常不需要额外的配置。
否则,您必须配置libvirt 为使用QEMU而不是KVM。

vi /etc/nova/nova.conf
[libvirt] 

virt_type  =  qemu

2.4 启动Compute服务,包括其依赖关系,并将其配置为在系统引导时自动启动

# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service

2.5 验证
输入管理员凭据以启用仅管理CLI命令,然后确认数据库中有计算主机

source /home/admin-opensrc.sh
openstack hypervisor list

发现计算机的主机

su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

输入admin凭据以访问仅管理CLI命令

source /home/admin-opensrc.sh

列出服务组件,以验证每个进程的成功启动和注册

openstack compute service list

在身份服务中列出API端点,以验证与身份服务的连接

openstack catalog list

在图像服务中列出图像以验证与图像服务的连接

openstack image list

你可能感兴趣的:(openstack,ocata,compute)