OpenStack維護命令以及應用實例

目錄

 

一.OenStack常用服務查看命令

OpenStack節點的開啓與關閉

openstack查看命令

查看Nova計算服務的狀態

查看Neutron網絡服務的狀態

查看glance鏡像服務的狀態

查看cinder塊存儲狀態

 

二.OpenStack應用案例

創建項目租戶賬戶

創建公用網絡和租戶網絡

在租戶處創建路由器

創建實例

實例的調試,配置安全組

遠程連接實例

創建卷、掛載卷


一.OenStack常用服務查看命令

OpenStack節點的開啓與關閉

  • 對於OpenStack各個來說當我們開啓時,按照控制節點--網絡節點---計算節點依次開啓
  • 關閉OpenStack平臺時,按照計算節點---網絡節點---控制節點

openstack查看命令

  • 列出所有用戶
[root@control ~(keystone_admin)]# openstack user list
+----------------------------------+------------+
| ID                               | Name       |
+----------------------------------+------------+
| 2ec8bfa9d5ae4bf0a685c76d13bc5c55 | cinder     |
| 6272383e96784f0d905dd8588d9e0137 | glance     |
| 6fe57873a03448a68a2c1035222c261d | placement  |
| 8e30ed231a6c44f7a369f83b665bc157 | admin      |
| 97b4623212204cdab381ce766c8fcd77 | neutron    |
| b2e53eae032048b0a78bd00155b96e8f | ceilometer |
| cc6e4ad1e14e49739f308fa999e78e50 | nova       |
| d6cf53f4c93f46c49f0568d3beb4bb75 | gnocchi    |
+----------------------------------+------------+
[root@control ~(keystone_admin)]# 
  • 列出認證服務的目錄

[root@control ~(keystone_admin)]# openstack catalog list
+------------+-----------+------------------------------------------------------------------------------+
| Name       | Type      | Endpoints                                                                    |
+------------+-----------+------------------------------------------------------------------------------+
| cinderv2   | volumev2  | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8776/v2/e162e666e0284d38b7dacdccaf09bd89     |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8776/v2/e162e666e0284d38b7dacdccaf09bd89      |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8776/v2/e162e666e0284d38b7dacdccaf09bd89   |
|            |           |                                                                              |
| neutron    | network   | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:9696                                          |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:9696                                       |
|            |           | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:9696                                         |
|            |           |                                                                              |
| keystone   | identity  | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:5000/v3                                      |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:5000/v3                                    |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:35357/v3                                      |
|            |           |                                                                              |
| gnocchi    | metric    | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8041                                       |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8041                                          |
|            |           | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8041                                         |
|            |           |                                                                              |
| cinderv3   | volumev3  | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8776/v3/e162e666e0284d38b7dacdccaf09bd89      |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8776/v3/e162e666e0284d38b7dacdccaf09bd89   |
|            |           | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8776/v3/e162e666e0284d38b7dacdccaf09bd89     |
|            |           |                                                                              |
| ceilometer | metering  | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8777                                       |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8777                                          |
|            |           | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8777                                         |
|            |           |                                                                              |
| placement  | placement | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8778/placement                             |
|            |           | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8778/placement                               |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8778/placement                                |
|            |           |                                                                              |
| nova       | compute   | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8774/v2.1/e162e666e0284d38b7dacdccaf09bd89   |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8774/v2.1/e162e666e0284d38b7dacdccaf09bd89 |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8774/v2.1/e162e666e0284d38b7dacdccaf09bd89    |
|            |           |                                                                              |
| glance     | image     | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:9292                                          |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:9292                                       |
|            |           | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:9292                                         |
|            |           |                                                                              |
| cinder     | volume    | RegionOne                                                                    |
|            |           |   public: http://192.168.100.10:8776/v1/e162e666e0284d38b7dacdccaf09bd89     |
|            |           | RegionOne                                                                    |
|            |           |   internal: http://192.168.100.10:8776/v1/e162e666e0284d38b7dacdccaf09bd89   |
|            |           | RegionOne                                                                    |
|            |           |   admin: http://192.168.100.10:8776/v1/e162e666e0284d38b7dacdccaf09bd89      |
|            |           |                                                                              |
+------------+-----------+------------------------------------------------------------------------------+
  • 列出所有的服務模塊

[root@control ~(keystone_admin)]# openstack service list
+----------------------------------+------------+-----------+
| ID                               | Name       | Type      |
+----------------------------------+------------+-----------+
| 152b0a13a1f6443ba35785529ad6224f | cinderv2   | volumev2  |
| 270d59d9c6074a3fbe1ac1c853cbd536 | neutron    | network   |
| 4098c109756a4ca997befb382bbb26b3 | keystone   | identity  |
| 54223fd0080f4374b4a880140395bfd2 | gnocchi    | metric    |
| 72a129087e4e46238f43acb7204a8056 | cinderv3   | volumev3  |
| 88a17b45d5e1479fa9d31f903ce3d9de | ceilometer | metering  |
| 9ad6e8e9cf6541bebc855a0e27668f8b | placement  | placement |
| a696bed718b3490ba47f376c94da600b | nova       | compute   |
| ab25f3321f7b4dc8be8f70a734f1348b | glance     | image     |
| f47ac51cf885462e8b52e2d66694c077 | cinder     | volume    |
+----------------------------------+------------+-----------+
[root@control ~(keystone_admin)]# 
  • 列出所有的域列表

[root@control ~(keystone_admin)]# openstack domain list
+---------+---------+---------+--------------------+
| ID      | Name    | Enabled | Description        |
+---------+---------+---------+--------------------+
| default | Default | True    | The default domain |
+---------+---------+---------+--------------------+
  • 列出所有節點

[root@control ~(keystone_admin)]# openstack host list
+-----------+-------------+----------+
| Host Name | Service     | Zone     |
+-----------+-------------+----------+
| control   | conductor   | internal |
| control   | scheduler   | internal |
| control   | consoleauth | internal |
| compute1  | compute     | nova     |
| compute2  | compute     | nova     |
+-----------+-------------+----------+
[root@control ~(keystone_admin)]# 

查看Nova計算服務的狀態

  • 通過命令查看具體nova服務狀態,保證state在up狀態
[root@control ~]# source keystonerc_admin 
您在 /var/spool/mail/root 中有新郵件
[root@control ~(keystone_admin)]# nova service-list
+--------------------------------------+------------------+----------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id                                   | Binary           | Host     | Zone     | Status  | State | Updated_at                 | Disabled Reason | Forced down |
+--------------------------------------+------------------+----------+----------+---------+-------+----------------------------+-----------------+-------------+
| 6ed21f56-4dec-4549-b9a2-8ec08544df8d | nova-conductor   | control  | internal | enabled | up    | 2020-03-02T06:35:01.000000 | -               | False       |
| 745195aa-0316-4cc7-bf50-129ecf531a64 | nova-scheduler   | control  | internal | enabled | up    | 2020-03-02T06:35:05.000000 | -               | False       |
| 8840b835-dbfa-4805-b5e5-315e69141410 | nova-consoleauth | control  | internal | enabled | up    | 2020-03-02T06:35:01.000000 | -               | False       |
| 5e4dd4e7-abdb-4af1-a635-d14cf91fd28f | nova-compute     | compute1 | nova     | enabled | up    | 2020-03-02T06:35:04.000000 | -               | False       |
| 4f561ca9-69f2-42e3-b5fd-6a554245b602 | nova-compute     | compute2 | nova     | enabled | up    | 2020-03-02T06:35:04.000000 | -               | False       |
+--------------------------------------+------------------+----------+----------+---------+-------+----------------------------+-----------------+-------------+
[root@control ~(keystone_admin)]# 

查看Neutron網絡服務的狀態

  • 查看所有節點的網絡狀態,保證alive在笑臉的狀態
[root@control ~(keystone_admin)]# neutron agent-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+----------------------+----------+-------------------+-------+----------------+---------------------------+
| id                                   | agent_type           | host     | availability_zone | alive | admin_state_up | binary                    |
+--------------------------------------+----------------------+----------+-------------------+-------+----------------+---------------------------+
| 1f1d783b-36d9-4c9f-9ee0-84bec26fa940 | DHCP agent           | control  | nova              | :-)   | True           | neutron-dhcp-agent        |
| 3adadae5-d11e-4739-84d7-6288df62aa10 | Open vSwitch agent   | compute2 |                   | xxx   | True           | neutron-openvswitch-agent |
| 989fab33-11a3-4c9c-81d8-1161de4389a2 | Metering agent       | control  |                   | :-)   | True           | neutron-metering-agent    |
| 98c65413-5feb-484c-b932-35a9afe8fffa | Open vSwitch agent   | compute1 |                   | xxx   | True           | neutron-openvswitch-agent |
| c2eaf89f-e4d9-4490-9dc4-d2959c3b1275 | Open vSwitch agent   | control  |                   | xxx   | True           | neutron-openvswitch-agent |
| d0dfd994-3145-4427-b493-efa750959226 | Loadbalancerv2 agent | control  |                   | :-)   | True           | neutron-lbaasv2-agent     |
| eb0343c6-def1-46d3-b6db-64f7936141ea | Metadata agent       | control  |                   | :-)   | True           | neutron-metadata-agent    |
+--------------------------------------+----------------------+----------+-------------------+-------+----------------+---------------------------+
[root@control ~(keystone_admin)]# 
  • 由於控制節點、計算節點的neutron-openvswitch-agent服務都沒有開啓起來
  • 所以我們分別在控制節點以及計算節點執行:systemctl start neutron-openvswitch-agent
[root@control ~(keystone_admin)]# neutron agent-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+----------------------+----------+-------------------+-------+----------------+---------------------------+
| id                                   | agent_type           | host     | availability_zone | alive | admin_state_up | binary                    |
+--------------------------------------+----------------------+----------+-------------------+-------+----------------+---------------------------+
| 1f1d783b-36d9-4c9f-9ee0-84bec26fa940 | DHCP agent           | control  | nova              | :-)   | True           | neutron-dhcp-agent        |
| 3adadae5-d11e-4739-84d7-6288df62aa10 | Open vSwitch agent   | compute2 |                   | :-)   | True           | neutron-openvswitch-agent |
| 989fab33-11a3-4c9c-81d8-1161de4389a2 | Metering agent       | control  |                   | :-)   | True           | neutron-metering-agent    |
| 98c65413-5feb-484c-b932-35a9afe8fffa | Open vSwitch agent   | compute1 |                   | :-)   | True           | neutron-openvswitch-agent |
| c2eaf89f-e4d9-4490-9dc4-d2959c3b1275 | Open vSwitch agent   | control  |                   | :-)   | True           | neutron-openvswitch-agent |
| d0dfd994-3145-4427-b493-efa750959226 | Loadbalancerv2 agent | control  |                   | :-)   | True           | neutron-lbaasv2-agent     |
| eb0343c6-def1-46d3-b6db-64f7936141ea | Metadata agent       | control  |                   | :-)   | True           | neutron-metadata-agent    |
+--------------------------------------+----------------------+----------+-------------------+-------+----------------+---------------------------+
[root@control ~(keystone_admin)]# 

注:有可能服務會起不來,可以嘗試重啓節點,但是要等控制節點完全啓動

查看glance鏡像服務的狀態

  • 查看鏡像列表
[root@control ~(keystone_admin)]# glance image-list
+----+------+
| ID | Name |
+----+------+
+----+------+
[root@control ~(keystone_admin)]# 

由於筆者沒有上傳鏡像,所以列表沒有

查看cinder塊存儲狀態

  • 列出塊存儲的狀態
[root@control ~(keystone_admin)]# cinder service-list
+------------------+-------------+------+---------+-------+----------------------------+-----------------+
| Binary           | Host        | Zone | Status  | State | Updated_at                 | Disabled Reason |
+------------------+-------------+------+---------+-------+----------------------------+-----------------+
| cinder-scheduler | control     | nova | enabled | up    | 2020-03-02T07:20:26.000000 | -               |
| cinder-volume    | control@lvm | nova | enabled | up    | 2020-03-02T07:20:29.000000 | -               |
+------------------+-------------+------+---------+-------+----------------------------+-----------------+
[root@control ~(keystone_admin)]# 

 

二.OpenStack應用案例

創建項目租戶賬戶

  • 一般在生產環境中用web界面創建用戶,當然也可以使用命令創建用戶

 

  • 登錄創建的租戶

創建公用網絡和租戶網絡

  • 在管理員處創建公共網絡

 

  • 在租戶處創建租戶網絡

 

在租戶處創建路由器

  • 創建路由器連接外網

  • 創建接口

注:發生接口處一直處於down狀態時,systemctl restart neutron-l3-agent

 

創建實例

  • 在管理員賬戶中添加鏡像

##鏡像文件可以在control節點中查看
[root@control ~(keystone_admin)]# cd /var/lib/glance/images
[root@control images(keystone_admin)]# ls
c10f83ec-7f9e-41f3-92ea-e27c20170d2e
[root@control images(keystone_admin)]# 
  • 在管理員賬戶中創建實例類型

  • 在租戶裏創建實例

  • 綁定浮動IP地址

 

實例的調試,配置安全組

  • 在租戶賬戶裏添加規則

注:主機無法ping通浮動IP地址,解決重啓neutron service

  • 修改實例文件,使之能夠識別域名
$sudo passwd root
輸入兩次密碼

$su - root

輸入密碼


#vi /etc/resolv.conf
nameserver 8.8.8.8

 

遠程連接實例

  • 添加ssh規則

 

創建卷、掛載卷

  • 在openstack界面創建卷

  • 在命令界面掛載卷

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章