扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
用OpenStack计算来托管和管理云计算系统。OpenStack计算是基础设施即服务(IaaS)系统的重要组成部分。主要模块是用Python实现的。
OpenStack计算与OpenStack标识进行交互,用于身份验证,用于资源目录跟踪和选择的OpenStack放置,用于磁盘和服务器映像的OpenStack映像服务,以及用于用户和管理界面的OpenStack仪表板。图像访问受到项目和用户的限制;每个项目的配额是有限的(例如,实例的数量)。OpenStack计算可以在标准硬件上水平伸缩,并下载映像来启动实例。
OpenStack计算包括以下组件:
我们提供的服务有:成都网站设计、网站建设、微信公众号开发、网站优化、网站认证、靖江ssl等。为上千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的靖江网站制作公司
理论上,OpenStack计算可以支持SQLAlchemy支持的任何数据库。用于测试和开发工作的公共数据库是SQLite3、MySQL、MariaDB和PostgreSQL。
安装之前我们需要先建库,帐号和api endpoint.
○ 使用root连接数据库服务器:
$ mysql -u root -p root123
○ 建立nova_api、nova和nova_cell0数据库:
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
○ 赋予帐号nova对库的操作权限:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova123';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova123'
$ . admin-openrc
建立计算服务的凭据:
○ 建立nova用户:
$ openstack user create --domain default --password-prompt nova
User Password:nova123
Repeat User Password:nova123
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 8a7dbf5279404537b1c7b86c033620fe |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
○ 给用户nova添加admin角色:
$ openstack role add --project service --user nova admin
注意:这个命令没有输出
○ 建立nova服务实体:
$ openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 060d59eac51b4594815603d75a00aba2 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
Create the Compute API service endpoints:
$ openstack endpoint create --region RegionOne compute public http://stack.flex.net:8774/v2.1
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 3c1caa473bfe4390a11e7177894bcc7b |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 060d59eac51b4594815603d75a00aba2 |
| service_name | nova |
| service_type | compute |
| url | http://stack.flex.net:8774/v2.1 |
+--------------+-------------------------------------------+
$openstack endpoint create --region RegionOne compute internal http://stack.flex.net:8774/v2.1
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | e3c918de680746a586eac1f2d9bc10ab |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 060d59eac51b4594815603d75a00aba2 |
| service_name | nova |
| service_type | compute |
| url | http://stack.flex.net:8774/v2.1 |
+--------------+-------------------------------------------+
$ openstack endpoint create --region RegionOne compute admin http://stack.flex.net:8774/v2.1
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 38f7af91666a47cfb97b4dc790b94424 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 060d59eac51b4594815603d75a00aba2 |
| service_name | nova |
| service_type | compute |
| url | http://stack.flex.net:8774/v2.1 |
+--------------+-------------------------------------------+
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
编辑/etc/nova/nova.conf文件完成下列需求:
○ 在[DEFAULT]区域, 充计compute和元数据API:
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
○ 在[api_database] 和 [database] sections,配置数据库的访问:
[api_database]
# ...
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova_api
[database]
# ...
connection = mysql+pymysql://nova:nova123@dbs.flex.net/nova
○ 在[DEFAULT]区域, 配置RabbitMQ消息队列访问:
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack123@dbs.flex.net
○ 在[api]和[keystone_authtoken]区域, 配置访问认证服务:
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_url = http://stack.flex.net:5000/v3
memcached_servers = dbs.flext.net:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova123
注意: 注释或移除在掉在[keystone_authtoken]区域中的其它的选项.
○ 在[DEFAULT]区域, 配置管理接口的IP:
[DEFAULT]
# ...
my_ip = 192.168.207.2 #此处为控制节点的管理IP地址
○ 在[DEFAULT]区域, 充许支持的网络:
[DEFAULT]
# ...
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
缺省的,计算节点使用一内部的防火墙驱动,因为网络服务包含了一个防火墙驱动,你必须禁用防火墙驱动并使用nova.virt.firewall.NoopFirewallDriver firewall driver
○ 在[vnc]区域, 使用管理接口的IP做为vnc代理使用:
[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip
○ 在[glance]区域, 配置镜像服务api的位置:
[glance]
# ...
api_servers=http://stack.flex.net:9292
○ 在[oslo_concurrency]区域, 配置锁定的路径:
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
○ 在[placement]区域, 配置访问placement服务:
[placement]
# ...
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://stack.flex.net:5000/v3
username = placement
password = placement123
注意: 注释或移除在掉在[placement]区域中的其它的选项
○ 由于一个bug, 你必须充许访问placement API, 添加下列的配置到/etc/httpd/conf.d/00-nova-placement-api.conf:
= 2.4>
Require all granted
Order allow,deny
Allow from all
○ Restart the httpd service:
# systemctl restart httpd
# 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
# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+
| Name | UUID |
+-------+--------------------------------------+
| cell1 | 109e1d4b-536a-40d0-83c6-5f121b82b650 |
| cell0 | 00000000-0000-0000-0000-000000000000 |
+-------+--------------------------------------+
○ 允许系统引导时自动启动服务并启动服务:
# systemctl enable openstack-nova-api.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
# systemctl start openstack-nova-api.service \
openstack-nova-scheduler.service \
openstack-nova-conductor.service \
openstack-nova-novncproxy.service
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流