免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: milujite
打印 上一主题 下一主题

[OpenStack] 跟着官方文档一步一步架设openstack [复制链接]

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
21 [报告]
发表于 2013-12-07 22:24 |只看该作者
本帖最后由 milujite 于 2013-12-09 13:58 编辑
shenrb2012 发表于 2013-12-05 16:40
感谢楼长,楼长写的真详细,我有几个地方没看明白,请指教一下:
networking那部分是只用在node上装呢,还 ...



感谢楼长,楼长写的真详细,我有几个地方没看明白,请指教一下:
networking那部分是只用在node上装呢,还是control和node都装?
看文档没特殊说明是在哪个节点上装,但是看我帖子2楼的那个图,controller应该是不需要的。我测试过,只在controller上装的话,br100是起不了的,所以我node也装了。倒是没试过只安装node。不过这个只是测试用的简单网络,后面会用neutron取代。


IP地址192.168.1.0这个是外部访问地址还是内部访问地址?
192.168.1.0这个段就是我PC机能够访问互联网的无线网卡的地址段。VMWARE WORKSTAION的网络是桥接到我无线网卡的。也就是说虚拟机里,eth0是桥接到我的无限网卡,eth1是hostonly网络。

node节点的eth1为什么不需要配地址,是因为网桥的缘故吗?
官方文档里有特别说明eth1不配置ip,个人理解和桥接还有dhcp有关。

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
22 [报告]
发表于 2013-12-07 22:32 |只看该作者
本帖最后由 milujite 于 2013-12-09 09:54 编辑

第十章:安装配置openstack-dashboard
  1. [root@openstack ~]# yum install memcached python-memcached mod_wsgi openstack-dashboard
  2. 配置dashboard
  3. [root@openstack ~]# vi /etc/openstack-dashboard/local_settings
  4.   配置ALLOWED_HOSTS:
  5. ALLOWED_HOSTS = ['openstack', 'localhost']
  6.   配置caches:
  7. CACHES = {
  8.     'default': {
  9.         'BACKEND' : 'django.core.cache.backends.locmem.LocMemCache',
  10.         'LOCATION' : '127.0.0.1:11211',
  11.   }
  12.   
  13. }


  14.   配置dashboard连接identify service:
  15.   OPENSTACK_HOST = "openstack"
复制代码
启动httpd和memcached服务
  1. [root@openstack ~]# /etc/init.d/httpd start
  2. Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.100 for ServerName                                                          [  OK  ]
  3. [root@openstack ~]# /etc/init.d/memcached start
  4. Starting memcached:                                        [  OK  ]
  5. [root@openstack ~]# chkconfig --level 35 httpd on
  6. [root@openstack ~]# chkconfig --level 35 memcached on
复制代码
注意,这个配置文件其实是个python脚本,注意python的缩进,保持和配置文件其他部分一致的缩进,python脚本里tab和多个空格是不一样的

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
23 [报告]
发表于 2013-12-07 22:41 |只看该作者
本帖最后由 milujite 于 2013-12-07 22:54 编辑

dashboard troubleshooting:

通过xmanager启动了openstack controller上的firefox,访问localhost/dashboard,结果报错了。。。
  1. Internal Server Error

  2. The server encountered an internal error or misconfiguration and was unable to complete your request.

  3. Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

  4. More information about this error may be available in the server error log.
复制代码
查了下http的error_log,看到以下错误日志:
  1. ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path?): No module named pbr.version
复制代码
google了下日志,从邮件列表里找到了问题所在,缺少了python-pip和python-pbr包。
  1. [root@openstack ~]# yum install python-pbr python-pip
复制代码
继续访问dashboard,OK了。输入在keystone里定义的管理帐号密码,在本例中即admin/openstack

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
24 [报告]
发表于 2013-12-18 14:19 |只看该作者
本帖最后由 milujite 于 2013-12-18 14:22 编辑

第十一章: 在openstack主机上配置block service controller
安装软件包
  1. [root@openstack ~]# yum install openstack-cinder openstack-utils openstack-selinux
复制代码
配置cinder数据库连接并初始化cinder数据库
  1. [root@openstack ~]# openstack-config --set /etc/cinder/cinder.conf database connection \
  2. mysql://cinder:openstack@openstack/cinder
  3. [root@openstack ~]# openstack-db --init --service cinder --password openstack
  4. Please enter the password for the 'root' MySQL user:
  5. Verified connectivity to MySQL.
  6. Creating 'cinder' database.
  7. Updating 'cinder' database password in /etc/cinder/cinder.conf
  8. Initializing the cinder database, please wait...
  9. Complete!
复制代码
创建cinder用户并关联tenant和role
  1. [root@openstack ~]# keystone user-create --name=cinder --pass=openstack --email=cinder@localhost
  2. +----------+----------------------------------+
  3. | Property |              Value               |
  4. +----------+----------------------------------+
  5. |  email   |         cinder@localhost         |
  6. | enabled  |               True               |
  7. |    id    | d9fd08702c73486a95613f411331d118 |
  8. |   name   |              cinder              |
  9. +----------+----------------------------------+
  10. [root@openstack ~]# keystone user-role-add --user=cinder --tenant=service --role=admin
复制代码
配置cinder验证
  1. [root@openstack ~]# vi /etc/cinder/api-paste.ini
  2. [filter:authtoken]
  3. paste.filter_factory=keystoneclient.middleware.auth_token:filter_factory
  4. auth_host = openstack
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = cinder
  9. admin_password = openstack
复制代码
配置cinder连接qpid message
  1. [root@openstack ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend \ cinder.openstack.common.rpc.impl_qpid
  2. [root@openstack ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_hostname openstack
复制代码
注册cinder服务并关联endpoint
  1. [root@openstack ~]# keystone service-create --name=cinder --type=volume --description="Cinder Volume Service"
  2. +-------------+----------------------------------+
  3. |   Property  |              Value               |
  4. +-------------+----------------------------------+
  5. | description |      Cinder Volume Service       |
  6. |      id     | 93b97d9cc8dd44ce950ee7b65d1b589e |
  7. |     name    |              cinder              |
  8. |     type    |              volume              |
  9. +-------------+----------------------------------+

  10. [root@openstack ~]# keystone endpoint-create \
  11. > --service-id=93b97d9cc8dd44ce950ee7b65d1b589e \
  12. > --publicurl=http://openstack:8776/v1/%\(tenant_id\)s \
  13. > --internalurl=http://openstack:8776/v1/%\(tenant_id\)s \
  14. > --adminurl=http://openstack:8776/v1/%\(tenant_id\)s
  15. +-------------+----------------------------------------+
  16. |   Property  |                 Value                  |
  17. +-------------+----------------------------------------+
  18. |   adminurl  | http://openstack:8776/v1/%(tenant_id)s |
  19. |      id     |    df8106bce03544c4b486771945b658c8    |
  20. | internalurl | http://openstack:8776/v1/%(tenant_id)s |
  21. |  publicurl  | http://openstack:8776/v1/%(tenant_id)s |
  22. |    region   |               regionOne                |
  23. |  service_id |    93b97d9cc8dd44ce950ee7b65d1b589e    |
  24. +-------------+----------------------------------------+

  25. [root@openstack ~]# keystone service-create --name=cinder --type=volumev2 --description="Cinder Volume Service V2"
  26. +-------------+----------------------------------+
  27. |   Property  |              Value               |
  28. +-------------+----------------------------------+
  29. | description |     Cinder Volume Service V2     |
  30. |      id     | b4ea20597abd49ac967b52326ce1776e |
  31. |     name    |              cinder              |
  32. |     type    |             volumev2             |
  33. +-------------+----------------------------------+

  34. [root@openstack ~]# keystone endpoint-create \
  35. > --service-id=b4ea20597abd49ac967b52326ce1776e \
  36. > --publicurl=http://openstack:8776/v2/%\(tenant_id\)s \
  37. > --internalurl=http://openstack:8776/v2/%\(tenant_id\)s \
  38. > --adminurl=http://openstack:8776/v2/%\(tenant_id\)s
  39. +-------------+----------------------------------------+
  40. |   Property  |                 Value                  |
  41. +-------------+----------------------------------------+
  42. |   adminurl  | http://openstack:8776/v2/%(tenant_id)s |
  43. |      id     |    9d02441b11d84cc9ac89cd6426d4de3f    |
  44. | internalurl | http://openstack:8776/v2/%(tenant_id)s |
  45. |  publicurl  | http://openstack:8776/v2/%(tenant_id)s |
  46. |    region   |               regionOne                |
  47. |  service_id |    b4ea20597abd49ac967b52326ce1776e    |
  48. +-------------+----------------------------------------+
复制代码
启动服务
  1. [root@openstack ~]# service openstack-cinder-api start
  2. Starting openstack-cinder-api:                             [  OK  ]
  3. [root@openstack ~]# service openstack-cinder-scheduler start
  4. Starting openstack-cinder-scheduler:                       [  OK  ]
  5. [root@openstack ~]# chkconfig openstack-cinder-api on
  6. [root@openstack ~]# chkconfig openstack-cinder-scheduler on
复制代码

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
25 [报告]
发表于 2013-12-18 14:23 |只看该作者
本帖最后由 milujite 于 2013-12-18 14:26 编辑

第十二章:配置存储节点
创建逻辑卷
  1. [root@storage ~]# pvcreate /dev/sdb
  2.   Physical volume "/dev/sdb" successfully created
  3. [root@storage ~]# vgcreate cinder-volumes /dev/sdb
  4.   Volume group "cinder-volumes" successfully created
复制代码
修改lvm.conf在devices配置段修改filter:
  1. [root@storage ~]# vi /etc/lvm/lvm.conf
  2. filter = [ "r/sda/", "a/sdb/", "r/.*/" ]
复制代码
安装软件包
  1. [root@storage ~]# yum install openstack-cinder openstack-utils openstack-selinux
复制代码
配置cinder验证
  1. [root@storage ~]# /etc/cinder/api-paste.ini
  2. [filter:authtoken]
  3. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  4. auth_host = openstack
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = cinder
  9. admin_password = openstack
复制代码
配置cinder连接qpid message
  1. [root@storage ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
  2. [root@storage ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_hostname openstack
复制代码
配置cinder连接数据库
  1. [root@storage ~]# openstack-config --set /etc/cinder/cinder.conf database connection \ mysql://cinder:openstack@openstack/cinder
复制代码
配置iscsi-target
在targets.conf文件头部加入如下配置:
  1. [root@storage ~]# vi /etc/tgt/targets.conf
  2. include /etc/cinder/volumes/*
复制代码
启动服务
  1. [root@storage ~]# /etc/init.d/openstack-cinder-volume start
  2. Starting openstack-cinder-volume:                          [  OK  ]
  3. [root@storage ~]# /etc/init.d/tgtd start
  4. Starting SCSI target daemon:                               [  OK  ]
  5. [root@storage ~]# chkconfig --level 35 openstack-cinder-volume on
  6. [root@storage ~]# chkconfig --level 35 tgtd on
复制代码
测试cinder服务
  1. 创建卷
  2.   [root@openstack ~]# cinder create --display-name cinder_test 1
  3.   +---------------------+--------------------------------------+
  4.   |       Property      |                Value                 |
  5.   +---------------------+--------------------------------------+
  6.   |     attachments     |                  []                  |
  7.   |  availability_zone  |                 nova                 |
  8.   |       bootable      |                false                 |
  9.   |      created_at     |      2013-12-18T05:26:27.119613      |
  10.   | display_description |                 None                 |
  11.   |     display_name    |             cinder_test              |
  12.   |          id         | 33c6a77c-6754-4858-a703-30cb067cabdf |
  13.   |       metadata      |                  {}                  |
  14.   |         size        |                  1                   |
  15.   |     snapshot_id     |                 None                 |
  16.   |     source_volid    |                 None                 |
  17.   |        status       |               creating               |
  18.   |     volume_type     |                 None                 |
  19.   +---------------------+--------------------------------------+
  20.   
  21. 在storage上查看是否生成卷:
  22.   [root@storage ~]# lvdisplay
  23.     --- Logical volume ---
  24.     LV Path                /dev/cinder-volumes/volume-c9aa6f08-e525-4d2f-9c24-a2089b21a5dc
  25.     LV Name                volume-c9aa6f08-e525-4d2f-9c24-a2089b21a5dc
  26.     VG Name                cinder-volumes
  27.     LV UUID                xe0ZZo-zavj-PiT4-5Z75-kLOk-tFTc-6xxuMu
  28.     LV Write Access        read/write
  29.     LV Creation host, time storage, 2013-12-18 13:36:44 +0800
  30.     LV Status              available
  31.     # open                 1
  32.     LV Size                1.00 GiB
  33.     Current LE             256
  34.     Segments               1
  35.     Allocation             inherit
  36.     Read ahead sectors     auto
  37.     - currently set to     256
  38.     Block device           253:0
  39.   
  40. 在dashboard上将该卷映射给实例,在node01 Hypervisor上使用fdisk -l查看是否有新设备:
  41.   [root@node01 ~]# fdisk -l
  42.   
  43.   Disk /dev/sda: 17.2 GB, 17179869184 bytes
  44.   255 heads, 63 sectors/track, 2088 cylinders
  45.   Units = cylinders of 16065 * 512 = 8225280 bytes
  46.   Sector size (logical/physical): 512 bytes / 512 bytes
  47.   I/O size (minimum/optimal): 512 bytes / 512 bytes
  48.   Disk identifier: 0x00018b8e
  49.   
  50.      Device Boot      Start         End      Blocks   Id  System
  51.   /dev/sda1   *           1          26      204800   83  Linux
  52.   Partition 1 does not end on cylinder boundary.
  53.   /dev/sda2              26        1938    15360000   83  Linux
  54.   /dev/sda3            1938        2089     1211392   82  Linux swap / Solaris
  55.   
  56.   Disk /dev/sdb: 1073 MB, 1073741824 bytes
  57.   34 heads, 61 sectors/track, 1011 cylinders
  58.   Units = cylinders of 2074 * 512 = 1061888 bytes
  59.   Sector size (logical/physical): 512 bytes / 512 bytes
  60.   I/O size (minimum/optimal): 512 bytes / 512 bytes
  61.   Disk identifier: 0x00000000
  62.   [root@node01 ~]# iscsiadm -m node
  63.   192.168.1.102:3260,-1 iqn.2010-10.org.openstack:volume-c9aa6f08-e525-4d2f-9c24-a2089b21a5dc
  64.   
  65. 在cirros实例上验证,通过fdisk命令,查看,已经生成/dev/vdb块设备。

  66. 在openstack上查看映射状态
  67.   [root@openstack ~]# cinder list
  68.   +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
  69.   |                  ID                  | Status | Display Name | Size | Volume Type | Bootable |             Attached to              |
  70.   +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
  71.   | c9aa6f08-e525-4d2f-9c24-a2089b21a5dc | in-use | cinder_test  |  1   |     None    |  false   | 2deb480f-2e6b-41ed-b6f0-4fbd4b1afdf5 |
  72.   +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
复制代码

论坛徽章:
26
CU十二周年纪念徽章
日期:2013-10-24 15:41:34技术图书徽章
日期:2014-07-11 16:27:52辰龙
日期:2014-09-04 13:40:43白羊座
日期:2014-09-09 12:51:55双子座
日期:2014-09-26 11:00:042014年中国系统架构师大会
日期:2014-10-14 15:59:00子鼠
日期:2014-10-23 16:48:23巨蟹座
日期:2014-10-27 08:21:10申猴
日期:2014-12-08 10:16:282015年辞旧岁徽章
日期:2015-03-03 16:54:15NBA常规赛纪念章
日期:2015-05-04 22:32:03IT运维版块每日发帖之星
日期:2016-01-29 06:20:00
26 [报告]
发表于 2014-01-02 14:06 |只看该作者
谢谢楼主的分享与整理这么详细的文档

有空与来做一下,收藏

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
27 [报告]
发表于 2014-01-03 11:38 |只看该作者
openstack用neutron出问题。对概念还是有点模糊。有人能解惑下么?

论坛徽章:
5
CU大牛徽章
日期:2013-09-18 15:16:55CU大牛徽章
日期:2013-09-18 15:18:22CU大牛徽章
日期:2013-09-18 15:18:432015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
28 [报告]
发表于 2014-01-11 13:31 |只看该作者
深奥

论坛徽章:
0
29 [报告]
发表于 2014-01-21 22:34 |只看该作者
mark了 准备玩玩openstack

论坛徽章:
0
30 [报告]
发表于 2014-01-28 09:57 |只看该作者
想问一下 您的实列能访问外网吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP