Openstack 從入門到放松

這篇文章我將分享openstack的主要知識點


這篇文章會涉及的主要內(nèi)容:

培訓(xùn)內(nèi)容圖
知識點名稱 具體內(nèi)容
基礎(chǔ)技術(shù)點 虛擬化基礎(chǔ)知識和云計算概念
Openstack 實驗環(huán)境搭建 手動安裝
支持服務(wù) ntp mariadb rabbitmq memecache
Keystone 概念理解百框,具體實現(xiàn)方法理解
Glance 實現(xiàn)原理疼鸟,和基本的鏡像制作方法
Nova nova對instance的生命周期管理,界面的instance 功能詳解
Cinder cinder工作原理
Neutron dhcp 原理,ML2 詳解,linux bridge,openvswitch
Metadata 服務(wù) 詳細(xì)介紹metadata
日常經(jīng)驗分享 日常案例分析幫助加深對openstack各個服務(wù)的理解

接下來我們按照上面的順序詳細(xì)的講解

  • 虛擬化:

  1. 虛擬化主要以qemu-kvm 來講解
  2. 其他基礎(chǔ)知識后期更新。。米诉。
  3. libvirt: The virtualization API
  4. 特別注意:
    virbr0 是 KVM 默認(rèn)創(chuàng)建的一個 Bridge,其作用是為連接其上的虛機網(wǎng)卡提供 NAT 訪問外網(wǎng)的功能篷帅。
    virbr0 默認(rèn)分配了一個IP 192.168.122.1史侣,并為連接其上的其他虛擬網(wǎng)卡提供 dhcp。使用的是開源軟件dnsmasq魏身。
  • 云計算基本概念:

IDC change history
What is IaaS

** Infrastructure as a Service (IaaS) is a form of cloud computing that provides virtualized computing resources (include cpu/memory/disk) over the Internet. IaaS is one of three main categories of cloud computing services, alongside Software as a Service (SaaS) and Platform as a Service (PaaS).** by Wikipedia

  • Openstack 和云計算:

OpenStack is a free and open-source software platform for cloud computing, mostly deployed as infrastructure-as-a-service (IaaS), whereby virtual servers and other resources are made available to customers.
The software platform consists of interrelated components that control diverse, multi-vendor hardware pools of processing, storage, and networking resources throughout a data center. Users either manage it through a web-based dashboard, through command-line tools, or through RESTful web services.

  • RESTful API:

Representational state transfer (REST) or RESTful web services is a way of providing interoperability between computer systems on the Internet. REST-compliant Web services allow requesting systems to access and manipulate textual representations of Web resources using a uniform and predefined set of stateless operations. Other forms of Web service exist, which expose their own arbitrary sets of operations such as WSDL and SOAP.[1]
"Web resources" were first defined on the World Wide Web as documents or files identified by their URLs, but today they have a much more generic and abstract definition encompassing every thing or entity that can be identified, named, addressed or handled, in any way whatsoever, on the Web. In a RESTful Web service, requests made to a resource's URI will elicit a response that may be in XML, HTML, JSON or some other defined format. The response may confirm that some alteration has been made to the stored resource, and it may provide hypertext links to other related resources or collections of resources. Using HTTP, as is most common, the kind of operations available include those predefined by the HTTP verbs GET, POST, PUT, DELETE and so on.

API calls
  • Openstack 核心組件:
Openstack Component

咱們今天培訓(xùn)的內(nèi)容除了swift 之外都會涉及到,以上內(nèi)容就是咱們在學(xué)習(xí)openstack之前需要了解的基礎(chǔ)知識惊橱。

  • 總結(jié)
    云計算其實就是將咱們原本傳統(tǒng)IT 的工作都用軟件代替,其中主要的技術(shù)就是我們現(xiàn)在比較成熟的虛擬化來代替的箭昵,云計算是豐富了虛擬化的管理税朴。由此可見,OpenStack 針對的是 IT 基礎(chǔ)設(shè)施家制,是 IaaS 這個層次的云操作系統(tǒng)
  • Support 服務(wù):

支持服務(wù)指的是哪些不是openstack的組件正林,但是openstack 卻必須的服務(wù):例如,ntp提供時間同步颤殴,rabbitmq 提供消息服務(wù)卓囚,mariadb 提供數(shù)據(jù)庫服務(wù),httpd 提供web 服務(wù)等诅病。接下來我們將逐一進行介紹:

OpenStack Support Service
  • NTP 服務(wù)
    1. NTP Server 搭建
    2. NTP client 的配置
    3. 基本調(diào)試方法
  • RabbitMQ

RabbitMQ是一個由erlang開發(fā)的AMQP(Advanced Message Queue )的開源實現(xiàn)。AMQP 的出現(xiàn)其實也是應(yīng)了廣大人民群眾的需求粥烁,雖然在同步消息通訊的世界里有很多公開標(biāo)準(zhǔn)(如 COBAR的 IIOP 贤笆,或者是 SOAP 等),但是在異步消息處理中卻不是這樣讨阻,只有大企業(yè)有一些商業(yè)實現(xiàn)(如微軟的 MSMQ 芥永,IBM 的 Websphere MQ 等),因此钝吮,在 2006 年的 6 月埋涧,Cisco 板辽、Redhat、iMatix 等聯(lián)合制定了 AMQP 的公開標(biāo)準(zhǔn)棘催。
RabbitMQ 官網(wǎng)

1. Why RabbitMQ ? RabbitMQ 解決了什么問題劲弦?沒有會如何?

1)信息的發(fā)送者和接收者如何維持這個連接醇坝,如果一方的連接中斷邑跪,這期間的數(shù)據(jù)如何方式丟失?

2)如何降低發(fā)送者和接收者的耦合度呼猪?

3)如何讓Priority高的接收者先接到數(shù)據(jù)画畅?

4)如何做到load balance?有效均衡接收者的負(fù)載宋距?

5)如何有效的將數(shù)據(jù)發(fā)送到相關(guān)的接收者轴踱?也就是說將接收者subscribe 不同的數(shù)據(jù),如何做有效的filter谚赎。

6)如何做到可擴展淫僻,甚至將這個通信模塊發(fā)到cluster上?

7)如何保證接收者接收到了完整沸版,正確的數(shù)據(jù)嘁傀?

AMDQ協(xié)議解決了以上的問題,而RabbitMQ實現(xiàn)了AMQP

RabbitMQ 架構(gòu)
  1. Rabbimq web plug-in

安裝代碼:
yum install rabbitmq-server -y 1>/dev/null sed -i "2a ${MGMT_IP} $(hostname)" /etc/hosts systemctl start rabbitmq-server.service
創(chuàng)建用戶和賦予權(quán)限:

rabbitmqctl add_user openstack $RABBIT_PASS 1>/dev/null rabbitmqctl set_permissions openstack ".*" ".*" ".*" 1>/dev/null
#rabbitmq-plugins list
#enable rabbitmq_management boot after the os boot
#Use rabbitmq-web
啟動web UI Plug-In
rabbitmq-plugins enable rabbitmq_management 1>/dev/null 2>&1 systemctl restart rabbitmq-server.service &&

訪問ip:<15672> 默認(rèn)登錄密碼是guest/guest


RabbitMQ Web 界面
  • Mariadb
    數(shù)據(jù)庫這里我們主要探討下galera 數(shù)據(jù)庫高可用吧

MariaDB Galera Cluster 介紹

MariaDB集群是MariaDB同步多主機集群视粮。它僅支持XtraDB/ InnoDB存儲引擎(雖然有對MyISAM實驗支持 - 看wsrep_replicate_myisam系統(tǒng)變量)细办。

主要功能:

同步復(fù)制
真正的multi-master,即所有節(jié)點可以同時讀寫數(shù)據(jù)庫
自動的節(jié)點成員控制蕾殴,失效節(jié)點自動被清除
新節(jié)點加入數(shù)據(jù)自動復(fù)制
真正的并行復(fù)制笑撞,行級
用戶可以直接連接集群,使用感受上與MySQL完全一致
優(yōu)勢:

因為是多主钓觉,所以不存在Slavelag(延遲)
不存在丟失事務(wù)的情況
同時具有讀和寫的擴展能力
更小的客戶端延遲
節(jié)點間數(shù)據(jù)是同步的,而Master/Slave模式是異步的,不同slave上的binlog可能是不同的

  • Memcached
memecached 的作用
  1. 基本簡介:

Memcached是一種基于內(nèi)存的key-value存儲茴肥,用來存儲小塊的任意數(shù)據(jù)(字符串、對象)荡灾。這些數(shù)據(jù)可以是數(shù)據(jù)庫調(diào)用瓤狐、API調(diào)用或者是頁面渲染的結(jié)果。
Memcached簡潔而強大批幌。它的簡潔設(shè)計便于快速開發(fā)础锐,減輕開發(fā)難度,解決了大數(shù)據(jù)量緩存的很多問題荧缘。它的API兼容大部分流行的開發(fā)語言皆警。
本質(zhì)上,它是一個簡潔的key-value存儲系統(tǒng)截粗。
一般的使用目的是信姓,通過緩存數(shù)據(jù)庫查詢結(jié)果鸵隧,減少數(shù)據(jù)庫訪問次數(shù),以提高動態(tài)Web應(yīng)用的速度意推、提高可擴展性豆瘫。
The Identity service authentication mechanism for services uses Memcached to cache tokens.
The memcached service typically runs on the controller node.
memcached 官網(wǎng)

2. 在openstack中的安裝與配置:

yum install memcached python-memcached -y sed -i "s/127.0.0.1/$MGMT_IP/g" /etc/sysconfig/memcached systemctl enable memcached.service systemctl start memcached.service

2.1 如果是需要安裝最新的話:
wget http://memcached.org/latest tar -zxvf memcached-1.x.x.tar.gz cd memcached-1.x.x ./configure && make && make test && sudo make install

The Reliable, High Performance TCP/HTTP Load Balancer

OpenStack HA 架構(gòu)
Stateful Stateless
Cinder Volume Neutron Server
Neutron L3,DHCP agents OpenStack APls
Ceilometer central agent Apache web server
RabbitMQ Nova Scheduler
Mariadb Cinder Scheduler
Stateless service:

A service that provides a response after your request and then requires no further attention. To make a stateless service highly available, you need to provide redundant instances and load balance them. OpenStack services that are stateless include nova-api, nova-conductor, glance-api, keystone-api, neutron-api, and nova-scheduler.

Stateful service:

A service where subsequent requests to the service depend on the results of the first request. Stateful services are more difficult to manage because a single action typically involves more than one request. Providing additional instances and load balancing does not solve the problem. For example, if the horizon user interface reset itself every time you went to a new page, it would not be very useful. OpenStack services that are stateful include the OpenStack database and message queue. Making stateful services highly available can depend on whether you choose an active/passive or active/active configuration.

Active/passive versus active/active


Stateful services can be configured as active/passive or active/active, which are defined as follows:
active/passive configuration
Maintains a redundant instance that can be brought online when the active service fails. For example, OpenStack writes to the main database while maintaining a disaster recovery database that can be brought online if the main database fails.
A typical active/passive installation for a stateful service maintains a replacement resource that can be brought online when required. Requests are handled using a virtual IP address (VIP) that facilitates returning to service with minimal reconfiguration. A separate application (such as Pacemaker or Corosync) monitors these services, bringing the backup online as necessary.

active/active configuration

Each service also has a backup but manages both the main and redundant systems concurrently. This way, if there is a failure, the user is unlikely to notice. The backup system is already online and takes on increased load while the main system is fixed and brought back online.
Typically, an active/active installation for a stateless service maintains a redundant instance, and requests are load balanced using a virtual IP address and a load balancer such as HAProxy.
A typical active/active installation for a stateful service includes redundant services, with all instances having an identical state. In other words, updates to one instance of a database update all other instances. This way a request to one instance is the same as a request to any other. A load balancer manages the traffic to these systems, ensuring that operational systems always handle the request.

*總結(jié)
有狀態(tài)服務(wù):后續(xù)對服務(wù)的請求依賴于之前對服務(wù)的請求。
無狀態(tài)服務(wù):對服務(wù)的請求之間沒有依賴關(guān)系左痢,是完全獨立的靡羡。

Active/Passive HA:集群只包括兩個節(jié)點簡稱主備。在這種配置下俊性,系統(tǒng)采用主和備用機器來提供服務(wù)略步,系統(tǒng)只在主設(shè)備上提供服務(wù)。在主設(shè)備故障時定页,備設(shè)備上的服務(wù)被啟動來替代主設(shè)備提供的服務(wù)趟薄。典型地,可以采用 CRM 軟件比如 Pacemaker 來控制主備設(shè)備之間的切換典徊,并提供一個虛機 IP 來提供服務(wù)杭煎。
Active/Active HA:集群只包括兩個節(jié)點時簡稱雙活,包括多節(jié)點時成為多主(Multi-master)卒落。在這種配置下羡铲,系統(tǒng)在集群內(nèi)所有服務(wù)器上運行同樣的負(fù)載。以數(shù)據(jù)庫為例儡毕,對一個實例的更新也切,會被同步到所有實例上。這種配置下往往采用負(fù)載均衡軟件比如 HAProxy 來提供服務(wù)的虛擬 IP腰湾。

云環(huán)境的 HA 將包括:

物理IT層:包括網(wǎng)絡(luò)設(shè)備比如交換機和路由器雷恃,存儲設(shè)備等
基礎(chǔ)設(shè)施:比如電力、空調(diào)和防火設(shè)施等
控制節(jié)點服務(wù)的 HA
虛機的 HA
應(yīng)用的 HA

Controller HA

memcached HA 配置
memcached_servers = controller1:11211,controller2:11211

Neutron L3 agent 使用 DVR

  • Keepalived

Keepalived is a routing software written in C. The main goal of this project is to provide simple and robust facilities for loadbalancing and high-availability to Linux system and Linux based infrastructures. Loadbalancing framework relies on well-known and widely used Linux Virtual Server (IPVS) kernel module providing Layer4 loadbalancing. Keepalived implements a set of checkers to dynamically and adaptively maintain and manage loadbalanced server pool according their health. On the other hand high-availability is achieved by VRRP protocol. VRRP is a fundamental brick for router failover. In addition, Keepalived implements a set of hooks to the VRRP finite state machine providing low-level and high-speed protocol interactions. Keepalived frameworks can be used independently or all together to provide resilient infrastructures.Keepalived is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

總結(jié):

以上费坊,我們就把主要的openstack support服務(wù)都有大致的梳理了下,接下來我們正式開始學(xué)習(xí)openstack的核心組件:

OpenStack history

掌握基本的概念和keystone 如何實現(xiàn)不同用戶不同權(quán)限


概念理解倒槐,命令行導(dǎo)入鏡像,web 導(dǎo)入附井,各種格式的image


介紹nova 對虛擬機的整個生命周期的管理讨越,圍繞對虛擬機的管理來展開。
主要涉及的內(nèi)容為:

openstack 提供的虛擬機操作
image.png

同步調(diào)用
API 直接調(diào)用 Scheduler 的接口是同步調(diào)用永毅。
其特點是 API 發(fā)出請求后需要一直等待谎痢,直到 Scheduler 完成對 Compute 的調(diào)度,將結(jié)果返回給 API 后 API 才能夠繼續(xù)做后面的工作卷雕。
異步調(diào)用
API 通過 Messaging 間接調(diào)用 Scheduler 就是異步調(diào)用。
其特點是 API 發(fā)出請求后不需要等待票从,直接返回漫雕,繼續(xù)做后面的工作滨嘱。
Scheduler 從 Messaging 接收到請求后執(zhí)行調(diào)度操作,完成后將結(jié)果也通過 Messaging 發(fā)送給 API浸间。

openstack 設(shè)計思想:

OpenStack 作為開放的 Infrastracture as a Service 云操作系統(tǒng)太雨,支持業(yè)界各種優(yōu)秀的技術(shù)。
這些技術(shù)可能是開源免費的魁蒜,也可能是商業(yè)收費的囊扳。
這種開放的架構(gòu)使得 OpenStack 能夠在技術(shù)上保持先進性,具有很強的競爭力兜看,同時又不會造成廠商鎖定(Lock-in)锥咸。

那 OpenStack 的這種開放性體現(xiàn)在哪里呢?
一個重要的方面就是采用基于 Driver 的框架细移。

以 Nova 為例搏予,OpenStack 的計算節(jié)點支持多種 Hypervisor。
包括 KVM, Hyper-V, VMWare, Xen, Docker, LXC 等弧轧。

neutron 部分主要為大家講解
neutron 的架構(gòu)雪侥,
ml2
l3 agent
dhcp原理
openvswitch agent
防火墻原理
安全組原理
浮動IP原理

虛擬機獲取ip地址log如下

Aug 4 17:36:09 10 dnsmasq[7361]: read /var/lib/neutron/dhcp/37c18fec-8e10-48cc-b697-4e418254bde5/addn_hosts - 8 addresses
Aug 4 17:36:09 10 dnsmasq-dhcp[7361]: read /var/lib/neutron/dhcp/37c18fec-8e10-48cc-b697-4e418254bde5/host
Aug 4 17:36:09 10 dnsmasq-dhcp[7361]: read /var/lib/neutron/dhcp/37c18fec-8e10-48cc-b697-4e418254bde5/opts
Aug 4 17:36:10 10 dnsmasq[7361]: read /var/lib/neutron/dhcp/37c18fec-8e10-48cc-b697-4e418254bde5/addn_hosts - 8 addresses
Aug 4 17:36:10 10 dnsmasq-dhcp[7361]: read /var/lib/neutron/dhcp/37c18fec-8e10-48cc-b697-4e418254bde5/host
Aug 4 17:36:10 10 dnsmasq-dhcp[7361]: read /var/lib/neutron/dhcp/37c18fec-8e10-48cc-b697-4e418254bde5/opts
Aug 4 17:36:24 10 dnsmasq-dhcp[7361]: DHCPDISCOVER(tap49b03d00-49) 10.245.59.50 fa:16:3e:cd:60:f2
Aug 4 17:36:24 10 dnsmasq-dhcp[7361]: DHCPOFFER(tap49b03d00-49) 192.168.2.3 fa:16:3e:cd:60:f2
Aug 4 17:36:24 10 dnsmasq-dhcp[7361]: DHCPREQUEST(tap49b03d00-49) 192.168.2.3 fa:16:3e:cd:60:f2
Aug 4 17:36:24 10 dnsmasq-dhcp[7361]: DHCPACK(tap49b03d00-49) 192.168.2.3 fa:16:3e:cd:60:f2 host-192-168-2-3

cinder 介紹:

以lvm 為例,了解cinder工作的原理精绎,了解volume是如何給不同的compute節(jié)點上的虛擬機使用的速缨。


volume 管理操作

metadata service 相關(guān)的組件包括:

neutron-ns-metadata-proxy:作為一個獨立的進程運行在 master virtual router 的 network namespace 中。它接受由 qrouter 通過 iptables 控制轉(zhuǎn)交的 instance 訪問 metadata service 的 request代乃。
neutron-metadata-agent:Neutorn 的組件之一旬牲,運行在Neutorn 網(wǎng)絡(luò)節(jié)點上,通過本地 socket 和 neutron-ns-metadata-proxy 進程通信襟己,其配置文件是 /etc/neutron/metadata_agent.ini引谜;它會通過 http(s) 和 Nova metadata service 通信;它通過 RPC 和 neutron-server 通信擎浴。你還可以通過配置 metadata_workers 的值來運行多個獨立的進程员咽。
nova metadata api:這個和 nova api 類似,是 nova 的 API 的一部分贮预,通常使用的端口是 8775贝室。它接收neutron-metadata-agent 的request。

秘鑰登錄虛擬機
訪問169.254.169.254
web顯示hostname 與虛擬內(nèi)部一致
web console.log如下:

[ 2.555658] intel_rapl: no valid rapl domains found in package 0
[ 3.930465] cloud-init[594]: Cloud-init v. 0.7.5 running 'init-local' at Tue, 01 Aug 2017 09:59:31 +0000. Up 3.81 seconds.
CentOS Linux 7 (Core)
Kernel 3.10.0-514.el7.x86_64 on an x86_64
localhost login: [ 10.272690] cloud-init[951]: Cloud-init v. 0.7.5 running 'init' at Tue, 01 Aug 2017 09:59:38 +0000. Up 10.17 seconds.
[ 10.358342] cloud-init[951]: ci-info: ++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++
[ 10.359299] cloud-init[951]: ci-info: +--------+------+--------------+---------------+-------------------+
[ 10.360157] cloud-init[951]: ci-info: | Device | Up | Address | Mask | Hw-Address |
[ 10.360994] cloud-init[951]: ci-info: +--------+------+--------------+---------------+-------------------+
[ 10.361832] cloud-init[951]: ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . |
[ 10.362673] cloud-init[951]: ci-info: | eth0: | True | 192.168.1.18 | 255.255.255.0 | fa:16:3e:fc:f2:1c |
[ 10.363511] cloud-init[951]: ci-info: +--------+------+--------------+---------------+-------------------+
[ 10.364348] cloud-init[951]: ci-info: ++++++++++++++++++++++++++++++++++Route info+++++++++++++++++++++++++++++++++++
[ 10.365252] cloud-init[951]: ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
[ 10.366152] cloud-init[951]: ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
[ 10.367058] cloud-init[951]: ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
[ 10.367951] cloud-init[951]: ci-info: | 0 | 0.0.0.0 | 192.168.1.1 | 0.0.0.0 | eth0 | UG |
[ 10.370877] cloud-init[951]: ci-info: | 1 | 169.254.169.254 | 192.168.1.1 | 255.255.255.255 | eth0 | UGH |
[ 10.371790] cloud-init[951]: ci-info: | 2 | 192.168.1.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U |
[ 10.372701] cloud-init[951]: ci-info: +-------+-----------------+-------------+-----------------+-----------+-------+
[ 18.633488] cloud-init[2195]: Cloud-init v. 0.7.5 running 'modules:config' at Tue, 01 Aug 2017 09:59:46 +0000. Up 18.56 seconds.
[ 19.108819] cloud-init[2218]: Cloud-init v. 0.7.5 running 'modules:final' at Tue, 01 Aug 2017 09:59:47 +0000. Up 19.02 seconds.
ci-info: ++++++++++Authorized keys from /home/centos/.ssh/authorized_keys for user centos+++++++++++
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ci-info: | Keytype | Fingerprint (md5) | Options | Comment |
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ci-info: | ssh-rsa | 27:a4:f2:53:f1:22:fa:49:38:d4:29:94:ea:6a:eb:07 | - | Generated-by-Nova |
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ec2:
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 256 e6:11:61:b1:f2:58:17:f1:85:09:3c:3a:3f:6d:f6:e1 (ECDSA)
ec2: 256 06:47:1b:8e:60:55:93:57:81:62:fe:52:ab:8e:f8:b8 (ED25519)
ec2: 2048 0f:ee:b4:c9:e9:57:e5:e2:94:20:3c:e8:bb:73:be:a3 (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBO1UDFGJBY2E17mcMz2DGL49g6xb6+r4nyqsXGjgsMK9f+U2fPBMzdhwlqI/Rb1/qnZrF2wLtIrc4W2rzgKBPgQ=
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAJPbvtXyej18U9Z99lUJODaWsZpOgcoE42PcwsrVcGX
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5+iEjBNOntpwTIWfOZn+b7/uF21f1/7SPRpqBkmmm7pP2ZlajeWkf4XVn5Yasik6NLFWZpyVa8EebJDixnl6X2KTtZnNCtLmVAnUyyxPW5pTX92J+qkHpzjPIqDYUUcCNsIpHP7iyAPnJ9PE+/bHUWLE7zT45dPJgX+JxngZFGYSevnv8nA/ERIGdswy/pYgoJLDwlDc/TwbdV22CvDrX2XKilifgn9LBZcnL4kE1f2NdXnqCUvAQ8fMgBCetkkK/k2LKCwHpvOmLhIh9OdecsAHw8Clq3cIiRf3tV+KjxnLtd8bjjNyhWRCBIt4e3joQKf3hQwM5q9+hp6MVr2xn
-----END SSH HOST KEY KEYS-----
[ 19.160399] cloud-init[2218]: Cloud-init v. 0.7.5 finished at Tue, 01 Aug 2017 09:59:47 +0000. Datasource DataSourceOpenStack [net,ver=2]. Up 19.15 seconds

虛擬機開機執(zhí)行shell腳本示例
總結(jié):

cloud-init 是 linux 的一個工具仿吞,當(dāng)系統(tǒng)啟動時滑频,cloud-init 可從 nova metadata 服務(wù)或者 config drive 中獲取 metadata,完成包括但不限于下面的定制化工作:

設(shè)置 default locale
設(shè)置 hostname
添加 ssh keys到 .ssh/authorized_keys
設(shè)置用戶密碼
配置網(wǎng)絡(luò)
安裝軟件包

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末唤冈,一起剝皮案震驚了整個濱河市峡迷,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖绘搞,帶你破解...
    沈念sama閱讀 212,542評論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件彤避,死亡現(xiàn)場離奇詭異,居然都是意外死亡夯辖,警方通過查閱死者的電腦和手機琉预,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,596評論 3 385
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來蒿褂,“玉大人圆米,你說我怎么就攤上這事∽乃ǎ” “怎么了娄帖?”我有些...
    開封第一講書人閱讀 158,021評論 0 348
  • 文/不壞的土叔 我叫張陵,是天一觀的道長谴供。 經(jīng)常有香客問我块茁,道長,這世上最難降的妖魔是什么桂肌? 我笑而不...
    開封第一講書人閱讀 56,682評論 1 284
  • 正文 為了忘掉前任数焊,我火速辦了婚禮,結(jié)果婚禮上崎场,老公的妹妹穿的比我還像新娘佩耳。我一直安慰自己,他們只是感情好谭跨,可當(dāng)我...
    茶點故事閱讀 65,792評論 6 386
  • 文/花漫 我一把揭開白布干厚。 她就那樣靜靜地躺著,像睡著了一般螃宙。 火紅的嫁衣襯著肌膚如雪蛮瞄。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,985評論 1 291
  • 那天谆扎,我揣著相機與錄音挂捅,去河邊找鬼。 笑死堂湖,一個胖子當(dāng)著我的面吹牛闲先,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播无蜂,決...
    沈念sama閱讀 39,107評論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼伺糠,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了斥季?” 一聲冷哼從身側(cè)響起训桶,我...
    開封第一講書人閱讀 37,845評論 0 268
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后渊迁,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體慰照,經(jīng)...
    沈念sama閱讀 44,299評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,612評論 2 327
  • 正文 我和宋清朗相戀三年琉朽,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片稚铣。...
    茶點故事閱讀 38,747評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡箱叁,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出惕医,到底是詐尸還是另有隱情耕漱,我是刑警寧澤,帶...
    沈念sama閱讀 34,441評論 4 333
  • 正文 年R本政府宣布抬伺,位于F島的核電站螟够,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏峡钓。R本人自食惡果不足惜妓笙,卻給世界環(huán)境...
    茶點故事閱讀 40,072評論 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望能岩。 院中可真熱鬧寞宫,春花似錦、人聲如沸拉鹃。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,828評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽膏燕。三九已至钥屈,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間坝辫,已是汗流浹背篷就。 一陣腳步聲響...
    開封第一講書人閱讀 32,069評論 1 267
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留阀溶,地道東北人腻脏。 一個月前我還...
    沈念sama閱讀 46,545評論 2 362
  • 正文 我出身青樓,卻偏偏與公主長得像银锻,于是被迫代替她去往敵國和親永品。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 43,658評論 2 350

推薦閱讀更多精彩內(nèi)容