天天看點

openstack-M版安裝部署

[openstack資訊簡介]

Openstack項目是一個開源的雲計算平台,它為廣大雲平台提供了可大規模擴充的平台,全世界的雲計算技術人員創造了這個項目,通過一組互相關聯的服務來提供了Iaas基礎解決方案,每一個服務都通過提供自身的API來提供服務,個人或者企業完全可以根據自身的需求來安裝一部分或者全部的服務。

通過下面一張表格來描述一下目前openstack的各個元件及功能。

Service Project name Description
Dashboard Horizon 通過提供了web服務實作openstack服務的互動,比如建立執行個體,配置IP以及配置通路控制。
Compute Nova 在系統環境中管理整個生态圈的計算。承擔着經過請求後的孵化,排程和回收虛拟機等一系列的責任,是核心元件,可以說是真正實作的角色。
Networking Neutron 提供了網絡服務,連接配接起了其他服務。為使用者提供API去定義網絡并将它們聯系起來。支援多種網絡供應商和新興的網絡技術,比如vxlan等。
Object Storage Swift 通過了RESTful  API來存儲和檢索任務非結構化的資料對象,對資料同步和橫向擴充有很高的容錯性,不是挂載檔案目錄形勢的使用方式,它是将對象和檔案寫入多個驅動程式以確定資料在伺服器叢集中的完整性。
Block Cinder 提供了塊存儲和持久化,可插拔式的體系架構簡化了建立和管理儲存設備。
Identity Keystone 提供openstack服務的驗證和授權功能。為全部服務提供了通路接口。
Image service Glance 提供虛拟磁盤裝置的鏡像和檢索服務,在計算執行個體時以供使用。
Telemetry Ceilometer 可擴充的服務,提供了監控、測量、計費、統計等功能。
Orchestration Heat 通過組合模闆來進行的服務。
Database service Trove 為關系資料庫和非關系資料庫提供可擴充和可依賴的雲資料庫服務。
Data processing service Sahara 屬于openstack的大資料項目。是openstack與hadoop的融合。

[openstack體系架構]

下面這張圖完整的展現了openstack服務之間的聯系(Conceptualarchitecture概念架構):

openstack-M版安裝部署

從這張圖稍作了解的話還是能夠了解的,其他服務通過互相的寫作和工作為中間是VMs提供了各種服務。Keystone提供了驗證服務,Ceilometer作為了整個系統的監控,Horizon提供了UI通路界面,這3個服務主要起到了把控全局的作用。在左下角有一個Ironic,它的作用是解決實體機的添加、删除、安裝部署等功能,類似為叢集自動化增添節點。

可以看說,整個生态系統外圍掌控整個系統,内部各個服務互相協作提供各種功能,并且系統伸縮性大,擴充性高。

[openstack環境準備]

軟體:vmareworkstation 11

作業系統:CentOS7 3.10.0-327.e17.x86_64

2台:一台作為控制節點controller,一台作為計算節點compute。

基本設定:

1.      每一個都選擇2張網卡,一張對外提供服務,需要連接配接網際網路,可以是橋接或者nat模式。一張提供内部網絡,作為openstack内部聯系的網絡,在VMware選擇host only模式。

2.      修改對應的主機名,并在hosts做主機與IP的解析,

3.      做時間同步,可以是本地,也可以是時間伺服器,在centos7中改為chrony,調整完畢後設定開機啟動。

4.      注!:友善起見,把防火牆和selinux全部關閉,確定網絡暢通。

到這一步,基本上的環境配置就搞定了,我相信有餘力去學習openstack,那對linux有了基本的了解,上述步驟應該能搞定。最後重新開機系統準備安裝。

[openstack基本安裝]

在centos上預設包含openstack版本,可以直接用yum安裝最新的版本不用費力去尋找相關的源碼包。

[root@ceshiapp_2~]# yum install centos-release-openstack-mitaka.noarch -y

安裝openstack用戶端

[root@ceshiapp_2~]# yum install -y python-openstackclient

openstack自帶有openstack-selinux來管理openstack服務之間的安裝性能,這裡,為了實驗順利,這裡選擇忽略,實際情況可以根據需求選擇是否安裝。

注!:如沒有特殊說明以下安裝說明都是在controller中執行。

[資料庫及nosql安裝]

[root@controller~]yum install mariadb mariadb-server python2-PyMySQL

#yum安裝資料庫,用于到時候建立服務的資料庫 port:3306

[root@controller~]mysql_secure_installation #安全配置向導,包括root密碼等。

[[email protected]]# vim openstack.cnf

[mysqld]

......

bind-address= 0.0.0.0 #這個位址表示能夠讓所有的位址能遠端通路。

default-storage-engine= innodb

innodb_file_per_table

max_connections= 4096

collation-server= utf8_general_ci

character-set-server= utf8

#修改配置檔案,定義字元集和引擎,其他可按需修改。

這是yum安裝的資料庫,是mariadb是相容mysql的,也可以選擇源碼編譯安裝,安裝過程這裡不詳細講了。

MariaDB[(none)]> grant all on *.* to root@'%' identified by "root" ;

這裡先添加遠端登入的root使用者。

[[email protected]]# yum install -y mongodb-server mongodb

安裝mongodb資料庫,提高web通路的性能。Port:27017

[[email protected]]# vim /etc/mongod.conf

bind_ip = 192.168.10.200 #将IP綁定在控制節點上。

[[email protected]]# systemctl enable mongod.service

Createdsymlink from /etc/systemd/system/multi-user.target.wants/mongod.service to/usr/lib/systemd/system/mongod.service.

[[email protected]]# systemctl start mongod.service

設定開機自啟動。

[[email protected]]#yum install memcached python-memcached

[[email protected]]# systemctl enable memcached.service

Createdsymlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.

[[email protected]]# systemctl start memcached.service

安裝memcached并設定開機啟動。Port:11211 memcache用于緩存tokens

[rabbitmq消息隊列安裝與配置]

為了保持openstack項目松耦合,扁平化架構的特性,是以消息隊列在整個架構中扮演了交通樞紐的作用,是以消息隊列對openstack來說是必不可少的。不一定适用RabbitMQ,也可以是其他産品。

[[email protected]]# yum install -y rabbitmq-server

[[email protected]]# systemctl enable rabbitmq-server.service

Createdsymlink from/etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to/usr/lib/systemd/system/rabbitmq-server.service.

[[email protected]]# systemctl start rabbitmq-server.service

[[email protected]]# rabbitmqctl add_user openstack openstack

Creatinguser "openstack" ...

[[email protected]]# rabbitmqctl set_permissions openstack ".*" ".*"".*"

Settingpermissions for user "openstack" in vhost "/" ...

#安裝rabbidmq,建立使用者并設定允許讀寫操作。

[Identity service—keystone]

接下來是openstack第一個驗證服務——keystone服務安裝,它為項目管理提供了一系列重要的驗證服務和服務目錄。openstack的其他服務安裝之後都需要再keystone進行驗證過,之後能夠跟蹤所有在區域網路内安裝好的openstack服務。

安裝keystone之前先配置好資料庫環境。

[root@controller~]# mysql -uroot -p

MariaDB[(none)]> CREATE DATABASE keystone;

QueryOK, 1 row affected (0.00 sec)

MariaDB[(none)]> grant all on keystone.* to keystone@localhost identified by'keystone';

QueryOK, 0 rows affected (0.09 sec)

MariaDB[(none)]> grant all on keystone.* to keystone@'%' identified by'keystone';           

QueryOK, 0 rows affected (0.00 sec)

MariaDB[(none)]> flush privileges;

QueryOK, 0 rows affected (0.05 sec)

#生成admin tokens

[root@controller~]# openssl rand -hex 10

bc6aec97cc5e93a009b1

安裝keystone httpd wsgi

WSGI是Web Server Gateway Interface的縮寫,是python定義的web伺服器或者架構的一種接口,位于web應用程式和web伺服器之間。

[root@controller~]# yum install -y openstack-keystone httpd mod_wsgi

修改keystone配置檔案

[root@controller~]# vim /etc/keystone/keystone.conf

[default]

[DEFAULT]

...

admin_token= bc6aec97cc5e93a009b1 #這裡填之前生成的admintokens

[database]

connection= mysql+pymysql://keystone:keystone@controller/keystone

[token]

provider= fernet #控制tokens驗證、建設和撤銷的操作方式

[root@controller~]# sh -c "keystone-manage db_sync" keystone #設定資料庫同步

[root@controller~]# keystone-manage fernet_setup --keystone-user keystone --keystone-groupkeystone #生成fernetkeys

[root@controller~]# vim /etc/httpd/conf/httpd.conf  #修改配置檔案

ServerAdmincontroller

接下來配置虛拟主機

[root@controller~]# vim /etc/httpd/conf.d/wsgi-keystone.conf

    WSGIScriptAlias //usr/bin/keystone-wsgi-public

    WSGIApplicationGroup %{GLOBAL}

    WSGIPassAuthorization On

    ErrorLogFormat "%{cu}t %M"

    ErrorLog /var/log/httpd/keystone-error.log

    CustomLog/var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>

        Require all granted

    </Directory>

</VirtualHost>

<VirtualHost*:35357>

    WSGIDaemonProcess keystone-adminprocesses=5 threads=1 user=keystone group=keystone display-na

me=%{GROUP}

    WSGIProcessGroup keystone-admin

    WSGIScriptAlias //usr/bin/keystone-wsgi-admin

[root@controller~]# systemctl enable httpd.service

[root@controller~]# systemctl start httpd.service

配置上述生成的admin token

[root@controller~]# export OS_TOKEN=bc6aec97cc5e93a009b1

配置endpoint URL

[root@controller~]# export OS_URL=http://controller:35357/v3

Identity 版本

[root@controller~]# export OS_IDENTITY_API_VERSION=3

建立identity service 。

[root@controller~]# openstack service create   --namekeystone --description "OpenStack Identity" identity

驗證服務管理着openstack項目中所有服務的API endpoint,服務之間的互相聯系取決于驗證服務中的API endpoint。根據使用者不同,它提供了三種形式的API endpoint,分别是admin、internal、public。admin預設允許管理使用者和租戶,internal和public不允許管理使用者和租戶。因為在openstack中一般都會設定為2張網卡,一張對外提供服務,一張是内部互動提供的網絡,是以對外一般使用public API 能夠使得使用者對他們自己的雲進行管理。Admin API 一般對管理者提供服務,而internal API 是針對使用者對自己所使用opservice服務進行管理。是以一般一個openstack服務都會建立多個API,針對不用的使用者提供不同等級的服務。

[root@controller~]# openstack endpoint create --region RegionOne identity publichttp://controller:5000/v3

[root@controller~]# openstack endpoint create --region RegionOne identity internalhttp://controller:5000/v3

[root@controller~]# openstack endpoint create --region RegionOne identity adminhttp://controller:35357/v3  

接下來是建立預設的域、工程(租戶)、角色、使用者以及綁定。

[root@controller~]# openstack domain create --description "Default Domain" default

[root@controller~]# openstack project create --domain default \

>   --description "Admin Project"admin

[root@controller~]# openstack user create --domain default  --password-prompt admin

UserPassword:

RepeatUser Password:#密碼admin

[root@controller~]# openstack role add --project admin --user admin admin

對demo工程、使用者、角色進行綁定。

[root@controller~]# openstack project create --domain default  --description "Service Project" service

>   --description "Demo Project" demo

[root@controller~]# openstack user create --domain default  --password-prompt demo

RepeatUser Password: #demo

[root@controller~]# openstack role add --project demo --user demo user

測試驗證服務是否安裝有效。

1.在keystone-paste.ini中的這3個字段中删除admin_token_auth

[root@controller~]# vim /etc/keystone/keystone-paste.ini

[pipeline:public_api]

......admin_token_auth

[pipeline:admin_api]

[pipeline:api_v3]

2.删除剛才設定的OS_token和OS_URL

Unset OS_TOKEN OS_URL

然後開始驗證,沒報錯說明成功了。

[root@controller~]# openstack --os-auth-url http://controller:35357/v3 \

>   --os-project-domain-name default--os-user-domain-name default \

>   --os-project-name admin --os-username admintoken issue

Password:#admin

驗證demo使用者:

[root@controller~]# openstack --os-auth-url http://controller:5000/v3 \

>   --os-project-name demo --os-username demotoken issue

Password:#demo

最後建立user腳本

export OS_PROJECT_DOMAIN_NAME=default

export OS_USER_DOMAIN_NAME=default

export OS_PROJECT_NAME=admin

export OS_USERNAME=admin

export OS_PASSWORD=admin

export OS_AUTH_URL=http://controller:35357/v3

export OS_IDENTITY_API_VERSION=3

export OS_IMAGE_API_VERSION=2

這裡如果是多個台伺服器配置的話。這樣的腳本就會友善你配置管理者的API。主要還是起到了友善的作用。

[Image service—glance]

依舊先建立資料庫以及相關使用者。

[root@controller~]# mysql -u root -p

MariaDB[(none)]> CREATE DATABASE glance;

QueryOK, 1 row affected (0.04 sec)

MariaDB[(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \

    ->  IDENTIFIED BY 'glance';

QueryOK, 0 rows affected (0.28 sec)

MariaDB[(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \

QueryOK, 0 rows affected (0.01 sec)

QueryOK, 0 rows affected (0.08 sec)

[root@controller~]# . admin-openrc注!如果在其他伺服器上就需要執行這個腳本,來配置admin api

接來下建立glance使用者以及綁定。

[root@controller~]# openstack user create --domain default --password-prompt glance

RepeatUser Password: #glance

将admin 角色增加到 service工程和 glance使用者。

[root@controller~]# openstack role add --project service --user glance admin

[root@controller~]# openstack service create --name glance \

>   --description "OpenStack Image"p_w_picpath

建立p_w_picpath服務的三種接口

[root@controller~]# openstack endpoint create --region RegionOne \

>   p_w_picpath public http://controller:9292

>   p_w_picpath internal http://controller:9292

[root@controller~]# openstack endpoint create --region RegionOne   p_w_picpath admin http://controller:9292

安裝openstack-glance并修改配置檔案

[root@controller~]# yum install -y openstack-glance

[root@controller~]# vim /etc/glance/glance-api.conf

connection= mysql+pymysql://glance:glance@controller/glance

[keystone_authtoken]

auth_uri= http://controller:5000

auth_url= http://controller:35357

memcached_servers= controller:11211

auth_type= password

project_domain_name= default

user_domain_name= default

project_name= service

username= glance

password= glance

[paste_deploy]

flavor= keystone

[glance_store]

stores= file,http

default_store= file

filesystem_store_datadir= /var/lib/glance/p_w_picpaths/

[root@controller~]# vim /etc/glance/glance-registry.conf

做資料庫同步。輸出資訊忽略。

[root@controller ~]# su -s /bin/sh -c "glance-managedb_sync" glance

Option"verbose" from group "DEFAULT" is deprecated forremoval.  Its value may be silentlyignored in the future.

/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1056:OsloDBDeprecationWarning: EngineFacade is deprecated; please useoslo_db.sqlalchemy.enginefacade

  expire_on_commit=expire_on_commit,_conf=conf)

/usr/lib/python2.7/site-packages/pymysql/cursors.py:146:Warning: Duplicate index 'ix_p_w_picpath_properties_p_w_picpath_id_name' defined on thetable 'glance.p_w_picpath_properties'. This is deprecated and will be disallowed in afuture release.

  result = self._query(query)

開機啟動。

[root@controller~]# systemctl enable openstack-glance-api.service \

>   openstack-glance-registry.service

Createdsymlink from/etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to/usr/lib/systemd/system/openstack-glance-api.service.

Createdsymlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.serviceto /usr/lib/systemd/system/openstack-glance-registry.service.

[root@controller~]# systemctl start openstack-glance-api.service \

下載下傳一個鏡像并建立,然後可以list檢視是否成功。

[root@controller~]wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

[root@controller~]# openstack p_w_picpath create "cirros" \

>   --file cirros-0.3.4-x86_64-disk.img \

>   --disk-format qcow2 --container-format bare\

>   --public

鏡像active成功。

[root@controller~]# openstack p_w_picpath list

+--------------------------------------+--------+--------+

|ID                                   | Name  | Status |

|7f715e8d-6f29-4e78-ab6e-d3b973d20cf7 | cirros | active |

[Compute-service nova] 

依舊為計算服務建立資料庫。這裡要為nova建立2個資料庫。

MariaDB[(none)]> CREATE DATABASE nova_api;CREATE DATABASE nova;

QueryOK, 1 row affected (0.09 sec)

MariaDB[(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \

    ->  IDENTIFIED BY 'nova';

QueryOK, 0 rows affected (0.15 sec)

MariaDB[(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%'    IDENTIFIED BY 'nova';

MariaDB[(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost'    IDENTIFIED BY 'nova';  

MariaDB[(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'    IDENTIFIED BY 'nova';        

建立使用者并綁定admin角色

[root@controller~]# . admin-openrc

[root@controller~]# openstack user create --domain default  --password-prompt nova

RepeatUser Password: #nova

[root@controller~]# openstack role add --project service --user nova admin

建立nova計算服務。

[root@controller~]# openstack service create --name nova \

>   --description "OpenStack Compute"compute

建立nova的api。

>   compute public http://controller:8774/v2.1/%\(tenant_id\)s

[root@controller~]# openstack endpoint create --region RegionOne   compute internalhttp://controller:8774/v2.1/%\(tenant_id\)s

[root@controller~]# openstack endpoint create --region RegionOne   compute adminhttp://controller:8774/v2.1/%\(tenant_id\)s  

安裝nova元件。

[root@controller~]# yum install -y openstack-nova-api openstack-nova-conductor \

  openstack-nova-consoleopenstack-nova-novncproxy \

  openstack-nova-scheduler

修改配置檔案,修改内容比較多,需要仔細比對一下。

[root@controller~]# vim /etc/nova/nova.conf

enabled_apis= osapi_compute,metadata

rpc_backend=rabbit

auth_strategy=keystone

my_ip=192.168.10.200# 設定内網IP

use_neutron=true#支援網絡服務

firewall_driver=nova.virt.libvirt.firewall.NoopFirewallDriver

[api_database]

connection=mysql+pymysql://nova:nova@controller/nova_api

connection=mysql+pymysql://nova:nova@controller/nova

[oslo_messaging_rabbit]

rabbit_host= controller

rabbit_userid= openstack

rabbit_password= openstack #之間建立的密碼。

username= nova

password= nova #之前建立的使用者密碼

[vnc]

vncserver_listen= $my_ip

vncserver_proxyclient_address= $my_ip

[glance]

.......

api_servers= http://controller:9292

[oslo_concurrency]

lock_path= /var/lib/nova/tmp

同步資料庫,忽略輸出。

[root@controller~]# su -s /bin/sh -c "nova-manage api_db sync" nova

[root@controller~]# su -s /bin/sh -c "nova-manage db sync" nova

設定開機啟動。

systemctlenable openstack-nova-api.service \

  openstack-nova-consoleauth.serviceopenstack-nova-scheduler.service \

  openstack-nova-conductor.serviceopenstack-nova-novncproxy.service

#systemctl start openstack-nova-api.service \

配置compute節點

[root@compute ~]# yum install -ycentos-release-openstack-mitaka #否則直接安裝openstack-nova-compute失敗

[root@compute ~]# yum install -y openstack-nova-compute

修改配置檔案

[root@compute~]# vim /etc/nova/nova.conf

rpc_backend= rabbit

auth_strategy= keystone

my_ip=192.168.10.201

use_neutron=true

api_servers=http://controller:9292

password= nova

[libvirt]

virt_type=qemu#egrep -c '(vmx|svm)' /proc/cpuinfo 如果顯示為0 則需要修改成qemu

lock_path=/var/lib/nova/tmp

rabbit_password= openstack

enabled=true

vncserver_listen=0.0.0.0

vncserver_proxyclient_address=$my_ip

novncproxy_base_url=http://controller:6080/vnc_auto.html

然後設定開機自啟動。

systemctlenable libvirtd.service openstack-nova-compute.service

systemctlstart libvirtd.service openstack-nova-compute.service

驗證結果,在compute上操作。4個up為ok

[root@compute~]# . admin-openrc

[root@compute~]# openstack compute service list

+----+------------------+------------+----------+---------+-------+----------------------------+

| Id |Binary           | Host       | Zone     | Status | State | Updated At                |

|  1 | nova-conductor   | controller | internal | enabled | up    | 2016-08-16T14:30:42.000000 |

|  2 | nova-scheduler   | controller | internal | enabled | up    | 2016-08-16T14:30:33.000000 |

|  3 | nova-consoleauth | controller | internal| enabled | up    |2016-08-16T14:30:39.000000 |

|  6 | nova-compute     | compute    | nova    | enabled | up    |2016-08-16T14:30:33.000000 |

[Network service—neutron ] 

Neutron最主要是功能是負責虛拟環境下的網絡,但它之前并不叫neutron,是叫quantum,因為被注冊然後才改名的。網絡在openstack中最複雜的功能,配置也是最繁瑣的,從官方文檔中單獨把網絡向導列出來寫一大篇文章就可以看出來。從L1到L7都有所涉及,openstack所有的服務都是通過網絡練習起來。像glance一樣,neutron本身并提供網絡服務,它的大部分功能都是通過Plugin提供的,除了DHCP和L3-agent,這些資訊在配置服務的過程中能展現出來。

Neutron本身有2種模式,一種是provider networks,指的是營運商提供網絡,可以說是外網,還有一種是Self-service networks,這是私人網絡,可以說内網,但是第二種網絡模式包含第一種,是以基本上都會選擇第二種部署方式,對外提供服務用外網,對内使用内網,是以部署openstack一般都會使用2張網卡。

在controller上配置資料庫,賦權等操作。

MariaDB[(none)]> CREATE DATABASE neutron;

MariaDB[(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost'  IDENTIFIED BY 'neutron';

QueryOK, 0 rows affected (0.36 sec)

MariaDB[(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%'    IDENTIFIED BY 'neutron'; 

建立neutron使用者,将admin角色綁定到使用者上。

[root@controller~]# openstack user create --domain default --password-prompt neutron

RepeatUser Password: #neutron

[root@controller~]# openstack role add --project service --user neutron admin

建立neutron網絡服務以及三種API接口。

[root@controller~]# openstack service create --name neutron \

>   --description "OpenStackNetworking" network

>   network public http://controller:9696

[root@controller~]# openstack endpoint create --region RegionOne   network internal http://controller:9696

[root@controller~]# openstack endpoint create --region RegionOne   network admin http://controller:9696

網絡配置,安裝元件。

[root@controller~]# yum install openstack-neutron openstack-neutron-ml2   openstack-neutron-linuxbridge ebtables -y

修改neutron配置檔案。

[root@controller~]# vim /etc/neutron/neutron.conf

core_plugin= ml2

service_plugins= router

allow_overlapping_ips= True

notify_nova_on_port_status_changes= True

notify_nova_on_port_data_changes= True

connection= mysql+pymysql://neutron:neutron@controller/neutron

username= neutron

password= neutron

[nova]

region_name= RegionOne

lock_path= /var/lib/neutron/tmp

修改ML2配置檔案

[root@controller~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]

type_drivers= flat,vlan,vxlan

tenant_network_types= vxlan

mechanism_drivers= linuxbridge,l2population

extension_drivers= port_security

[ml2_type_flat]

flat_networks= provider

[ml2_type_vxlan]

vni_ranges= 1:1000

[securitygroup]

enable_ipset= True

設定橋接代理配置檔案。

[root@controller~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]

physical_interface_mappings=provider:eno33554984#内網網卡

[vxlan]

enable_vxlan= true

local_ip= 192.168.10.200 #controller ip

l2_population= true

enable_security_group= true

firewall_driver=neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

修改Layer-3 代理配置檔案。

[root@controller~]# vim /etc/neutron/l3_agent.ini

interface_driver= neutron.agent.linux.interface.BridgeInterfaceDriver

external_network_bridge=

修改DHCP代理配置檔案。

[root@controller~]# vim /etc/neutron/dhcp_agent.ini

dhcp_driver= neutron.agent.linux.dhcp.Dnsmasq

enable_isolated_metadata = true

修改中繼資料代理配置檔案。

vim/etc/neutron/metadata_agent.ini

nova_metadata_ip= controller

metadata_proxy_shared_secret= meta #中繼資料共享的一個密碼,之後會用到。

在nova配置檔案中修改neutron的參數。

[neutron]

url =http://controller:9696

service_metadata_proxy= True

metadata_proxy_shared_secret= meta

設定軟連接配接

[root@controller~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

同步資料庫。

[root@controllerneutron]# su -s /bin/sh -c "neutron-db-manage --config-file/etc/neutron/neutron.conf \

>   --config-file /etc/neutron/plugins/ml2/ml2_conf.iniupgrade head" neutron

出現OK成功。

重新開機nova-api服務

[root@controllerneutron]# systemctl restart openstack-nova-api.service

設定開機啟動并啟動neutron服務。

#systemctl enable neutron-server.service \

  neutron-linuxbridge-agent.serviceneutron-dhcp-agent.service \

  neutron-metadata-agent.service

#systemctl enable neutron-l3-agent.service

#systemctl start neutron-server.service \

  neutron-metadata-agent.service

#systemctlstart neutron-l3-agent.service

配置完控制節點,配置compute節點的網絡服務。

[root@compute~]# yum install -y openstack-neutron-linuxbridge ebtables ipset

修改neutron配置檔案

[root@compute~]# vim /etc/neutron/neutron.conf

.....

修改linux橋接代理的配置檔案

[root@compute~]# vim /etc/neutron/plugins/ml2/linuxbridge.ini

physical_interface_mappings= provider:eno33554984

firewall_driver= neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

local_ip= 192.168.10.201 #内網IP

修改nova中neutron子產品的配置資訊。

[root@compute~]# vim /etc/nova/nova.conf

重新開機compute服務。

#systemctlrestart openstack-nova-compute.service

設定neutron開機啟動。

#systemctlenable neutron-linuxbridge-agent.service

#systemctl start neutron-linuxbridge-agent.service

驗證neutron服務,出現5個笑臉說明OK。

[root@controller~]# neutron agent-list

+--------------+--------------+------------+-------------------+-------+----------------+---------------+

|id           | agent_type   | host      | availability_zone | alive | admin_state_up | binary        |

|7476f2bf-    | DHCP agent   | controller | nova              | :-)  | True           | neutron-dhcp- |

|dced-44d6-8a |              |            |                   |       |                | agent         |

|a0-2aab951b1 |              |            |                   |       |                |               |

|961          |              |            |                   |       |                |               |

|82319909-a4b | Linux bridge | compute   |                   | :-)   | True           | neutron-      |

|2-47d9-ae42- | agent        |            |                   |       |                | linuxbridge-  |

|288282ad3972 |              |            |                   |       |                | agent         |

|b465f93f-    | Metadata     | controller |                   | :-)   | True          | neutron-      |

|90c3-4cde-   | agent        |            |                   |       |                | metadata-     |

|949c-        |              |            |                   |       |                | agent         |

|47c205a74f65 |              |            |                   |       |                |               |

|e662d628-327 | L3 agent     | controller| nova              | :-)   | True           | neutron-l3-ag |

|b-4695-92e1- |              |            |                   |       |                | ent           |

|76da38806b05 |              |            |                   |       |                |               |

|fa84105f-d49 | Linux bridge | controller |                   | :-)   | True           | neutron-      |

|7-4b64-9a53- | agent        |            |                   |       |                | linuxbridge-  |

|3b1f074e459e |              |            |                   |       |                | agent         |

[root@compute~]# neutron ext-list

+---------------------------+-----------------------------------------------+

|alias                     | name                                          |

|default-subnetpools       | DefaultSubnetpools                           |

|network-ip-availability   | Network IPAvailability                       |

|network_availability_zone | Network Availability Zone                     |

|auto-allocated-topology   | AutoAllocated Topology Services             |

|ext-gw-mode               | Neutron L3Configurable external gateway mode |

|binding                   | PortBinding                                  |

|agent                     | agent                                         |

|subnet_allocation         | SubnetAllocation                             |

|l3_agent_scheduler        | L3 AgentScheduler                            |

|tag                       | Tagsupport                                  |

|external-net              | Neutronexternal network                      |

|net-mtu                   | NetworkMTU                                   |

|availability_zone         | AvailabilityZone                             |

|quotas                    | Quotamanagement support                      |

|l3-ha                     | HA Routerextension                           |

|provider                  | ProviderNetwork                              |

|multi-provider            | MultiProvider Network                        |

|address-scope             | Addressscope                                 |

|extraroute                | Neutron ExtraRoute                           |

|timestamp_core            | Time StampFields addition for core resources |

|router                    | Neutron L3Router                             |

|extra_dhcp_opt            | Neutron ExtraDHCP opts                       |

| dns-integration           | DNS Integration                               |

|security-group            |security-group                               |

|dhcp_agent_scheduler      | DHCP AgentScheduler                          |

|router_availability_zone  | RouterAvailability Zone                      |

|rbac-policies             | RBACPolicies                                |

|standard-attr-description | standard-attr-description                     |

|port-security             | PortSecurity                                 |

|allowed-address-pairs     | AllowedAddress Pairs                         |

|dvr                       | DistributedVirtual Router                    |

[Dashboard-horizon]

    其實将neutron安裝完畢以後openstack項目最基本的已經能夠運作起來了,但是為了操作更加友善直覺,我們再安裝WebUI,就是horizon。

[root@controller~]# yum install -y openstack-dashboard

[root@controller~]# vim /etc/openstack-dashboard/local_settings

OPENSTACK_HOST= "controller"

ALLOWED_HOSTS= ['*',]

OPENSTACK_KEYSTONE_URL= "http://%s:5000/v3.0" % OPENSTACK_HOST

OPENSTACK_API_VERSIONS= {

    "identity": 3,

    "volume": 2,

    "compute": 2,

}

OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT= True

OPENSTACK_KEYSTONE_DEFAULT_DOMAIN= "default"

OPENSTACK_KEYSTONE_DEFAULT_ROLE= "user"

TIME_ZONE= "UTC"#時區

SESSION_ENGINE= 'django.contrib.sessions.backends.cache'

CACHES= {

    'default': {

         'BACKEND':'django.core.cache.backends.memcached.MemcachedCache',

         'LOCATION': 'controller:11211',

    }

重新開機httpd 和memcached服務。

[root@controller~]# systemctl restart httpd.service

[root@controller~]# systemctl restart memcached.service

繼續閱讀