1.创建数据库,并且授权数据库,库名为:nova_api 用户名:nova 密码:devops
[root@controller ~]# mysql -uroot -pdevops
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 'devops';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api. TO 'nova'@"%" IDENTIFIED BY 'devops';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova. TO 'nova'@"localhost" IDENTIFIED BY 'devops';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova. TO 'nova'@"%" IDENTIFIED BY 'devops';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0. TO 'nova'@"localhost" IDENTIFIED BY 'devops';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0. TO 'nova'@"%" IDENTIFIED BY 'devops';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON . TO 'root'@'controller' IDENTIFIED BY 'devops';
MariaDB [(none)]> FLUSH PRIVILEGES;
2.[root@controller ~]# source admin-openrc
3.创建nova的keystone用户
[root@controller ~]# openstack user create --domain default nova --password devops
User Password: 密码为:devops
Repeat User Password: 密码为:devops
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | e651779d03cf4d53b14527bfaffa818a |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user nova admin
创建computer服务
[root@controller ~]# openstack service create --name nova --description "OpenStack Compute" compute
[root@controller ~]#openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1/%\(tenant_id\)s
4.安装nova的软件包
[root@controller ~]#yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-cert openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
修改nova配置文件
[root@controller ~]# cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
[root@controller ~]# >/etc/nova/nova.conf
[root@controller~]# cat /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
auth_strategy = keystone
my_ip = 192.168.0.111
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
transport_url = rabbit://openstack:devops@controller
[database]
connection = mysql+pymysql://nova:devops@controller/nova
[api_database]
connection = mysql+pymysql://nova:devops@controller/nova_api
[scheduler]
discover_hosts_in_cells_interval = -1
[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 = devops
service_token_roles_required = True
[vnc]
vncserver_listen = 192.168.0.111
vncserver_proxyclient_address = 192.168.0.111
[glance]
api_servers = http://controller:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
5.同步数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova
6.设置cell_v2关联上创建好的数据库nova_cell0
[root@controller ~]# nova-manage cell_v2 map_cell0 --database_connection mysql+pymysql://root:devops@controller/nova_cell0
7.创建一个常规cell,名字叫cell1,这个单元格里面将会包含计算节点
[root@controller ~]# nova-manage cell_v2 create_cell --verbose --name cell1 --database_connection mysql+pymysql://root:devops@controller/nova_cell0 --transport-url rabbit://openstack:devops@controller:5672/
8.检查部署是否正常
# nova-status upgrade check
9.创建和映射cell0,并将现有计算主机和实例映射到单元格中
[root@controller ~]# nova-manage cell_v2 simple_cell_setup
10.查看已经创建好的单元格列表
[root@controller ~]# nova-manage cell_v2 list_cells --verbose
注意,如果有新添加的计算节点,需要运行下面命令来发现,并且添加到单元格中
# nova-manage cell_v2 discover_hosts
[root@controller ~]# nova-status upgrade check
11.创建placement用户和placement 服务,从Ocata开始,需要安装配置placement参与nova调度了,不然虚拟机将无法创建!
[root@controller ~]# yum install -y openstack-nova-placement-api
[root@controller ~]# openstack user create --domain default placement --password devops
[root@controller ~]# openstack role add --project service --user placement admin
[root@controller ~]# openstack service create --name placement --description "OpenStack Placement" placement
创建placement endpoint
[root@controller ~]#openstack endpoint create --region RegionOne placement public http://controller:8778
[root@controller ~]#openstack endpoint create --region RegionOne placement admin http://controller:8778
[root@controller ~]#openstack endpoint create --region RegionOne placement internal http://controller:8778
把placement 整合到nova.conf里
[placement]
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 = devops
os_region_name = RegionOne
12.配置修改00-nova-placement-api.conf文件,这步没做创建虚拟机的时候会出现禁止访问资源的问题
[root@controller ~]#cd /etc/httpd/conf.d/
[root@controller ~]#cp 00-nova-placement-api.conf 00-nova-placement-api.conf.bak
[root@controller ~]#>00-nova-placement-api.conf
[root@controller conf.d]# cat 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
<Directory "/">
Order allow,deny
Allow from all
Require all granted
</Directory>
<IfVersion >= 2.4>
ErrorLogFormat "%M"
</IfVersion>
ErrorLog /var/log/nova/nova-placement-api.log
</VirtualHost>
Alias /nova-placement-api /usr/bin/nova-placement-api
<Location /nova-placement-api>
SetHandler wsgi-script
Options +ExecCGI
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
</Location>
13.重启下httpd服务
[root@controller ~]# systemctl restart httpd
检查下是否配置成功
# nova-status upgrade check
14.启动服务
[root@controller ~]# systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller ~]# systemctl restart openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller ~]# systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller ~]# systemctl list-unit-files |grep openstack-nova-
15.验证nova服务
[root@controller ~]# unset OS_TOKEN OS_URL
[root@controller ~]# source /root/admin-openrc
[root@controller ~]# nova service-list
[root@controller ~]# openstack endpoint list 查看endpoint list
所有的配置文件在百度云盘中:
链接:https://pan.baidu.com/s/1CnmKkFMTemv199ctgb5Oig
提取码:27om
复制这段内容后打开百度网盘手机App,操作更方便哦
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。