OpenStack--newton安裝(一)

一.服務器基礎配制

1.如果是新的服務器,先安裝常用軟件,配制yum源,關閉防火墻和selinux等,基本操作如下

yum install lrzsz net-tools ntp vim tree wget -y
systemctl stop firewalld && systemctl disable firewalld
setenforce 0
vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled  ##這里改為disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

配置epel的yum源

rpm -Uvh http://mirrors.zju.edu.cn/epel/7Server/x86_64/e/epel-release-7-10.noarch.rpm  ##直接運行這條命令,經過我自己的測試,這個epel源的速度還是比較快的
yum install yum-plugin-fastestmirror -y   ##安裝這個yum插件,可以在yum安裝軟件的時候選擇速度比較快的源

yum源配置結束后可以使用下面的命令,檢測并重新生成yum緩存

yum repolist
yum clean all && yum makecache

基礎配置完成后最好能夠重啟一下服務器
下面我來說明一下本次安裝openstack的拓撲圖(很粗糙,不要見笑)

Paste_Image.png

從上面的拓撲圖可以看出來,OpenStack并不是一個軟件,它是由多個工具組合而成的一個集合體,這也是很多初學者不能很快搭建出OpenStack的原因.個人覺得,多搭建幾遍,了解它每個工具的作用,然后很多東西就自然而然的通了.
以上的基礎操作,是需要在管理節點和計算節點都要操作的,下面進入正式的安裝

二.OpenStack安裝

1. 在兩個服務器節點安裝OpenStack的軟件倉庫,安裝OpenStack的客戶端和selinux的管理工具
[root@Marvin-OpenStack ~]# yum install http://mirrors.zju.edu.cn/centos/7.3.1611/cloud/x86_64/openstack-newton/centos-release-openstack-newton-1-1.el7.noarch.rpm -y  ## 安裝OpenStack的軟件倉庫
[root@Marvin-OpenStack ~]#  yum install python-openstackclient -y  ## 安裝Openstack客戶端
[root@Marvin-Compute ~]# yum install openstack-selinux -y  ## 安裝selinux管理工具

其實上面這一步應該也算做基礎配置當中,下面進行正式安裝管理節點的軟件

2.在管理節點安裝MariaDB,并修改配置做初始化操作
[root@Marvin-OpenStack ~]# yum install mariadb mariadb-server python2-PyMySQL -y
在目錄/etc/my.cnf.d/下創建openstack.cnf文件
[root@Marvin-OpenStack ~]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 10.0.0.56
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
[root@Marvin-OpenStack ~]# systemctl enable mariadb && systemctl start mariadb ## 啟動mariadb并設置開機自啟
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@Marvin-OpenStack ~]# lsof -i:3306  ## 查看數據庫是否啟動
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mysqld  4299 mysql   17u  IPv4  33131      0t0  TCP Marvin-OpenStack:mysql (LISTEN)
[root@Marvin-OpenStack ~]# mysql_secure_installation  ## 初始化數據庫

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y   ##這里設置數據庫密碼,在學習階段密碼盡可能的簡單,我這里是123456
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
在初始化數據庫完成后,一定要使用root用戶來登錄,驗證數據庫是否可以正常登錄
[root@Marvin-OpenStack ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit
Bye

數據庫安裝完成!!!

3.管理節點安裝rabbitmq消息隊列
[root@Marvin-OpenStack ~]# yum install rabbitmq-server -y  ## 安裝
[root@Marvin-OpenStack ~]# systemctl enable rabbitmq-server && systemctl start rabbitmq-server  ## 啟動
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
創建openstack用戶,并附加權限
[root@Marvin-OpenStack ~]# rabbitmqctl add_user openstack openstack  ## 創建用戶
Creating user "openstack" ...
[root@Marvin-OpenStack ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"   ## 附加權限
Setting permissions for user "openstack" in vhost "/" ...
[root@Marvin-OpenStack ~]# rabbitmq-plugins enable rabbitmq_management  ## 啟動web管理界面,使用rabbitmq-plugins list可以列出rabbit所有的可用插件
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@Marvin-OpenStack... started 6 plugins.
[root@Marvin-OpenStack ~]# lsof -i:15672  ## 養成習慣,查看服務是否啟動,rabbitmq的服務端口是15672
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 4507 rabbitmq   54u  IPv4  37049      0t0  TCP *:15672 (LISTEN)

使用web登錄驗證,登錄地址: http://10.0.0.56:15672 用戶名密碼均為:guest

Paste_Image.png

rabbitmq消息隊列安裝完成!!!

4.管理節點安裝Keystone認證服務

在安裝keystone服務之前,應該創建相應的數據庫,并且授權;
為了方便,我們一次性將所有用到的數據庫都創建完成,分別是:
keystone, glance, nova, nova_api, neutron, cinder
需要注意的是,在對數據庫進行授權的時候,我這里默認密碼也和數據庫名稱相同,方便記憶也不會出錯

[root@Marvin-OpenStack ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database keystone;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on keystone.* to 'keystone'@'localhost' identified by 'keystone';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on keystone.* to 'keystone'@'%' identified by 'keystone';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on glance.* to 'glance'@'localhost' identified by 'glance';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on glance.* to 'glance'@'%' identified by 'glance';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on nova.* to 'nova'@'%' identified by 'nova';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on nova.* to 'nova'@'localhost' identified by 'nova';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on nova_api.* to 'nova'@'localhost' identified by 'nova';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on nova_api.* to 'nova'@'%' identified by 'nova';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database neutron;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on neutron.* to 'neutron'@'localhost' identified by 'neutron';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on neutron.* to 'neutron'@'%' identified by 'neutron'; 
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> create database cinder;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on cinder.* to 'cinder'@'localhost' identified by 'cinder';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on cinder.* to 'cinder'@'%' identified by 'cinder'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| cinder             |
| glance             |
| information_schema |
| keystone           |
| mysql              |
| neutron            |
| nova               |
| nova_api           |
| performance_schema |
+--------------------+
9 rows in set (0.00 sec)

MariaDB [(none)]> exit
Bye

創建數據庫授權是件需要很細心的工作,一定不能出錯,否走后面會出現很多你意想不到的錯誤,下面去安裝配置keystone

[root@Marvin-OpenStack ~]# yum install openstack-keystone httpd mod_wsgi -y  ## 安裝
[root@Marvin-OpenStack ~]# vim /etc/keystone/keystone.conf  ## 修改配置文件
[database]  ## 模塊名稱
connection = mysql+pymysql://keystone:keystone@10.0.0.56/keystone   ## 大約在640行
[memcache]
servers = 10.0.0.56:11211 ## 大約在1476行
[token]
provider = fernet  ## 大約在2659行
driver = memcache  ## 大約在2669行
[root@Marvin-OpenStack ~]# grep '^[a-z]' /etc/keystone/keystone.conf   ## 可以看看一共修改了的內容
connection = mysql+pymysql://keystone:keystone@10.0.0.56/keystone   ## 數據庫
servers = 10.0.0.56:11211    ## memcache
provider = fernet          ## token的提供者
driver = memcache      ## token的存放位置
可以看出來我們都有配制memcache,但是并沒有安裝memcache,現在安裝
[root@Marvin-OpenStack ~]# yum install memcached python-memcached -y
[root@Marvin-OpenStack ~]# vim /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 10.0.0.56,::1"  ## 這里修改成自己主機的IP地址
[root@Marvin-OpenStack ~]# systemctl enable memcached && systemctl start memcached  ## 啟動memcache
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@Marvin-OpenStack ~]# lsof -i:11211  ## 檢查
COMMAND    PID      USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
memcached 5672 memcached   26u  IPv4  40367      0t0  TCP Marvin-OpenStack:memcache (LISTEN)
memcached 5672 memcached   27u  IPv6  40368      0t0  TCP localhost:memcache (LISTEN)
memcached 5672 memcached   28u  IPv4  40369      0t0  UDP Marvin-OpenStack:memcache 
memcached 5672 memcached   29u  IPv6  40370      0t0  UDP localhost:memcache
現在來同步keystone的數據庫信息
[root@Marvin-OpenStack ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone  ## 同步
[root@Marvin-OpenStack ~]# mysql -h 10.0.0.56 -ukeystone -pkeystone -e "use keystone;show tables;"  ## 驗證
+------------------------+
| Tables_in_keystone     |
+------------------------+
| access_token           |
| assignment             |
| config_register        |
| consumer               |
| credential             |
| endpoint               |
| endpoint_group         |
| federated_user         |
| federation_protocol    |
| group                  |
| id_mapping             |
| identity_provider      |
| idp_remote_ids         |
| implied_role           |
| local_user             |
| mapping                |
| migrate_version        |
| nonlocal_user          |
| password               |
| policy                 |
| policy_association     |
| project                |
| project_endpoint       |
| project_endpoint_group |
| region                 |
| request_token          |
| revocation_event       |
| role                   |
| sensitive_config       |
| service                |
| service_provider       |
| token                  |
| trust                  |
| trust_role             |
| user                   |
| user_group_membership  |
| whitelisted_config     |
+------------------------+
看到數據庫的表,就說明OK了,現在去注冊keystone的相關服務
[root@Marvin-OpenStack ~]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
[root@Marvin-OpenStack ~]# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
[root@Marvin-OpenStack ~]# keystone-manage bootstrap --bootstrap-password admin \
>     --bootstrap-admin-url http://10.0.0.56:35357/v3/ \
>     --bootstrap-internal-url http://10.0.0.56:35357/v3/ \
>     --bootstrap-public-url http://10.0.0.56:5000/v3/ \
>     --bootstrap-region-id RegionOn
完成后登錄數據庫,檢查注冊是否成功
[root@Marvin-OpenStack ~]# mysql -ukeystone -pkeystone
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use keystone;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [keystone]> show tables;
+------------------------+
| Tables_in_keystone     |
+------------------------+
| access_token           |
| assignment             |
| config_register        |
| consumer               |
| credential             |
| endpoint               |
| endpoint_group         |
| federated_user         |
| federation_protocol    |
| group                  |
| id_mapping             |
| identity_provider      |
| idp_remote_ids         |
| implied_role           |
| local_user             |
| mapping                |
| migrate_version        |
| nonlocal_user          |
| password               |
| policy                 |
| policy_association     |
| project                |
| project_endpoint       |
| project_endpoint_group |
| region                 |
| request_token          |
| revocation_event       |
| role                   |
| sensitive_config       |
| service                |
| service_provider       |
| token                  |
| trust                  |
| trust_role             |
| user                   |
| user_group_membership  |
| whitelisted_config     |
+------------------------+
37 rows in set (0.00 sec)

MariaDB [keystone]> select * from user\G
*************************** 1. row ***************************
                id: 4799fa14964b4703bd84a93d3b792660
             extra: {}
           enabled: 1
default_project_id: NULL
        created_at: 2017-09-02 02:36:15
    last_active_at: NULL
1 row in set (0.00 sec)

MariaDB [keystone]> select * from role\G
*************************** 1. row ***************************
       id: 097281195831406fa3e3782465aa922a
     name: admin
    extra: {}
domain_id: <<null>>
*************************** 2. row ***************************
       id: 9fe2ff9ee4384b1894a90878d3e92bab
     name: _member_
    extra: {}
domain_id: <<null>>
2 rows in set (0.00 sec)

MariaDB [keystone]> select * from endpoint\G
*************************** 1. row ***************************
                id: 41838de3d5204c9dbf173321b8bc05d7
legacy_endpoint_id: NULL
         interface: internal
        service_id: 1575e305f3aa4750b10304f38aa54b5e
               url: http://10.0.0.56:35357/v3/
             extra: {}
           enabled: 1
         region_id: RegionOne
*************************** 2. row ***************************
                id: d8b9d6bf135b482e852c6483ce30e4f9
legacy_endpoint_id: NULL
         interface: admin
        service_id: 1575e305f3aa4750b10304f38aa54b5e
               url: http://10.0.0.56:35357/v3/
             extra: {}
           enabled: 1
         region_id: RegionOne
*************************** 3. row ***************************
                id: e83d3ee63f2a473e809931900ec71174
legacy_endpoint_id: NULL
         interface: public
        service_id: 1575e305f3aa4750b10304f38aa54b5e
               url: http://10.0.0.56:5000/v3/
             extra: {}
           enabled: 1
         region_id: RegionOne
3 rows in set (0.00 sec)

MariaDB [keystone]> exit
Bye
keystone就配置好了,去開啟apache服務了
[root@Marvin-OpenStack ~]# vim /etc/httpd/conf/httpd.conf
95 ServerName 10.0.0.56:80  ## 第95行修改apache的服務地址
[root@Marvin-OpenStack ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/  ## 將keystone配置文件鏈接到apache默認目錄下
[root@Marvin-OpenStack ~]# systemctl enable httpd && systemctl start httpd  ## 啟動
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@Marvin-OpenStack ~]# lsof -i:80  ## 驗證
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   5886   root    4u  IPv6  43065      0t0  TCP *:http (LISTEN)
httpd   5897 apache    4u  IPv6  43065      0t0  TCP *:http (LISTEN)
httpd   5898 apache    4u  IPv6  43065      0t0  TCP *:http (LISTEN)
httpd   5899 apache    4u  IPv6  43065      0t0  TCP *:http (LISTEN)
httpd   5900 apache    4u  IPv6  43065      0t0  TCP *:http (LISTEN)
httpd   5901 apache    4u  IPv6  43065      0t0  TCP *:http (LISTEN)
驗證性息
[root@Marvin-OpenStack ~]# openstack user list
Missing value auth-url required for auth plugin password  ## 這里不成功,是因為環境變量沒有配制
配置環境變量
[root@Marvin-OpenStack ~]# export OS_USERNAME=admin
[root@Marvin-OpenStack ~]# export OS_PASSWORD=admin
[root@Marvin-OpenStack ~]# export OS_PROJECT_NAME=admin
[root@Marvin-OpenStack ~]# export OS_USER_DOMAIN_NAME=default
[root@Marvin-OpenStack ~]# export OS_PROJECT_DOMAIN_NAME=default
[root@Marvin-OpenStack ~]# export OS_AUTH_URL=http://10.0.0.56:35357/v3
[root@Marvin-OpenStack ~]# export OS_IDENTITY_API_VERSION=3
[root@Marvin-OpenStack ~]# openstack user  list
+----------------------------------+-------+
| ID                               | Name  |
+----------------------------------+-------+
| 4799fa14964b4703bd84a93d3b792660 | admin |
+----------------------------------+-------+

keystone配置完成

5.創建項目,用戶,角色,并為各用戶賦予角色和項目,按照要求配置環境變量
## 創建service項目
[root@Marvin-OpenStack ~]# openstack project create --domain default \
>     --description "Service Project" service
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Service Project                  |
| domain_id   | default                          |
| enabled     | True                             |
| id          | 692ff9bb43a14bbca347d1151d9bb996 |
| is_domain   | False                            |
| name        | service                          |
| parent_id   | default                          |
+-------------+----------------------------------+
## 創建demo項目
[root@Marvin-OpenStack ~]# openstack project create --domain default \
>      --description "Demo Project" demo
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Demo Project                     |
| domain_id   | default                          |
| enabled     | True                             |
| id          | 9e6ed2044de448c5b6064da5e61108f3 |
| is_domain   | False                            |
| name        | demo                             |
| parent_id   | default                          |
+-------------+----------------------------------+
## 創建demo用戶,密碼也為demo
[root@Marvin-OpenStack ~]# openstack user create --domain default \
>      --password-prompt demo
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | bccfde0f0711448c8e3855ac4dcb8e19 |
| name                | demo                             |
| password_expires_at | None                             |
+---------------------+----------------------------------+
## 創建user角色
[root@Marvin-OpenStack ~]# openstack role create user
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | f2c217d721874682b7987d5e6a363905 |
| name      | user                             |
+-----------+----------------------------------+
## 把demo用戶加入到demo項目,并賦予user角色的權限
[root@Marvin-OpenStack ~]# openstack role add --project demo --user demo user
## 用同樣的方法建立glance, nova, neutron, cinder 用戶,并將他們加入service項目,賦予admin角色權限
[root@Marvin-OpenStack ~]# openstack user create --domain default   --password-prompt glance  ## 創建glance用戶
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 7f9ad6700c9a4c5b9c2a9b788dc623e1 |
| name                | glance                           |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@Marvin-OpenStack ~]# openstack role add --project service --user glance admin  ## 加入項目和角色
[root@Marvin-OpenStack ~]# openstack user create --domain default   --password-prompt nova
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 091ccd11a04c40c0a764f7ab988fe572 |
| name                | nova                             |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@Marvin-OpenStack ~]# openstack role add --project service --user nova admin
[root@Marvin-OpenStack ~]# openstack user create --domain default   --password-prompt neutron
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 02cb936cd3c744d3aabf5a775e8d8f92 |
| name                | neutron                          |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@Marvin-OpenStack ~]# openstack role add --project service --user neutron admin
[root@Marvin-OpenStack ~]# openstack user create --domain default   --password-prompt cinder
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 4a1a121dd6194784a625ce842aa96b56 |
| name                | cinder                           |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@Marvin-OpenStack ~]# openstack role add --project service --user cinder admin
## 驗證admin和demo是否可以申請到token的令牌,需要注意的是:admin和demo請求的端口是不一樣的,admin是35357端口,demo使用的是5000端口
[root@Marvin-OpenStack ~]# unset OS_AUTH_URL OS_PASSWORD
[root@Marvin-OpenStack ~]# openstack --os-auth-url http://10.0.0.56:35357/v3 \
>     --os-project-domain-name default --os-user-domain-name default \
>     --os-project-name admin --os-username admin token issue
Password:   ## 輸入admin密碼
+------------+--------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                        |
+------------+--------------------------------------------------------------------------------------------------------------+
| expires    | 2017-09-02 14:12:33+00:00                                                                                    |
| id         | gAAAAABZqq5BuqekQMg2ngLYfbk-uePRrhgk9MmI2Z2J9-vQ6NeGhlwzkOPA__A2byWM-                                        |
|            | JN68q7CngGcCvJsHnefk1FOSrQgHrEOOkoJm7_oEqGHmL2_yH09h-TWv148ug78dJA4xmcJA8glI7-HrYe_D-                        |
|            | wJCCL9eZfh9gylPCtFDt05rISeK6k                                                                                |
| project_id | 8e8448db75034b1e8be0f7d6931be2d4                                                                             |
| user_id    | 4799fa14964b4703bd84a93d3b792660                                                                             |
+------------+--------------------------------------------------------------------------------------------------------------+
[root@Marvin-OpenStack ~]# openstack --os-auth-url http://10.0.0.56:5000/v3 \
>     --os-project-domain-name default --os-user-domain-name default \
>     --os-project-name demo --os-username demo token issue
Password:   ## 輸入demo密碼
+------------+--------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                        |
+------------+--------------------------------------------------------------------------------------------------------------+
| expires    | 2017-09-02 14:13:29+00:00                                                                                    |
| id         | gAAAAABZqq55u-TC1n7b3w2uRjuJn3GIRcHbXyznI9slRgSx-hfsuQhfJsQR4M91UxZoObyH7UXxafE0_MHGe8_y1w-_0M4yxJL6Q5uf-    |
|            | nmwTAbB1Vj4y_cQKq-w6ldAlV9UeW2ijP4BZVEg9JVqaBmvs-YaP0yEcq9U9S9fA6jrtHpsX1ScUOQ                               |
| project_id | 9e6ed2044de448c5b6064da5e61108f3                                                                             |
| user_id    | bccfde0f0711448c8e3855ac4dcb8e19                                                                             |
+------------+--------------------------------------------------------------------------------------------------------------+
## 驗證是沒有問題的,現在配制admin和demo的環境變量腳本
[root@Marvin-OpenStack ~]# vim admin-openstack
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://10.0.0.56:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
[root@Marvin-OpenStack ~]# vim demo-openstack
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=demo
export OS_AUTH_URL=http://10.0.0.56:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
## 驗證腳本
[root@Marvin-OpenStack ~]# source admin-openstack   ## 切換到admin變量
[root@Marvin-OpenStack ~]# openstack token issue   ## 執行命令成功
+------------+--------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                        |
+------------+--------------------------------------------------------------------------------------------------------------+
| expires    | 2017-09-02 14:18:09+00:00                                                                                    |
| id         | gAAAAABZqq-Rbg_PBi20TjUrf-U0tj0aqQR1ukbIBT_Evki13y0nZqMKBBnjnE3tsmLbtVUCoHP4w33MLWhGzFPgPoP-                 |
|            | GwhqiJxNUAsVRD0fi7tvtzqYelkqsCy5kkxggjLlfX54V0xzsVLqpgD2QJyZIiRJgk_FzunnTK4X5A9cjbk9MTqjo4A                  |
| project_id | 8e8448db75034b1e8be0f7d6931be2d4                                                                             |
| user_id    | 4799fa14964b4703bd84a93d3b792660                                                                             |
+------------+--------------------------------------------------------------------------------------------------------------+
[root@Marvin-OpenStack ~]# source demo-openstack   ## 切換到demo變量
[root@Marvin-OpenStack ~]# openstack token issue   ## 執行命令成功
+------------+--------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                        |
+------------+--------------------------------------------------------------------------------------------------------------+
| expires    | 2017-09-02 14:18:30+00:00                                                                                    |
| id         | gAAAAABZqq-nLZ-rhs6GseaHcVX22mxB2JkcJ19xL_CQUuC5UeEVMzUyyplqtbEAgs4ulvAb8zKcxcj3Pe3HYyttJSrtVpDxIiEZfGQBaLfl |
|            | OUQvEvkG9BBbXoVv2_dZ259CLjNE0hILzsu6e7b59RSgqdtbyOeLGPITHSbxFgS8aq6mpXidDvE                                  |
| project_id | 9e6ed2044de448c5b6064da5e61108f3                                                                             |
| user_id    | bccfde0f0711448c8e3855ac4dcb8e19                                                                             |
+------------+--------------------------------------------------------------------------------------------------------------+

用戶,角色,變量配置完成

6.安裝配置glance鏡像服務
6.1 創建image服務實體
[root@Marvin-OpenStack ~]# source admin-openstack  ## 切換到admin變量
[root@Marvin-OpenStack ~]# openstack service create --name glance   --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | 23c1ddf9a59048aea91fcce887ca97dc |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
6.2創建glance的API端口,分別創建public,internal,admin
[root@Marvin-OpenStack ~]# openstack endpoint create --region RegionOne \
>     image public http://10.0.0.56:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0e28a8c975904c28b5a2a9bc180efe02 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 23c1ddf9a59048aea91fcce887ca97dc |
| service_name | glance                           |
| service_type | image                            |
| url          | http://10.0.0.56:9292            |
+--------------+----------------------------------+
[root@Marvin-OpenStack ~]# openstack endpoint create --region RegionOne     image internal http://10.0.0.56:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 2cf91a5b1e1e4d19830627a1d1088b40 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 23c1ddf9a59048aea91fcce887ca97dc |
| service_name | glance                           |
| service_type | image                            |
| url          | http://10.0.0.56:9292            |
+--------------+----------------------------------+
[root@Marvin-OpenStack ~]# openstack endpoint create --region RegionOne     image admin http://10.0.0.56:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 806d8539a4f44c66b14488ee1979190d |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 23c1ddf9a59048aea91fcce887ca97dc |
| service_name | glance                           |
| service_type | image                            |
| url          | http://10.0.0.56:9292            |
+--------------+----------------------------------+
## 查看創建信息
[root@Marvin-OpenStack ~]# openstack service list
+----------------------------------+----------+----------+
| ID                               | Name     | Type     |
+----------------------------------+----------+----------+
| 1575e305f3aa4750b10304f38aa54b5e | keystone | identity |
| 23c1ddf9a59048aea91fcce887ca97dc | glance   | image    |
+----------------------------------+----------+----------+
[root@Marvin-OpenStack ~]# openstack endpoint list
+-----------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| ID                          | Region    | Service Name | Service Type | Enabled | Interface | URL                        |
+-----------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| 0e28a8c975904c28b5a2a9bc180 | RegionOne | glance       | image        | True    | public    | http://10.0.0.56:9292      |
| efe02                       |           |              |              |         |           |                            |
| 2cf91a5b1e1e4d19830627a1d10 | RegionOne | glance       | image        | True    | internal  | http://10.0.0.56:9292      |
| 88b40                       |           |              |              |         |           |                            |
| 41838de3d5204c9dbf173321b8b | RegionOne | keystone     | identity     | True    | internal  | http://10.0.0.56:35357/v3/ |
| c05d7                       |           |              |              |         |           |                            |
| 806d8539a4f44c66b14488ee197 | RegionOne | glance       | image        | True    | admin     | http://10.0.0.56:9292      |
| 9190d                       |           |              |              |         |           |                            |
| d8b9d6bf135b482e852c6483ce3 | RegionOne | keystone     | identity     | True    | admin     | http://10.0.0.56:35357/v3/ |
| 0e4f9                       |           |              |              |         |           |                            |
| e83d3ee63f2a473e809931900ec | RegionOne | keystone     | identity     | True    | public    | http://10.0.0.56:5000/v3/  |
| 71174                       |           |              |              |         |           |                            |
+-----------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
6.3 glance安裝配置,并同步數據信息
[root@Marvin-OpenStack ~]# yum install openstack-glance -y
[root@Marvin-OpenStack ~]# vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:glance@10.0.0.56/glance  ## 大約在1748行修改數據庫
[root@Marvin-OpenStack ~]# vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:glance@10.0.0.56/glance  ## 大約在1038行修改數據
[root@Marvin-OpenStack ~]# su -s /bin/sh -c "glance-manage db_sync" glance  ## 導入數據庫
Option "verbose" from group "DEFAULT" is deprecated for removal.  Its value may be silently ignored in the future.
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1171: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
  expire_on_commit=expire_on_commit, _conf=conf)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `ix_image_properties_image_id_name`. This is deprecated and will be disallowed in a future release.')
  result = self._query(query)  ## 這里的警告忽略掉
[root@Marvin-OpenStack ~]# mysql -h 10.0.0.56 -uglance -pglance -e "use glance;show tables;"  ## 驗證是否導入成功
+----------------------------------+
| Tables_in_glance                 |
+----------------------------------+
| artifact_blob_locations          |
| artifact_blobs                   |
| artifact_dependencies            |
| artifact_properties              |
| artifact_tags                    |
| artifacts                        |
| image_locations                  |
| image_members                    |
| image_properties                 |
| image_tags                       |
| images                           |
| metadef_namespace_resource_types |
| metadef_namespaces               |
| metadef_objects                  |
| metadef_properties               |
| metadef_resource_types           |
| metadef_tags                     |
| migrate_version                  |
| task_info                        |
| tasks                            |
+----------------------------------+
## 繼續修改glance的配置文件,配置認證訪問服務
[root@Marvin-OpenStack ~]# vim /etc/glance/glance-api.conf
[keystone_authtoken]  ## 在keystone_authtoken模塊下添加一下內容,大約在3178行
auth_uri = http://10.0.0.56:5000
auth_url = http://10.0.0.56:35357
memcached_servers = 10.0.0.56:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
-----------------------------------------------
[paste_deploy]
flavor = keystone   ##  3990行取消注釋
[glance_store]
stores = file,http   ##  1864行取消注釋
default_store = file  ## 1896行取消注釋
filesystem_store_datadir = /var/lib/glance/images   ## 2196行取消注釋
[root@Marvin-OpenStack ~]# vim /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_uri = http://10.0.0.56:5000
auth_url = http://10.0.0.56:35357
memcached_servers = 10.0.0.56:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
-----------------------------------------------
[paste_deploy]
flavor = keystone   ##  1910行取消注釋
## 查看glance-api.cnf修改的內容
[root@Marvin-OpenStack ~]# grep '^[a-z]' /etc/glance/glance-api.conf 
connection = mysql+pymysql://glance:glance@10.0.0.56/glance
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images
auth_uri = http://10.0.0.56:5000
auth_url = http://10.0.0.56:35357
memcached_servers = 10.0.0.56:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
flavor = keystone
## 查看glance-registry.conf修改的內容
connection = mysql+pymysql://glance:glance@10.0.0.56/glance
auth_uri = http://10.0.0.56:5000
auth_url = http://10.0.0.56:35357
memcached_servers = 10.0.0.56:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
flavor = keystone
## 啟動glance并設置開機自啟
[root@Marvin-OpenStack ~]# systemctl enable openstack-glance-api.service \
>     openstack-glance-registry.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
[root@Marvin-OpenStack ~]# systemctl start  openstack-glance-api.service     openstack-glance-registry.service
## 下載官方cirros鏡像,測試
鏡像下載:  http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
[root@Marvin-OpenStack ~]# ll
total 12992
-rw-r--r--  1 root root      260 Sep  2 21:16 admin-openstack
-rw-------. 1 root root      930 Sep  2 06:54 anaconda-ks.cfg
-rw-r--r--  1 root root 13287936 Sep  2 22:01 cirros-0.3.4-x86_64-disk.img   ## 上傳的鏡像
-rw-r--r--  1 root root      256 Sep  2 21:17 demo-openstack
## 創建一個cirros的鏡像,屬性是公開的
[root@Marvin-OpenStack ~]# openstack image create "cirros" \   
>      --file cirros-0.3.4-x86_64-disk.img \
>      --disk-format qcow2 --container-format bare \
>      --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                     |
| container_format | bare                                                 |
| created_at       | 2017-09-02T14:02:46Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/a131bcba-8fa7-4a0e-8333-a36046c31a9c/file |
| id               | a131bcba-8fa7-4a0e-8333-a36046c31a9c                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros                                               |
| owner            | 8e8448db75034b1e8be0f7d6931be2d4                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 13287936                                             |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2017-09-02T14:02:47Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+
[root@Marvin-OpenStack ~]# openstack image list  ## 查看鏡像
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| a131bcba-8fa7-4a0e-8333-a36046c31a9c | cirros | active |
+--------------------------------------+--------+--------+
[root@Marvin-OpenStack ~]# glance image-list
+--------------------------------------+--------+
| ID                                   | Name   |
+--------------------------------------+--------+
| a131bcba-8fa7-4a0e-8333-a36046c31a9c | cirros |
+--------------------------------------+--------+

glance服務安裝完成

7. nova安裝,nova的安裝是比較復雜的,是需要在管理節點和計算節點分別安裝的

7.1 管理節點安裝配置nova
[root@Marvin-OpenStack ~]# yum install openstack-nova-api openstack-nova-conductor   openstack-nova-console openstack-nova-novncproxy   openstack-nova-scheduler -y
[root@Marvin-OpenStack ~]# cd /etc/nova
[root@Marvin-OpenStack nova]# ll
total 300
-rw-r----- 1 root nova   2717 May 31 00:07 api-paste.ini
-rw-r----- 1 root nova 289748 Aug  3 17:52 nova.conf
-rw-r----- 1 root nova      4 May 31 00:07 policy.json
-rw-r--r-- 1 root root     64 Aug  3 17:52 release
-rw-r----- 1 root nova    966 May 31 00:07 rootwrap.conf
[root@Marvin-OpenStack nova]# vim nova.conf
 [DEFAULT]
auth_strategy=keystone  ## 14行,開啟驗證方式
use_neutron=true   ## 2062 開啟注釋,并修改為true
enabled_apis=osapi_compute,metadata  ## 3052行,開啟注釋
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver  ## 3265 開啟注釋
transport_url=rabbit://openstack:openstack@10.0.0.56   ## 3601 開啟注釋,并寫入消息驗證的地址
[api_database]
connection=mysql+pymysql://nova:nova@10.0.0.56/nova_api  ## 3661 開啟注釋,并修改數據庫地址
[database]
connection=mysql+pymysql://nova:nova@10.0.0.56/nova  ## 4678 開啟注釋,并修改數據庫地址
[keystone_authtoken]  ## 5429行,在這個下面添加nova的認證信息
auth_uri = http://10.0.0.56:5000
auth_url = http://10.0.0.56:35357
memcached_servers = 10.0.0.56:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova 
password = nova
[vnc]
vncserver_listen=0.0.0.0  ## 8384行,取消注釋,并修改為0.0.0.0
vncserver_proxyclient_address=10.0.0.56   ## 8396 取消注釋,修改為自己的主機地址
[glance]
api_servers=10.0.0.56:9292  ## 4813  取消注釋,并修改地址
[oslo_concurrency]
lock_path=/var/lib/nova/tmp   ## 6705行,取消注釋
## 查看nova.conf一共修改了多少內容
[root@Marvin-OpenStack nova]# grep '^[a-Z]' nova.conf
auth_strategy=keystone
use_neutron=true
enabled_apis=osapi_compute,metadata
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
transport_url=rabbit://openstack:openstack@10.0.0.56
connection=mysql+pymysql://nova:nova@10.0.0.56/nova_api
connection=mysql+pymysql://nova:nova@10.0.0.56/nova
api_servers=10.0.0.56:9292
auth_uri = http://10.0.0.56:5000
auth_url = http://10.0.0.56:35357
memcached_servers = 10.0.0.56:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova 
password = nova
lock_path=/var/lib/nova/tmp
vncserver_listen=0.0.0.0
vncserver_proxyclient_address=10.0.0.56
## 導入數據庫信息并驗證
[root@Marvin-OpenStack nova]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@Marvin-OpenStack nova]# su -s /bin/sh -c "nova-manage db sync" nova
WARNING: cell0 mapping not found - not syncing cell0.
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.')
  result = self._query(query)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.')
  result = self._query(query   ### 警告可以忽略
[root@Marvin-OpenStack nova]# mysql -h 10.0.0.56 -unova -pnova -e "use nova;show tables;"   ## 驗證,記住nova有兩個庫,一個nova,一個是nova_api
+--------------------------------------------+
| Tables_in_nova                             |
+--------------------------------------------+
| agent_builds                               |
| aggregate_hosts                            |
| aggregate_metadata                         |
| aggregates                                 |
| allocations                                |
| block_device_mapping                       |
| bw_usage_cache                             |
| cells                                      |
| certificates                               |
| compute_nodes                              |
| console_auth_tokens                        |
| console_pools                              |
| consoles                                   |
| dns_domains                                |
| fixed_ips                                  |
| floating_ips                               |
| instance_actions                           |
| instance_actions_events                    |
| instance_extra                             |
| instance_faults                            |
| instance_group_member                      |
| instance_group_policy                      |
| instance_groups                            |
| instance_id_mappings                       |
| instance_info_caches                       |
| instance_metadata                          |
| instance_system_metadata                   |
| instance_type_extra_specs                  |
| instance_type_projects                     |
| instance_types                             |
| instances                                  |
| inventories                                |
| key_pairs                                  |
| migrate_version                            |
| migrations                                 |
| networks                                   |
| pci_devices                                |
| project_user_quotas                        |
| provider_fw_rules                          |
| quota_classes                              |
| quota_usages                               |
| quotas                                     |
| reservations                               |
| resource_provider_aggregates               |
| resource_providers                         |
| s3_images                                  |
| security_group_default_rules               |
| security_group_instance_association        |
| security_group_rules                       |
| security_groups                            |
| services                                   |
| shadow_agent_builds                        |
| shadow_aggregate_hosts                     |
| shadow_aggregate_metadata                  |
| shadow_aggregates                          |
| shadow_block_device_mapping                |
| shadow_bw_usage_cache                      |
| shadow_cells                               |
| shadow_certificates                        |
| shadow_compute_nodes                       |
| shadow_console_pools                       |
| shadow_consoles                            |
| shadow_dns_domains                         |
| shadow_fixed_ips                           |
| shadow_floating_ips                        |
| shadow_instance_actions                    |
| shadow_instance_actions_events             |
| shadow_instance_extra                      |
| shadow_instance_faults                     |
| shadow_instance_group_member               |
| shadow_instance_group_policy               |
| shadow_instance_groups                     |
| shadow_instance_id_mappings                |
| shadow_instance_info_caches                |
| shadow_instance_metadata                   |
| shadow_instance_system_metadata            |
| shadow_instance_type_extra_specs           |
| shadow_instance_type_projects              |
| shadow_instance_types                      |
| shadow_instances                           |
| shadow_key_pairs                           |
| shadow_migrate_version                     |
| shadow_migrations                          |
| shadow_networks                            |
| shadow_pci_devices                         |
| shadow_project_user_quotas                 |
| shadow_provider_fw_rules                   |
| shadow_quota_classes                       |
| shadow_quota_usages                        |
| shadow_quotas                              |
| shadow_reservations                        |
| shadow_s3_images                           |
| shadow_security_group_default_rules        |
| shadow_security_group_instance_association |
| shadow_security_group_rules                |
| shadow_security_groups                     |
| shadow_services                            |
| shadow_snapshot_id_mappings                |
| shadow_snapshots                           |
| shadow_task_log                            |
| shadow_virtual_interfaces                  |
| shadow_volume_id_mappings                  |
| shadow_volume_usage_cache                  |
| snapshot_id_mappings                       |
| snapshots                                  |
| tags                                       |
| task_log                                   |
| virtual_interfaces                         |
| volume_id_mappings                         |
| volume_usage_cache                         |
+--------------------------------------------+
[root@Marvin-OpenStack nova]# mysql -h 10.0.0.56 -unova -pnova -e "use nova_api;show tables;"
+------------------------------+
| Tables_in_nova_api           |
+------------------------------+
| aggregate_hosts              |
| aggregate_metadata           |
| aggregates                   |
| allocations                  |
| build_requests               |
| cell_mappings                |
| flavor_extra_specs           |
| flavor_projects              |
| flavors                      |
| host_mappings                |
| instance_group_member        |
| instance_group_policy        |
| instance_groups              |
| instance_mappings            |
| inventories                  |
| key_pairs                    |
| migrate_version              |
| request_specs                |
| resource_provider_aggregates |
| resource_providers           |
+------------------------------+
## 驗證成功后啟動nova服務
[root@Marvin-OpenStack nova]# systemctl enable openstack-nova-api.service \
>      openstack-nova-consoleauth.service openstack-nova-scheduler.service \
>      openstack-nova-conductor.service openstack-nova-novncproxy.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.
[root@Marvin-OpenStack nova]# systemctl start openstack-nova-api.service     openstack-nova-consoleauth.service openstack-nova-scheduler.service     openstack-nova-conductor.service openstack-nova-novncproxy.service
## 創建compute服務
[root@Marvin-OpenStack ~]# openstack service create --name nova \
>      --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | d1559df37465470eb7fafbd93bffb183 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+
## 添加endpoint記錄
[root@Marvin-OpenStack ~]# openstack endpoint create --region RegionOne \
>     compute public http://10.0.0.56:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | a0f3ffe43f7a44e58261355c9ebad61a         |
| interface    | public                                   |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | d1559df37465470eb7fafbd93bffb183         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.56:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
[root@Marvin-OpenStack ~]# openstack endpoint create --region RegionOne     compute internal http://10.0.0.56:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | 7532f46cca5540bfae8d9340a62644af         |
| interface    | internal                                 |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | d1559df37465470eb7fafbd93bffb183         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.56:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
[root@Marvin-OpenStack ~]# openstack endpoint create --region RegionOne     compute admin http://10.0.0.56:8774/v2.1/%\(tenant_id\)s
+--------------+------------------------------------------+
| Field        | Value                                    |
+--------------+------------------------------------------+
| enabled      | True                                     |
| id           | d0470f3f77f040b086b34b6641b5e280         |
| interface    | admin                                    |
| region       | RegionOne                                |
| region_id    | RegionOne                                |
| service_id   | d1559df37465470eb7fafbd93bffb183         |
| service_name | nova                                     |
| service_type | compute                                  |
| url          | http://10.0.0.56:8774/v2.1/%(tenant_id)s |
+--------------+------------------------------------------+
## 驗證管理節點的nova是否配置成功
[root@Marvin-OpenStack ~]# openstack host list
+------------------+-------------+----------+
| Host Name        | Service     | Zone     |
+------------------+-------------+----------+
| Marvin-OpenStack | scheduler   | internal |
| Marvin-OpenStack | consoleauth | internal |
| Marvin-OpenStack | conductor   | internal |
+------------------+-------------+----------+
[root@Marvin-OpenStack ~]# nova service-list
+----+------------------+------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host             | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+------------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-scheduler   | Marvin-OpenStack | internal | enabled | up    | 2017-09-03T08:52:25.000000 | -               |
| 2  | nova-consoleauth | Marvin-OpenStack | internal | enabled | up    | 2017-09-03T08:52:25.000000 | -               |
| 3  | nova-conductor   | Marvin-OpenStack | internal | enabled | up    | 2017-09-03T08:52:27.000000 | -               |
+----+------------------+------------------+----------+---------+-------+----------------------------+-----------------+
[root@Marvin-OpenStack ~]# openstack endpoint list
+-----------------------------+-----------+--------------+--------------+---------+-----------+-----------------------------+
| ID                          | Region    | Service Name | Service Type | Enabled | Interface | URL                         |
+-----------------------------+-----------+--------------+--------------+---------+-----------+-----------------------------+
| 0e28a8c975904c28b5a2a9bc180 | RegionOne | glance       | image        | True    | public    | http://10.0.0.56:9292       |
| efe02                       |           |              |              |         |           |                             |
| 2cf91a5b1e1e4d19830627a1d10 | RegionOne | glance       | image        | True    | internal  | http://10.0.0.56:9292       |
| 88b40                       |           |              |              |         |           |                             |
| 41838de3d5204c9dbf173321b8b | RegionOne | keystone     | identity     | True    | internal  | http://10.0.0.56:35357/v3/  |
| c05d7                       |           |              |              |         |           |                             |
| 7532f46cca5540bfae8d9340a62 | RegionOne | nova         | compute      | True    | internal  | http://10.0.0.56:8774/v2.1/ |
| 644af                       |           |              |              |         |           | %(tenant_id)s               |
| 806d8539a4f44c66b14488ee197 | RegionOne | glance       | image        | True    | admin     | http://10.0.0.56:9292       |
| 9190d                       |           |              |              |         |           |                             |
| a0f3ffe43f7a44e58261355c9eb | RegionOne | nova         | compute      | True    | public    | http://10.0.0.56:8774/v2.1/ |
| ad61a                       |           |              |              |         |           | %(tenant_id)s               |
| d0470f3f77f040b086b34b6641b | RegionOne | nova         | compute      | True    | admin     | http://10.0.0.56:8774/v2.1/ |
| 5e280                       |           |              |              |         |           | %(tenant_id)s               |
| d8b9d6bf135b482e852c6483ce3 | RegionOne | keystone     | identity     | True    | admin     | http://10.0.0.56:35357/v3/  |
| 0e4f9                       |           |              |              |         |           |                             |
| e83d3ee63f2a473e809931900ec | RegionOne | keystone     | identity     | True    | public    | http://10.0.0.56:5000/v3/   |
| 71174                       |           |              |              |         |           |                             |
+-----------------------------+-----------+--------------+--------------+---------+-----------+-----------------------------+

這里nova的管理節點就全部安裝完成,確實有點累,后面的內容,我會繼續更新,筆者QQ: 779734791 昵稱:Marvin,歡迎大家一起討論

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 228,461評論 6 532
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 98,538評論 3 417
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 176,423評論 0 375
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 62,991評論 1 312
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 71,761評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,207評論 1 324
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,268評論 3 441
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,419評論 0 288
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 48,959評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 40,782評論 3 354
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 42,983評論 1 369
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,528評論 5 359
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,222評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,653評論 0 26
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 35,901評論 1 286
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,678評論 3 392
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 47,978評論 2 374

推薦閱讀更多精彩內容