openstackO版配置nova计算服务
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
因为努力和真诚,有更多的客户和我们聚集在一起,为了共同目标,成都创新互联公司在工作上密切配合,从创业型企业到如今不断成长,要感谢客户对我们的高要求,让我们敢于面对挑战,才有今天的进步与发展。从网站到小程序制作,软件开发,成都app开发,十多年企业网站建设服务经验,为企业提供网站设计,成都网站托管一条龙服务.为企业提供成都全网营销推广,定制设计,原创设计,十多年品质,值得您的信赖.
[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
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
Order allow,deny
Allow from all
Require all granted
ErrorLogFormat "%M"
ErrorLog /var/log/nova/nova-placement-api.log
Alias /nova-placement-api /usr/bin/nova-placement-api
SetHandler wsgi-script
Options +ExecCGI
WSGIProcessGroup nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
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,操作更方便哦
当前标题:openstackO版配置nova计算服务
网站链接:http://hbruida.cn/article/jdhgji.html