標籤(空格分隔): openstack系列mysql
- 一: nova 的部署
- 二: nova 驗證
###1.1 nova 數據庫建立sql
mysql -uroot -p flyfish225 CREATE DATABASE nova_api; CREATE DATABASE nova; CREATE DATABASE nova_cell0; CREATE DATABASE placement; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova'; GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'placement'; GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placement'; flush privileges; show databases; select user,host from mysql.user;
openstack user create --domain default --password=nova nova openstack user list
在keystone上將nova用戶配置爲admin角色並添加進service項目 openstack role add --project service --user nova admin
建立nova計算服務的實體 openstack service create --name nova --description "OpenStack Compute" compute openstack service list
建立計算服務的API端點(endpoint) 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 endpoint list
這個版本的nova增長了placement項目 一樣,建立並註冊該項目的服務證書 openstack user create --domain default --password=placement placement openstack role add --project service --user placement admin openstack service create --name placement --description "Placement API" placement
建立placement項目的endpoint(API端口) openstack endpoint create --region RegionOne placement public http://controller:8778 openstack endpoint create --region RegionOne placement internal http://controller:8778 openstack endpoint create --region RegionOne placement admin http://controller:8778 openstack endpoint list
在控制節點安裝nova相關服務 yum install openstack-nova-api openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy \ openstack-nova-scheduler openstack-nova-placement-api -y
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.0.11 openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron true openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:openstack@controller openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:nova@controller/nova_api openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:nova@controller/nova openstack-config --set /etc/nova/nova.conf placement_database connection mysql+pymysql://placement:placement@controller/placement openstack-config --set /etc/nova/nova.conf api auth_strategy keystone openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/v3 openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova openstack-config --set /etc/nova/nova.conf keystone_authtoken password nova openstack-config --set /etc/nova/nova.conf vnc enabled true openstack-config --set /etc/nova/nova.conf vnc server_listen '$my_ip' openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address '$my_ip' openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292 openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp openstack-config --set /etc/nova/nova.conf placement region_name RegionOne openstack-config --set /etc/nova/nova.conf placement project_domain_name Default openstack-config --set /etc/nova/nova.conf placement project_name service openstack-config --set /etc/nova/nova.conf placement auth_type password openstack-config --set /etc/nova/nova.conf placement user_domain_name Default openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3 openstack-config --set /etc/nova/nova.conf placement username placement openstack-config --set /etc/nova/nova.conf placement password placement openstack-config --set /etc/nova/nova.conf scheduler discover_hosts_in_cells_interval 300
egrep -v "^#|^$" /etc/nova/nova.conf
修改nova的虛擬主機配置文件 cp /etc/httpd/conf.d/00-nova-placement-api.conf /etc/httpd/conf.d/00-nova-placement-api.conf.bak vim /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 ... </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> # made by zhangyy <Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory> ------ systemctl restart httpd systemctl status httpd
至此,nova計算服務的軟件包安裝完成
nova_api有32張表,placement有32張表,nova_cell0有110張表,nova也有110張表 初始化nova-api和placement數據庫 su -s /bin/sh -c "nova-manage api_db sync" nova mysql -h10.0.0.11 -unova -pnova -e "use nova_api;show tables;" mysql -h10.0.0.11 -uplacement -pplacement -e "use placement;show tables;"
nova_api和placement都有32張表,區別在於nova_api數據庫的cell_mappings表多兩條數據,存放的是nova和rabbitmq等的配置信息
初始化nova_cell0和nova數據庫 # 註冊cell0數據庫 su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova # 建立cell1單元 su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova # 初始化nova數據庫 su -s /bin/sh -c "nova-manage db sync" nova # 檢查確認cell0和cell1註冊成功 su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova # 驗證數據庫 mysql -h10.0.0.11 -unova -pnova -e "use nova_cell0;show tables;" mysql -h10.0.0.11 -unova -pnova -e "use nova;show tables;"
經過對比可知,這兩個數據庫的表目前徹底同樣,區別在於nova數據庫的service表中有4條數據,存放的是當前版本nova相關服務的註冊信息
檢查確認cell0和cell1註冊成功 su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
返回的數據存儲在nova_api數據庫的cell_mappings表中
啓動nova服務 須要啓動5個服務 systemctl start openstack-nova-api.service openstack-nova-consoleauth.service \ openstack-nova-scheduler.service openstack-nova-conductor.service \ openstack-nova-novncproxy.service systemctl status openstack-nova-api.service openstack-nova-consoleauth.service \ openstack-nova-scheduler.service openstack-nova-conductor.service \ openstack-nova-novncproxy.service systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service \ openstack-nova-scheduler.service openstack-nova-conductor.service \ openstack-nova-novncproxy.service systemctl list-unit-files |grep openstack-nova* |grep enabled
至此,在控制節點安裝nova計算服務就完成了,下篇文章介紹獨立的nova計算節點的安裝方法