其他分享
首页 > 其他分享> > OpenStack-Placement

OpenStack-Placement

作者:互联网

在部署nova组件之前这个placement这个组件必须先部署好,否则在启动nova组件时​nova-scheduler和​nova-conductor会报错。。。

OpenStack-Placement部署过程

一、创建数据库实例和数据库用户

[root@ct ~]# mysql -uroot -p123
MariaDB [(none)]> CREATE DATABASE placement;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'PLACEMENT_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'PLACEMENT_DBPASS';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

二、创建Placement服务用户和API的endpoint

openstack user create --domain default --password PLACEMENT_PASS placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "Placement API" placement

openstack endpoint create --region RegionOne placement public http://ct:8778
openstack endpoint create --region RegionOne placement internal http://ct:8778
openstack endpoint create --region RegionOne placement admin http://ct:8778

三、安装placement服务并修改配置文件

yum -y install openstack-placement-api

cp -a /etc/placement/placement.conf{,.bak}
grep -Ev '^$|#' /etc/placement/placement.conf.bak > /etc/placement/placement.conf
openstack-config --set /etc/placement/placement.conf placement_database connection mysql+pymysql://placement:PLACEMENT_DBPASS@ct/placement
openstack-config --set /etc/placement/placement.conf api auth_strategy keystone
openstack-config --set /etc/placement/placement.conf keystone_authtoken auth_url  http://ct:5000/v3
openstack-config --set /etc/placement/placement.conf keystone_authtoken memcached_servers ct:11211
openstack-config --set /etc/placement/placement.conf keystone_authtoken auth_type password
openstack-config --set /etc/placement/placement.conf keystone_authtoken project_domain_name Default
openstack-config --set /etc/placement/placement.conf keystone_authtoken user_domain_name Default
openstack-config --set /etc/placement/placement.conf keystone_authtoken project_name service
openstack-config --set /etc/placement/placement.conf keystone_authtoken username placement
openstack-config --set /etc/placement/placement.conf keystone_authtoken password PLACEMENT_PASS

#导入数据库
su -s /bin/sh -c "placement-manage db sync" placement

#修改Apache配置文件: /etc/httpd/conf.d/00-placemenct-api.conf(安装完placement服务后会自动创建该文件-虚拟主机配置	)
Listen 8778

<VirtualHost *:8778>
  WSGIProcessGroup placement-api
  WSGIApplicationGroup %{GLOBAL}
  WSGIPassAuthorization On
  WSGIDaemonProcess placement-api processes=3 threads=1 user=placement group=placement
  WSGIScriptAlias / /usr/bin/placement-api
  <IfVersion >= 2.4>
    ErrorLogFormat "%M"
  </IfVersion>
  ErrorLog /var/log/placement/placement-api.log
  #SSLEngine On
  #SSLCertificateFile ...
  #SSLCertificateKeyFile ...
</VirtualHost>

Alias /placement-api /usr/bin/placement-api
<Location /placement-api>
  SetHandler wsgi-script
  Options +ExecCGI
  WSGIProcessGroup placement-api
  WSGIApplicationGroup %{GLOBAL}
  WSGIPassAuthorization On
</Location>						#在此行下添加
<Directory /usr/bin>			#此处是bug,必须添加下面的配置来启用对placement api的访问,否则在访问apache的
<IfVersion >= 2.4>				#api时会报403;添加在文件的最后即可
	Require all granted
</IfVersion>
<IfVersion < 2.4>				#apache版本;允许apache访问/usr/bin目录;否则/usr/bin/placement-api将不允许被访问
	Order allow,deny				
	Allow from all			#允许apache访问
</IfVersion>
</Directory>

systemctl restart httpd

四、测试

curl ct:8778

netstat -natp | grep 8778

placement-status upgrade check				#检查placement状态

总结下:
Placement提供了placement-apiWSGI脚本,用于与Apache,nginx或其他支持WSGI的Web服务器一起运行服务(通过nginx或apache实现python入口代理)。
根据用于部署OpenStack的打包解决方案,WSGI脚本可能位于/usr/bin 或中/usr/local/bin
Placement服务是从 S 版本,从nova服务中拆分出来的组件,作用是收集各个node节点的可用资源,把node节点的资源统计写入到mysql,Placement服务会被nova scheduler服务进行调用 Placement服务的监听端口是8778

需修改的配置文件:
① placement.conf
主要修改思路:
Keystone认证相关(url、HOST:PORT、域、账号密码等)
对接数据库(位置)
② 00-placement-api.conf
主要修改思路:
Apache权限、访问控制

标签:Placement,--,etc,api,conf,openstack,OpenStack,placement
来源: https://blog.csdn.net/weixin_51432789/article/details/114928317