{message type="info" content="先来一首简单的音乐,再来开始我们今天的学习。
"/}
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
{music id="475152589" color="#1989fa" /}
{dotted startColor="#dd3636" endColor="#4185c8"/}
{callout color="#f0ad4e"}
linux - 查看日记的四中方法
tail - 实时日记
multitail - 实时多个日记
lnav - 同上
less - 显示日记文件的实时输出
{/callout}
Plancement
初始化数据库
♾️ python 代码:mysql -u root -p000000
创建placement数据库并授权
♾️ python 代码: CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY '000000';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY '000000';
exit
演示如下
♾️ python 代码:[root@controller ~]# mysql -u root -p000000
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.3.20-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE placement;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
-> IDENTIFIED BY '000000';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> exit
Bye
配置用户和端点
♾️ python 代码:source admin-openrc
openstack user create --domain default --password-prompt placement
结果如下
♾️ python 代码:[root@controller ~]# source admin-openrc
[root@controller ~]# openstack user create --domain default --password-prompt placement
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 51d7969713a2432aae74e792e9fba35d |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
使用管理员角色将Placement用户添加到服务项目中
♾️ python 代码:openstack role add --project service --user placement admin
在服务目录中创建Placement API条目
♾️ python 代码:openstack service create --name placement --description "Placement API" placement
结果如下
♾️ python 代码:+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Placement API |
| enabled | True |
| id | 061f7f96844c437cb4a2d50a771d4ce0 |
| name | placement |
| type | placement |
+-------------+----------------------------------+
创建Placement API服务端点
♾️ python 代码: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
结果如下
♾️ python 代码:[root@controller ~]# openstack endpoint create --region RegionOne \
> placement public http://controller:8778
troller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | a01b70aa5a6e450d82838d603c2517cb |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 061f7f96844c437cb4a2d50a771d4ce0 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
> placement internal http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | a5c5fb31a8424f599f18ae90af407eb0 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 061f7f96844c437cb4a2d50a771d4ce0 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
> placement admin http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 991ac0b761d5444da9d7689f429c0b45 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 061f7f96844c437cb4a2d50a771d4ce0 |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
安装软件包
♾️ python 代码:yum install openstack-placement-api
编辑/etc/placement/placement.conf文件
♾️ python 代码:vi /etc/placement/placement.conf文件
修改或者添加配置文件如下
♾️ python 代码:[placement_database]
connection = mysql+pymysql://placement:000000@controller/placement
[api]
auth_strategy = keystone
[keystone_authtoken]
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 = placement
password = 000000
填充placement数据库
♾️ python 代码:su -s /bin/sh -c "placement-manage db sync" placement
查看表里面是否有数据
♾️ python 代码:mysql -u root -p000000 -e"use placement;show tables;"
输出如下
♾️ python 代码:[root@controller ~]# mysql -u root -p000000 -e"use placement;show tables;"
+------------------------------+
| Tables_in_placement |
+------------------------------+
| alembic_version |
| allocations |
| consumers |
| inventories |
| placement_aggregates |
| projects |
| resource_classes |
| resource_provider_aggregates |
| resource_provider_traits |
| resource_providers |
| traits |
| users |
+------------------------------+
重启httpd服务
♾️ python 代码:systemctl restart httpd
Placement验证
♾️ python 代码:source admin-openrc #这是确保为admin的环境变量
placement-status upgrade check
输出如下
♾️ python 代码:[root@controller ~]# placement-status upgrade check
+----------------------------------+
| Upgrade Check Results |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success |
| Details: None |
+----------------------------------+
| Check: Incomplete Consumers |
| Result: Success |
| Details: None |
+----------------------------------+
查看对应8778端口是否打开
♾️ python 代码:netstat -tnlup
输出如下
♾️ python 代码:Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6012 0.0.0.0:* LISTEN 100918/sshd: root@p
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 99762/beam
tcp 0 0 10.0.0.11:3306 0.0.0.0:* LISTEN 99540/mysqld
tcp 0 0 127.0.0.1:2379 0.0.0.0:* LISTEN 101202/etcd
tcp 0 0 10.0.0.11:11211 0.0.0.0:* LISTEN 100391/memcached
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 100391/memcached
tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 108179/python2
tcp 0 0 127.0.0.1:2380 0.0.0.0:* LISTEN 101202/etcd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 25160/rpcbind
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1402/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 23407/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 23721/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 23889/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 107409/sshd: root@p
tcp6 0 0 ::1:6012 :::* LISTEN 100918/sshd: root@p
tcp6 0 0 :::5000 :::* LISTEN 108631/httpd
tcp6 0 0 :::5672 :::* LISTEN 99762/beam
tcp6 0 0 :::8778 :::* LISTEN 108631/httpd
tcp6 0 0 ::1:11211 :::* LISTEN 100391/memcached
tcp6 0 0 :::111 :::* LISTEN 25160/rpcbind
tcp6 0 0 :::80 :::* LISTEN 108631/httpd
tcp6 0 0 :::22 :::* LISTEN 23407/sshd
tcp6 0 0 ::1:631 :::* LISTEN 23721/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 23889/master
tcp6 0 0 ::1:6010 :::* LISTEN 107409/sshd: root@p
udp 0 0 127.0.0.1:323 0.0.0.0:* 3184/chronyd
udp 0 0 0.0.0.0:47717 0.0.0.0:* 23431/avahi-daemon:
udp 0 0 0.0.0.0:743 0.0.0.0:* 25160/rpcbind
udp 0 0 0.0.0.0:5353 0.0.0.0:* 23431/avahi-daemon:
udp 0 0 192.168.122.1:53 0.0.0.0:* 59556/dnsmasq
udp 0 0 192.168.122.1:53 0.0.0.0:* 1402/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 59556/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 1402/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 108100/dhclient
udp 0 0 0.0.0.0:111 0.0.0.0:* 25160/rpcbind
udp 0 0 0.0.0.0:123 0.0.0.0:* 3184/chronyd
udp6 0 0 ::1:323 :::* 3184/chronyd
udp6 0 0 :::743 :::* 25160/rpcbind
udp6 0 0 :::111 :::* 25160/rpcbind
到这里我们的plancement搭建句算完成了
总结
这一次的搭建比较简单,前面我也没有出过错,后面的nova,就有报错的痕迹了,值得注意的是,如果说没有报错,但是就是有服务没有起来的话,直接重启,然后查看防火墙和selinux是不是又他妈的偷偷启动了,关闭就好了,这是血与泪的教训。