<a href="#%E7%9B%AE%E5%BD%95">目錄</a>
<a href="#%E5%89%8D%E6%96%87%E5%88%97%E8%A1%A8">前文清單</a>
<a href="#install-and-configure">Install and configure</a>
<a href="#prerequisites-%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6">Prerequisites 先決條件</a>
<a href="#create-the-database-for-identity-service">Create the database for identity service</a>
<a href="#%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E9%9A%8F%E6%9C%BA%E6%95%B0">生成一個随機數</a>
<a href="#install-and-configure-components">Install and configure components</a>
<a href="#configure-the-apache-http-server">Configure the Apache HTTP server</a>
<a href="#create-the-service-entity-and-api-endpoints">Create the service entity and API endpoints</a>
<a href="#prerequisites-%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6-1">Prerequisites 先決條件</a>
<a href="#create-the-service-entity-and-api-endpoints-1">Create the service entity and API endpoints</a>
<a href="http://blog.csdn.net/jmilk/article/details/51627186">Openstack元件部署 — Overview和前期環境準備</a>
<a href="http://blog.csdn.net/jmilk/article/details/51633821">Openstack組建部署 — Environment of Controller Node</a>
<a href="http://blog.csdn.net/jmilk/article/details/51651154">Openstack元件部署 — Keystone功能介紹與認證實作流程</a>
This section describes how to install and configure the OpenStack Identity service, code-named keystone, on the controller node.
For performance, this configuration deploys Fernet tokens and the Apache HTTP server to handle requests.
這一節記錄了怎樣在Controller Node上安裝和配置Openstack的認證服務,代号為Keystone。在性能上,這個配置使用了Fernet Tokens和Apache HTTP伺服器去處理請求。
Fernet Tokens:是K版本的更新内容,差別于UUID tokens隻能持久化存入資料庫,Fernet tokens完全不需要持久化。部署人員可以通過設定keystone.conf中的<code>[token] provider = keystone.token.providers.fernet.Provider</code>來啟用Fernet token,這也是我們一會需要配置的參數項。Fernet tokens需要symmetric encryption keys(對稱加密密鑰),這些keys可以使用<code>keystone-manage fernet_setup</code>建立, 并且使用<code>keystone-manage fernet_rotate</code>周期性地輪換。這些keys必須被在一個multi-node(或者multi-region)部署中的所有Keystone nodes共享,這樣就能使一個node生成的tokens可以立即被其他節點驗證。
Before you configure the OpenStack Identity service, you must create a database and an administration token.
在配置Openstack認證服務之前,你需要先建立一個<code>keystone</code>資料庫和一個用于初始化keystone期間的臨時管理token。
這個資料庫用于存放Keystone元件(User、Tenant、Roles等)的相關資訊。
Step1.進入MySQL
Step2.建立資料庫<code>keystone</code>
Step3.建立<code>keystone</code>資料庫使用者并授予适當的通路權限
建立keystone資料庫使用者,使其可以對keystone資料庫有完全控制權限。
Step4.退出MySQL
Generate a random value to use as the administration token during initial configuration
生成一個用于初始化keystone期間的臨時管理token
Note:This guide uses the Apache HTTP server with mod_wsgi to serve Identity service requests on ports 5000 and 35357. By default, the keystone service still listens on these ports. Therefore, this guide manually disables the keystone service.
注意:該指南使用Apache Http伺服器的<code>mod_wsgi</code>(Python Web Server Gateway Interface)動态通路子產品來支援認證服務在5000和35357端口上的請求。keystone service預設就會監聽這兩個端口,是以,該指南手動的禁用keystone service。
WSGI:Python Web伺服器網關接口(Python Web Server Gateway Interface,縮寫為WSGI),是Python應用程式或架構和Web伺服器之間的一種接口,已經被廣泛接受, 它已基本達成它的可移植性方面的目标。
Step1.安裝<code>openstack-keystone</code>、<code>HTTP</code>、<code>mod_wsgi</code>子產品
Step2.Edit the /etc/keystone/keystone.conf file and complete the following actions:
vim /etc/keystone/keystone.conf
總覽:
注意:從總覽的内容可以看出,在最新的版本中,第一次安裝Keystone元件的時候,配置檔案中的節點内容都是空的。但如果是使用該指南來安裝其他版本Keystone的話,需要注意,我們應該是添加該指南的參數項到配置檔案中,而不需要删除原來就已經存在的參數項。
Step3.Populate the Identity service database:
檢視資料庫表是否建立成功:
注意:執行此指令之後,忽略所有的deprecation messages。但是如果一直卡在這一步的話,我建議從新檢視一下<code>keystone.conf</code>配置檔案是否能夠成功連接配接到資料庫。
Step4.Initialize Fernet keys:
前文有過描述:Fernet tokens需要symmetric encryption keys,而這個keys就是使用<code>keystone-manage fernet_setup</code>來建立。
Step1.Edit the /etc/httpd/conf/httpd.conf file and configure the ServerName option to reference the controller node:
vim /etc/httpd/conf/httpd.conf
Step2.Create the /etc/httpd/conf.d/wsgi-keystone.conf file with the following content:
開啟兩個監聽端口,并配置兩個Virtualhost-Port虛拟主機。
vim /etc/httpd/conf.d/wsgi-keystone.conf
Step3.Start the Apache HTTP service and configure it to start when the system boots:
到此為止,Keystone的安裝已經完成了。
The Identity service provides a catalog of services and their locations. Each service that you add to your OpenStack environment requires a service entity and several API endpoints in the catalog.
認證服務提供了一個服務目錄,需要為每一個加入到Openstack環境中的openstack service的service entity和若幹個API endpoints添加到該服務目錄中。
By default, the Identity service database contains no information to support conventional authentication and catalog services. You must use a temporary authentication token that you created in the section called Install and configure to initialize the service entity and API endpoint for the Identity service.
預設的,建立的認證服務資料庫并沒有包含任何支援authentication 和catalog services的資訊。你必須使用在上文中建立的臨時的authentication token——<code>admin_token</code>去初始化service entity和API endpoint。
Step1.建立臨時authentication token檔案
vim ~/auth_token
加載auth_token檔案的環境變量
Step1.Create the service entity服務實體 for the Identity service:
The Identity service manages a catalog of services in your OpenStack environment. Services use this catalog to determine the other services available in your environment.
認證服務在Openstack中管理着一個服務目錄,Openstack services是通過服務目錄來定位其他的service。
ERROR: An unexpected error prevented the server from fulfilling your request. (HTTP 500) (Request-ID: req-7e447b64-0ab1-4add-b0f9-ccb29de79156)
這是一個非常常見的錯誤,尤其對于入門Openstack的小夥伴而言,很多人就卡在這個ERROR上。這裡給出一些解決的方案:
1. 一定要檢查Keystone的表是否成功建立
2. 確定環境變量正确,尤其是<code>OS_TOKEN</code>與<code>admin_token</code>的值是一緻的,建議使用Copy,因為常見參數值後面帶有空格,導緻不一緻的情況。
3. 確定Hostname和IP能夠成功解析
4. 確定Port:35357已經開啟
5. 確定HTTP服務正常運作
6. 檢視openstack-keystone服務是否打開,如果是M版本就無所謂了
7. 實在不行,建議重新開機主機試試(放大招了)
Step2.Create the Identity service API endpoints:
The Identity service manages a catalog of API endpoints associated with the services in your OpenStack environment. Services use this catalog to determine how to communicate with other services in your environment.OpenStack uses three API endpoint variants for each service: admin, internal, and public.
認證服務還管理着一個服務相關的API endpoints目錄,Services使用endpoints目錄确定怎麼與其他Services通信。每一個Openstack service提供了三種形式的API endpoint:admin管理, internal内部, and public外部.