OpenStack6Nova服务部署(controller节点部署)

此文续接上一篇——OpenStack5安装Nova子模块placement,继续部署openstack,本节开始部署controller节点上的Nova。

在controller节点上安装Nova主服务、Nova调度服务、Nova数据库服务等。

(此前已经解释过的命令,在本章节不再注解,如有需要可以回看OpenStack3部署keystone组件等靠前的章节。)


一、创库授权

分别创建nova_api、nova、cell0并授予权限。

[root@controller ~]# mysql -u root -p#输入密码进入数据库
Enter password: 

MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> create database nova_cell0;#创建nova_api;nova;nova_cell0三个数据库
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]>  grant all privileges on nova_api .* to 'nova'@'localhost' identified by 'nv123';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> grant all privileges on nova_api .* to 'nova'@'%' identified by 'nv123';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]>  grant all privileges on nova .* to 'nova'@'localhost' identified by 'nv123';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> grant all privileges on nova .* to 'nova'@'%' identified by 'nv123';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> grant all privileges on nova_cell0 .* to 'nova'@'localhost' identified by 'nv123';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> grant all privileges on nova_cell0 .* to 'nova'@'%' identified by 'nv123';#授予权限
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> flush privileges;#清空并重新加载访问权限
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]>select user,host from mysql.user;#验证

二、创建nova用户与服务

. admin-openrc#运行脚本

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

三、创建nova api端点

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

#public:可以从外部访问的URL,internal仅在内部网络可以访问的URL,admin:仅管理员可以使用的URL

四、安装软件包

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

五、修改配置文件

编辑/etc/nova/nova.conf并添加以下内容(可以先设置行号)

enabled_apis=osapi_compute,metadata

transport_url=rabbit://openstack:rb123@controller

my_ip=192.168.154.31

#其中192.168.154.31是当前主机ip

use_neutron=true

firewall_driver=nova.virt.firewall.NoopFirewallDriver

auth_strategy=keystone

connection=mysql+pymysql://nova:nv123@controller/nova_api

#其中的nv123是刚才创建user时设置的密码(根据自己的设定来写)

connection=mysql+pymysql://nova:nv123@controller/nova

#其中的nv123是刚才创建user时设置的密码(根据自己的设定来写)

api_servers=http://controller:9292

www_authenticate_uri=http://controller:9292

auth_url=http://controller:5000/v3

memcached_servers=controller:11211

auth_type=password

project_domain_name=Default

user_domain_name=Default

project_name=service

username=nova

password=nv123

lock_path=/var/lib/nova/temp

region_name=RegionOne

project_domain_name=Default

project_name=service

auth_url=http://controller:5000/v3

auth_type=password

user_domain_name=Default

username=placement

password=pl123

discover_hosts__in_cells_interval=300

enabled=true

server_listen=$my_ip

server_proxyclient_address=$my_ip

编辑完成后保存退出

六、验证、同步

 su -s /bin/sh -c "nova-manage api_db sync" nova

#验证

mysql -unova -pnv123 -e "use nova_api;show tables;"

#注册cell0数据库,创建cell单元

 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

初始化

su -s /bin/sh -c "nova-manage db sync" nova

检查确认

 su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

验证数据库

mysql -unova -pnv123 -e "use nova_api;show tables;"

mysql -uplacement -ppl123 -e "use placement;show tables;"

七、启动服务并设置开机自启

systemctl start openstack-nova-api

systemctl start openstack-nova-scheduler

systemctl start openstack-nova-conductor

systemctl start openstack-nova-novncproxy

systemctl enable openstack-nova-api

systemctl enable openstack-nova-conductor

systemctl enable openstack-nova-novncproxy

systemctl enable openstack-nova-scheduler

自此controller节点的nova服务部署OK!

  • 20
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值