1. 程式人生 > >Cloudify在雲環境下的引導過程

Cloudify在雲環境下的引導過程

Cloudify使用引導程序為Cloudify管理以及部署應用所需的服務準備機器。

啟動程序負責分配機器(物理機或虛擬機器),安裝Cloudify元件模組所需的軟體(JDK)。通過Cloudify命令列中執行相關的命令啟動初始的引導程序。一般而言,載入程式執行以下任務:

  1. 從相關模板定義的可用機器資源池中分配一臺機器。更多模板資訊,請看Cloudify驅動檔案(Cloudify driver file
  2. 通過SSH(*nix)或者WinRM(Windows)連線分配的機器。
  3. 安裝並啟動相關元件。

一旦引導程序連線到分配的機器,它會上傳引導機器所需的檔案。這一般包括存放於上傳資料夾的(<cloudifyRoot>/clouds/<cloudProviderName>/upload

)的啟動指令碼和其他所需檔案,例如SSH金鑰檔案。一旦這些檔案上傳到機器,相關的引導指令碼就會啟動執行。

下表描述了引導*nix和Windows、管理以及執行應用服務的啟動指令碼。

Script OS Type Description
bootstrap-management.sh *nix Shell This script is used for bootstrapping both management and application service machines, and performs the following tasks as required:
  • Downloads the Cloudify distribution file
  • Installs Java (required to run the Cloudify agent)
  • Installs Cloudify
  • Runs the Cloudify agent
bootstrap-management.ps1 Windows PowerShell This script is used for bootstrapping both management and application machines, and performs the following tasks:
  • Downloads the Cloudify distrubtion file
  • Installs Java (required to run the Cloudify agent)
  • Installs Cloudify
bootstrap-client.ps1 Windows PowerShell This script is used for launching commands on remote machine running Windows
引導管理機器將啟動Cloudify控制器程序,而引導應用服務例項機器將只會啟動Cloudify代理。Cloudify代理使得控制器能夠使用服務例項機器安裝和擴充套件服務。

下面按照支援的機器型別介紹引導過程:

Cloudify管理備用機

當有關雲的驅動程式接收到引導雲的請求後,它執行如下任務:

  1. 從管理機器模板定義的可用機器資源池中,通過雲提供的API分配一臺機器。
  2. 通過SSH或WinRM連線所分配的機器。
  3. 安裝並啟動Cloudify管理元件,包括Cloudify控制器和相關雲的驅動。


應用程式服務備用機

當Cloudify控制器接收到安裝應用程式的請求時,它請求相關的雲驅動為應用程式準備所需的機器。雲驅動準備機器的過程如下:

  1. 從提供服務相關模板定義的可用機器資源池中,通過雲提供的API分配一臺機器。
  2. 通過SSH或WinRM連線所分配的機器。
  3. 安裝並啟動Cloudify代理。
  4. 使用相關服務的安裝指令碼初始化服務安安裝。


使用在傳統資料中心自定義的驅動分配機器,如果資源池中沒有可用機器,會顯示一條錯誤訊息:

Failed to create a new cloud node for template <your template name>, all available nodes are currently used

如果出現此錯誤,應用安裝的請求不會撤銷,Cloudify控制器會繼續反覆嘗試,直到有一臺可用機器。停止這一過程,可以從Cloudify命令列中用Ctrl-C結束安裝命令,然後執行相應的解除安裝命令。

先決條件

Cloudify的目標是最小化伺服器的前提條件,這樣可讓標準的作業系統能夠不預先安裝特定軟體,可以即刻執行Cloudify。下面的表格中列出了引導機器所需的前提條件:

Prerequisite Windows *nix
JDK JDK 1.6 or higher — download the latest update available (e.g.JDK 6 Update 23) JDK 1.6 or higher — download the latest update available (e.g.JDK 6 Update 23)
Available Disk Space 500 MB 500 MB
Network Ports
  • All ports open between machines in same service
  • All ports open between management machines and all other machines
  • On the management machine, ports 8099 and 8100 must be open for communication from the Internet via the machine’s public IP address. This allows the Cloudify shell to interact with the REST server and allows users to access the management web application.
  • All ports open between machines in same service
  • All ports open between management machines and all other machines
  • On the management machines, ports 8099 and 8100 must be open for communication from the Internet via the machine’s public IP address. This allows the Cloudify shell to interact with theREST server and allows users to access the management web application.
Credentials username and password; Active Directory is not supported in this version. username and password, or username and .pem file; Kerberos not supported in this version.
Operating System Specific Requirements
  • Windows file sharing enabled on port 445 (CIFS)
  • WinRM enabled on port 5985

    To enable WinRM on your machine before bootstrapping a cloud, at the PowerShell prompt with administrative credentials, type the following commands:

    • set-itemWSMan:\localhost\Client\TrustedHosts -Value * -Force
    • set-itemWSMan:\localhost\Shell\MaxMemoryPerShellMB -Value 0 -Force
    • Enable-PSRemoting
    • Set-ExecutionPolicy unrestricted

    Setting TrustedHosts to ‘*’ has security implications. Please consult with your IT department before running this command.

  • Windows PowerShell installed and included in the system path on the client machine (the machine where Cloudify shell is installed and runs the bootstrap-cloud command) and management machines. (Exists by default on Windows 7 and Windiws Server 2008)

Cloudify uses PowerShell to run commands on remote machines. Therefore, you must use a client machine running Windows to bootstrap a machine running Windows; however, a client machine running Windows can bootstrap a machine runnnig *nix.

  • wget
  • unzip
  • SSH daemon must be started and running por

另外,不同的雲環境有其自己的特定配置。下面是在雲環境下的預先配置:

雲驅動檔案:描述可被不同的Recipes引用關聯的模板和別名。每個模板定義了可用機器的資源池。

引導管理指令碼。

網路共享。

Cloudify分發檔案在本地的存放位置。

雲環境管理控制檯的身份資訊(認證資訊、憑證等)

引導

下面的過程描述了引導雲和應用程式的過程:

啟動引導程序為Cloudify管理提供機器:通過Cloudify命令列的相關命令引導雲。例如本地環境的命令是bootstrap-localcloud。特定雲環境的命令在其他相關的主題中。

一旦命令執行完成,會顯示Cloudify的Web管理控制檯的URL和Cloudify控制器的REST服務埠。另外,命令列也會把自動連線控制器作為引導的其中一個過程,所以不用手工執行connect命令進行連線。

啟動引導程序為應用服務準備機器:從Cloudify控制檯鍵入相關命令安裝應用。例如安裝PetClinic應用,install-application-timeout 10 <cloudify root>/examples/petclinic-simple

接下來

想得到更多的關於特定雲環境的配置請見相關主題:

想得到更多的關於特定雲環境的引導資訊,請見相關主題: