1. 程式人生 > 實用技巧 >納管OpenStack API介面超時

納管OpenStack API介面超時

現象:呼叫服務介面超時
原因: endpoint url 地址對映的是VPC內IP 外部不能訪問

處理方法:
方法一:更改hosts解析,把解析的IP地址改成浮動IP,或者外部能夠訪問的IP地址

[root@controller1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.61.105 controller1
192.168.61.106 compute1
192.168.61.107 cinder

方法二:
連線keystone 資料庫查詢endpoint表

MariaDB [keystone]> select * from endpoint;
+----------------------------------+--------------------+-----------+----------------------------------+--------------------------------------------+-------+---------+-----------+
| id                               | legacy_endpoint_id | interface | service_id                       | url                                        | extra | enabled | region_id |
+----------------------------------+--------------------+-----------+----------------------------------+--------------------------------------------+-------+---------+-----------+
| 089b8db47a494e7e95a3b0462ad7ba7f | NULL               | internal  | 9a2ba79c1879463a9b815958eb740f9a | http://controller1:8774/v2.1/%(tenant_id)s | {}    |       1 | RegionOne |
| 23f26aa035b845429637fbc89d97667e | NULL               | admin     | 6498d35058324b5cac1e707381533c1b | http://controller1:9292                    | {}    |       1 | RegionOne |
| 2699f9fc8a58443499cdf1b5bdeca1ed | NULL               | internal  | 58b2213df2eb48cf91ad935a1d3af342 | http://controller1:8776/v2/%(tenant_id)s   | {}    |       1 | RegionOne |
| 27f01ffb97c745e39c364b09f61e7a7b | NULL               | admin     | 58b2213df2eb48cf91ad935a1d3af342 | http://controller1:8776/v2/%(tenant_id)s   | {}    |       1 | RegionOne |
| 36124846793747da9087fcb60693828c | NULL               | admin     | 4f59b8f68d52472195a3520b67bf35e0 | http://controller1:8776/v1/%(tenant_id)s   | {}    |       1 | RegionOne |
| 3b8089f6df284345920a30f023a153e1 | NULL               | admin     | 208ae53e99a14de8a18b96c92cda4fcc | http://controller1:9696                    | {}    |       1 | RegionOne |
| 44410081885a4772b1051a46499f0637 | NULL               | internal  | 208ae53e99a14de8a18b96c92cda4fcc | http://controller1:9696                    | {}    |       1 | RegionOne |
| 4de86f6447544753a43004dbf86a7b19 | NULL               | public    | 9a2ba79c1879463a9b815958eb740f9a | http://controller1:8774/v2.1/%(tenant_id)s | {}    |       1 | RegionOne |
| 60abdc37d0614fa78016ed7d7f6ba570 | NULL               | public    | 4f59b8f68d52472195a3520b67bf35e0 | http://controller1:8776/v1/%(tenant_id)s   | {}    |       1 | RegionOne |
| 67731fc14ea649d2b8267d0174409b08 | NULL               | internal  | 6498d35058324b5cac1e707381533c1b | http://controller1:9292                    | {}    |       1 | RegionOne |
| 6cffe3922f4e41c19d0d38c36a49b172 | NULL               | public    | 1f2090728167429aafac127723c01930 | http://controller1:8778                    | {}    |       1 | RegionOne |
| 6f599f39ee1146439c883c459096242c | NULL               | public    | b52a43941f524327b1a9645e70362497 | http://controller1:5000/v3                 | {}    |       1 | RegionOne |
| 7c14797a64cd48398ba91e4e752a1158 | NULL               | internal  | b52a43941f524327b1a9645e70362497 | http://controller1:35357/v3                | {}    |       1 | RegionOne |
| a476bf95afae4b8b87dcca3bf2b85cdf | NULL               | public    | 6498d35058324b5cac1e707381533c1b | http://controller1:9292                    | {}    |       1 | RegionOne |
| ad0fc00e9fc043bbb0abc9311df495bc | NULL               | admin     | 9a2ba79c1879463a9b815958eb740f9a | http://controller1:8774/v2.1/%(tenant_id)s | {}    |       1 | RegionOne |
| b7653dad04ae4c83b56b5409246d80c5 | NULL               | internal  | 4f59b8f68d52472195a3520b67bf35e0 | http://controller1:8776/v1/%(tenant_id)s   | {}    |       1 | RegionOne |
| c3acf25b73154a159ea4b3f61e40714b | NULL               | internal  | 1f2090728167429aafac127723c01930 | http://controller1:8778                    | {}    |       1 | RegionOne |
| dabc2d45dc3a4313967ce6d511581ffa | NULL               | admin     | b52a43941f524327b1a9645e70362497 | http://controller1:35357/v3                | {}    |       1 | RegionOne |
| eb560c8f37ee44d2b1864c8d0ca1c691 | NULL               | public    | 58b2213df2eb48cf91ad935a1d3af342 | http://controller1:8776/v2/%(tenant_id)s   | {}    |       1 | RegionOne |
| f79ae15829d847fb9c7aa3bc375a398c | NULL               | public    | 208ae53e99a14de8a18b96c92cda4fcc | http://controller1:9696                    | {}    |       1 | RegionOne |
| ff5dfa2118094ff5bb53bb9aff73bd3d | NULL               | admin     | 1f2090728167429aafac127723c01930 | http://controller1:8778                    | {}    |       1 | RegionOne |
+----------------------------------+--------------------+-----------+----------------------------------+--------------------------------------------+-------+---------+-----------+
21 rows in set (0.00 sec)
MariaDB [keystone]> update endpoint set url = replace(url , 'controller1' , '192.168.61.105');
Query OK, 19 rows affected (0.06 sec)
Rows matched: 21  Changed: 19  Warnings: 0

MariaDB [keystone]> select * from endpoint;
+----------------------------------+--------------------+-----------+----------------------------------+-----------------------------------------------+-------+---------+-----------+
| id                               | legacy_endpoint_id | interface | service_id                       | url                                           | extra | enabled | region_id |
+----------------------------------+--------------------+-----------+----------------------------------+-----------------------------------------------+-------+---------+-----------+
| 089b8db47a494e7e95a3b0462ad7ba7f | NULL               | internal  | 9a2ba79c1879463a9b815958eb740f9a | http://192.168.61.105:8774/v2.1/%(tenant_id)s | {}    |       1 | RegionOne |
| 23f26aa035b845429637fbc89d97667e | NULL               | admin     | 6498d35058324b5cac1e707381533c1b | http://192.168.61.105:9292                    | {}    |       1 | RegionOne |
| 2699f9fc8a58443499cdf1b5bdeca1ed | NULL               | internal  | 58b2213df2eb48cf91ad935a1d3af342 | http://192.168.61.105:8776/v2/%(tenant_id)s   | {}    |       1 | RegionOne |
| 27f01ffb97c745e39c364b09f61e7a7b | NULL               | admin     | 58b2213df2eb48cf91ad935a1d3af342 | http://192.168.61.105:8776/v2/%(tenant_id)s   | {}    |       1 | RegionOne |
| 36124846793747da9087fcb60693828c | NULL               | admin     | 4f59b8f68d52472195a3520b67bf35e0 | http://192.168.61.105:8776/v1/%(tenant_id)s   | {}    |       1 | RegionOne |
| 3b8089f6df284345920a30f023a153e1 | NULL               | admin     | 208ae53e99a14de8a18b96c92cda4fcc | http://192.168.61.105:9696                    | {}    |       1 | RegionOne |
| 44410081885a4772b1051a46499f0637 | NULL               | internal  | 208ae53e99a14de8a18b96c92cda4fcc | http://192.168.61.105:9696                    | {}    |       1 | RegionOne |
| 4de86f6447544753a43004dbf86a7b19 | NULL               | public    | 9a2ba79c1879463a9b815958eb740f9a | http://192.168.61.105:8774/v2.1/%(tenant_id)s | {}    |       1 | RegionOne |
| 60abdc37d0614fa78016ed7d7f6ba570 | NULL               | public    | 4f59b8f68d52472195a3520b67bf35e0 | http://192.168.61.105:8776/v1/%(tenant_id)s   | {}    |       1 | RegionOne |
| 67731fc14ea649d2b8267d0174409b08 | NULL               | internal  | 6498d35058324b5cac1e707381533c1b | http://192.168.61.105:9292                    | {}    |       1 | RegionOne |
| 6cffe3922f4e41c19d0d38c36a49b172 | NULL               | public    | 1f2090728167429aafac127723c01930 | http://192.168.61.105:8778                    | {}    |       1 | RegionOne |
| 6f599f39ee1146439c883c459096242c | NULL               | public    | b52a43941f524327b1a9645e70362497 | http://192.168.61.105:5000/v3                 | {}    |       1 | RegionOne |
| 7c14797a64cd48398ba91e4e752a1158 | NULL               | internal  | b52a43941f524327b1a9645e70362497 | http://192.168.61.105:35357/v3                | {}    |       1 | RegionOne |
| a476bf95afae4b8b87dcca3bf2b85cdf | NULL               | public    | 6498d35058324b5cac1e707381533c1b | http://192.168.61.105:9292                    | {}    |       1 | RegionOne |
| ad0fc00e9fc043bbb0abc9311df495bc | NULL               | admin     | 9a2ba79c1879463a9b815958eb740f9a | http://192.168.61.105:8774/v2.1/%(tenant_id)s | {}    |       1 | RegionOne |
| b7653dad04ae4c83b56b5409246d80c5 | NULL               | internal  | 4f59b8f68d52472195a3520b67bf35e0 | http://192.168.61.105:8776/v1/%(tenant_id)s   | {}    |       1 | RegionOne |
| c3acf25b73154a159ea4b3f61e40714b | NULL               | internal  | 1f2090728167429aafac127723c01930 | http://192.168.61.105:8778                    | {}    |       1 | RegionOne |
| dabc2d45dc3a4313967ce6d511581ffa | NULL               | admin     | b52a43941f524327b1a9645e70362497 | http://192.168.61.105:35357/v3                | {}    |       1 | RegionOne |
| eb560c8f37ee44d2b1864c8d0ca1c691 | NULL               | public    | 58b2213df2eb48cf91ad935a1d3af342 | http://192.168.61.105:8776/v2/%(tenant_id)s   | {}    |       1 | RegionOne |
| f79ae15829d847fb9c7aa3bc375a398c | NULL               | public    | 208ae53e99a14de8a18b96c92cda4fcc | http://192.168.61.105:9696                    | {}    |       1 | RegionOne |
| ff5dfa2118094ff5bb53bb9aff73bd3d | NULL               | admin     | 1f2090728167429aafac127723c01930 | http://192.168.61.105:8778                    | {}    |       1 | RegionOne |
+----------------------------------+--------------------+-----------+----------------------------------+-----------------------------------------------+-------+---------+-----------+
21 rows in set (0.00 sec)