OpenStack-Placement组件部署详解(T版)

news/2024/7/4 7:17:17 标签: Placement, OpenStack, 架构

OpenStack-Placement组件部署

  • 一、创建数据库实例和数据库用户
  • 二、创建Placement服务用户和API的endpoint
  • 小结

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

[root@ct ~]# mysql -uroot -p123456

MariaDB [(none)]> CREATE DATABASE placement;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'PLACEMENT_DBPASS';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'PLACEMENT_DBPASS';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye

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

创建placement用户


[root@ct ~]# openstack user create --domain default --password PLACEMENT_PASS placement
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 824aedb9009b44e1be3bcd9f9f1267e8 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

给与placement用户对service项目拥有admin权限

[root@ct ~]# openstack role add --project service --user placement admin

创建一个placement服务,服务类型为placement

[root@ct ~]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 0cdf851f5812474bb8872dff874542a3 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

注册API端口到placement的service中;注册的信息会写入到mysql中

[root@ct ~]# openstack endpoint create --region RegionOne placement public http://ct:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7851108d6f07445499e6cf747bb853fd |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 0cdf851f5812474bb8872dff874542a3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://ct:8778                   |
+--------------+----------------------------------+
[root@ct ~]# openstack endpoint create --region RegionOne placement internal http://ct:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 24948c70b97549e69def7e729f7e888b |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 0cdf851f5812474bb8872dff874542a3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://ct:8778                   |
+--------------+----------------------------------+
[root@ct ~]# openstack endpoint create --region RegionOne placement admin http://ct:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 782e7202e8eb45fc9a02096dcb00e279 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 0cdf851f5812474bb8872dff874542a3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://ct:8778                   |
+--------------+----------------------------------+

安装placement服务

[root@ct ~]#  yum -y install openstack-placement-api

修改placement配置文件

[root@ct ~]# cp /etc/placement/placement.conf{,.bak}
ment
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[root@ct ~]# grep -Ev '^$|#' /etc/placement/placeent.conff.bak > /etc/placement/placem 
[root@ct ~]# openstack-config --set /etc/placement/placement.conf placement_database connection mysql+pymysql://placement:PLACEMENT_DBPASS@ct/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[root@ct ~]# openstack-config --set /etc/placement/placement.conf api auth_stystone ke 
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken auth_url  http://ct:5000/v3
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken memcached_servers ct:11211
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken auth_type password
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken project_domain_name Default
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken user_domain_name Default
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken project_name service
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken username placement
[root@ct ~]# openstack-config --set /etc/placement/placement.conf keystone_authtoken password PLACEMENT_PASS


[root@ct ~]# cd /etc/placement/
[root@ct placement]# cat placement.conf
[DEFAULT]
[api]
auth_strategy = keystone
[cors]
[keystone_authtoken]
auth_url = http://ct:5000/v3  #指定keystone地址
memcached_servers = ct:11211  #session信息是缓存放到了memcached中
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = PLACEMENT_PASS
[oslo_policy]
[placement]
[placement_database]
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@ct/placement
[profiler]


导入数据库


[root@ct placement]# su -s /bin/sh -c "placement-manage db sync" placement
/usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1280, u"Name 'alembic_version_pkc' ignored for PRIMARY key.")
  result = self._query(query)

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

[root@ct conf.d]# cat 00-placement-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>

重新启动apache

[root@ct placement]# systemctl restart httpd

测试
① curl 测试访问

[root@ct placement]# curl ct:8778
{"versions": [{"status": "CURRENT", "min_version": "1.0", "max_version": "1.36", "id": "v1.0", "links": [{"href": "", "rel": "self"}]}]}

② 查看端口占用(netstat、lsof)

[root@ct placement]# netstat -natp | grep 8778
tcp6       0      0 :::8778                 :::*                    LISTEN      20702/httpd         

③ 检查placement状态

[root@ct placement]# placement-status upgrade check
+----------------------------------+
| Upgrade Check Results            |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
| Check: Incomplete Consumers      |
| Result: Success                  |
| Details: None                    |
+----------------------------------+

小结

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权限、访问控制


http://www.niftyadmin.cn/n/1076210.html

相关文章

《Xilinx - UG471中文翻译》(1)IDELAYE2原语介绍

目录 一、7 系列FPGAs SelectIO 资源 二、selectIO的逻辑资源 2.1 ILOGIC 2.2 IDELAY 2.3 IDELAYCTRL 2.4 ODELAY 2.5 OLOGIC 三、IDELAYE2原语 3.1IDELAYE2属性 3.2IDELAYE2端口 3.2.1延迟控制 3.3时序图 3.4仿真测试 四、高级selectIO逻辑资源 一、7 系列FPGAs…

范数 L1 L2

在线性代数&#xff0c;函数分析等数学分支中&#xff0c;范数&#xff08;Norm&#xff09;是一个函数&#xff0c;是赋予某个向量空间&#xff08;或矩阵&#xff09;中的每个向量以长度或大小的函数。对于零向量&#xff0c;令其长度为零。直观的说&#xff0c;向量或矩阵的…

Xilinx FPGA平台DDR3设计保姆式教程(1)DDR3基础简介

如果我们只是拿来用ddr搬砖&#xff0c;那么它就简单&#xff0c;知道IP怎么使用就好&#xff0c;但是要想知其所以然&#xff0c;理论知识是必备的&#xff0c;这也是我们初学者所欠缺的东西&#xff0c;慢慢修炼吧&#xff01; 汇总篇&#xff1a; Xilinx平台DDR3设计保姆式…

python学习资料资源

廖雪峰python教程: http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000 简明python教程: http://www.kuqin.com/abyteofpython_cn/index.html 菜鸟教程: http://www.runoob.com/python/python-tutorial.html 知乎: https://www.zhihu.com/qu…

如何将hive表中的数据导出

近期经常将现场的数据带回公司测试&#xff0c;所以写下该文章&#xff0c;梳理一下思路。 1.首先要查询相应的hive表&#xff0c;比如我要将c_cons这张表导出&#xff0c;我先查出hive中是否有这张表。 查出数据&#xff0c;证明该表在hive中存在。 2.查询该表的表结构&#x…

Docker容器技术概述

Docker容器技术概述Docker简介Docker的应用场景Docker 的优点理解Docker的工作原理Docker简介 Docker 是一个开源的应用容器引擎&#xff0c;基于 Go 语言 并遵从 Apache2.0 协议开源。 Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中&#xff0c…

cpu_ops、suspend_ops、arm_idle_driver以及machine_restart/machine_power_off到底层PSCI Firmware分析...

在内核中针对的cpu的操作&#xff0c;比如arm_cpuidle_init、arm_cpuidle_suspend、boot_secondary、secondary_start_kernel、op_cpu_disable、op_cpu_kill、cpu_die、smp_cpu_setup、smp_prepare_cpus的都会回落到对cpu_ops的调用。 cpu_ops将针对底层cpu的操作抽象为一系列回…

docker--基础环境安装

docker--基础环境安装安装docker环境准备环境查看1、卸载旧的版本2、需要的安装包3、设置镜像仓库4、安装DOCKER引擎&#xff08;docker-ce 社区版的 -ee 企业版的&#xff09;5、 启动docker6、使用docker version查看是否安装成功7、容器镜像加速安装docker 环境准备 1、会…