免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 17098 | 回复: 7
打印 上一主题 下一主题

[OpenStack] openstack nova 部署完整实例-参考手册-DRAFT-增强部分(3) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-08 14:51 |只看该作者 |倒序浏览
本帖最后由 openstack 于 2011-07-08 14:52 编辑

上接: openstack nova 部署完整实例-参考手册-DRAFT-增强部分2


openstack 官方并没有提供一个完整的部署案例,并且官方手册上的描述也有不确切的地方。在初次接触openstack nova时,会遇到各种各样的问题。希望下面的描述能有所帮助。
本案例手册是在探索nova过程中写的。欢迎指出不正确或描述不确切的地方。下文中提到的有些文件,比如下面提到的补丁文件,请下载附件后,查找。




十, 使用ganglia 来监控我们的私有云
        ganglia 分为三部分,ganglia-monitor, ganglia-webfrontend, gmetad。可以简单的理解位gmetad是服务器端。ganglia-monitor是客户端,把采集到的数据发送给gmetad,ganglia-webfrontend和gmetad交互,把数据以web的形式展现给管理员。

        我们假定gmetad安装在novacc节点上。
        1,配置主机名,
        因为我们有两个节点'novacc和novacompute1'
        所以我们把下面这两行分别加入到两个节点的/etc/hosts里面
        '''
        192.168.1.101 n101
        192.168.1.102 n102
        '''
        2,配置nova-cc节点
        apt-get install ganglia-monitor ganglia-webfront gmetad
        ln -s /usr/share/ganglia-webfrontend/ /var/www/ganglia
        service gmetad start
        service ganglia-monitor start
        修改/etc/ganglia/gmetad.conf中的
        data_source "my cluster" localhost
为下面这个样子:
        data_source "mdscloud"  192.168.1.189:8769 192.168.1.102:8769 192.168.1.101:8769

        修改/etc/ganglia/gmond.conf中的
        cluster {
          name = "unspecified"
                          owner = "unspecified"
                                  latlong = "unspecified"
                                          url = "unspecified"
        }
为下面这个样子:
        cluster {
          name = "mdscloud"
                          owner = "unspecified"
                                  latlong = "unspecified"
                                          url = "unspecified"
        }
       
        3,配置novacompute1节点,
        apt-get install ganglia-monitor
        service ganglia-monitor start
        修改/etc/ganglia/gmond.conf中的
        cluster {
          name = "unspecified"
                          owner = "unspecified"
                                  latlong = "unspecified"
                                          url = "unspecified"
        }
为下面这个样子:
        cluster {
          name = "mdscloud"
                          owner = "unspecified"
                                  latlong = "unspecified"
                                          url = "unspecified"
        }
4,访问, http://192.168.1.101/ganglia


十一, 使用界面
我们在nova-cc节点上进行操作,
1, 得到dashboard的代码
创建目录
apt-get install brz
mkdir openstack-dashboard
cd openstack-dashboard
bzr init-repo .
bzr branch lppenstack-dashboard trunk
bzr revert -r 46

2, 安装配置dashboard,
        With the reference implementation built, it is now time to configure our OpenStack Dashboard application. The first step in configuring the application is to create your local_settings.py file:

        $ cd trunk/openstack-dashboard/local
        $ cp local_settings.py.example local_settings.py
        $ vi local_settings.py

        In the local_settings.py file, we need to change several important options:
        *

        NOVA_DEFAULT_ENDPOINT : this needs to be set to nova-api instance URL from above. Keep the default ('http://localhost:8773/services/Cloud') if you are running the dashboard on the same machine as your nova-api.
        * NOVA_DEFAULT_REGION : this can remain 'nova'
        * NOVA_ACCESS_KEY : this should be the EC2_ACCESS_KEY in your novarc file.
        * NOVA_SECRET_KEY : this should be the EC2_SECRET_KEY in your novarc file.
        * NOVA_ADMIN_USER: this can be any user with admin privileges in your nova database. The CLOUD_SERVERS_USERNAME from your admin credentials file is fine.
        *
        NOVA_PROJECT: this can be any project (defined in your nova database) which the NOVA_ADMIN_USER is defined as project_manager. Refer to RunningNova for assistance if you haven't defined any nova projects.
        local_setting.py内容参考:
        import os

        DEBUG = True
        TEMPLATE_DEBUG = DEBUG
        PROD = False
        USE_SSL = False

        LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
        DATABASES = {
                    'default': {
                                                'ENGINE': 'django.db.backends.sqlite3',
                                                                                'NAME': os.path.join(LOCAL_PATH, 'dashboard_openstack.sqlite3'),
                                                                                                            },
        }

CACHE_BACKEND = 'dummy://'

# Configure these for your outgoing email host
# EMAIL_HOST = 'smtp.my-company.com'
# EMAIL_PORT = 25
# EMAIL_HOST_USER = 'djangomail'
# EMAIL_HOST_PASSWORD = 'top-secret!'

NOVA_DEFAULT_ENDPOINT = 'http://192.168.1.101:8773/services/Cloud'
NOVA_DEFAULT_REGION = 'nova'
NOVA_ACCESS_KEY = '4fd029bf-74d8-49a7-98f1-216dc765332c:dubproject'
NOVA_SECRET_KEY = '8783ba53-ad5d-43fc-a5b4-9f72c438e0d0'
NOVA_ADMIN_USER = 'dub'
NOVA_PROJECT = 'dubproject'

# Configure these for your outgoing email host
# EMAIL_HOST = 'smtp.my-company.com'
# EMAIL_PORT = 25
## EMAIL_HOST_USER = 'djangomail'
## EMAIL_HOST_PASSWORD = 'top-secret!'

        Now it's time to install the openstack-dashboard environment. This installs all the dependencies for openstack-dashboard.

        $ apt-get install -y python-setuptools
        $ cd ..
        $ sudo easy_install virtualenv
        $ python tools/install_venv.py
        This will take a bit as it needs to download a number of dependencies from the internet.
        With that done, let's create the database:
        $ tools/with_venv.sh dashboard/manage.py syncdb
        This will ask you a few questions (follow the instructions within the * * to answer the questions):

                You just installed Django's auth system, which means you don't have any superusers defined.
                Would you like to create one now? (yes/no): *YES*
                Username (Leave blank to use 'root'): *ENTER YOUR NOVA_USERNAME (The name of the Nova admin user you created) FROM NOVARC*
                E-mail address: *ENTER YOUR EMAIL ADDRESS*
                Password: *MAKE UP A PASSWORD*
                Password (again): *REPEAT YOUR PASSWORD*
                If everything goes correctly, you shouldn't see any errors. If you get permission denied errors, you may have a project error - try creating a project named 'dashboard' with your user as admin:
                $ sudo nova-manage project create dashboard YOUR_ADMIN_USER
                Before you can retry, you should probably clear the existing database:
                $ rm local/dashboard_openstack.sqlite3
                A successful run looks something like this (my dashboard is on the same machine as my nova installation):

                        $ tools/with_venv.sh dashboard/manage.py syncdb
                        /home/kpepple/src/dashboard/django-nova/trunk/src/django_nova/models.py:25: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
                        import sha
                        Creating table auth_permission
                        Creating table auth_group_permissions
                        Creating table auth_group
                        Creating table auth_user_user_permissions
                        Creating table auth_user_groups
                        Creating table auth_user
                        Creating table auth_message
                        Creating table django_admin_log
                        Creating table django_content_type
                        Creating table django_session
                        Creating table django_comments
                        Creating table django_comment_flags
                        Creating table django_site
                        Creating table django_nova_credentialsauthorization
                        Creating table registration_registrationprofile

                        You just installed Django's auth system, which means you don't have any superusers defined.
                        Would you like to create one now? (yes/no): yes
                        Username (Leave blank to use 'kpepple'): kpepple
                        E-mail address: nospam@nospam.com
                        Password:
                        Password (again):
                        DEBUG:boto:using calc_signature_2
                        DEBUG:boto:query string: AWSAccessKeyId=c593c0ce-b72a-4033-a705-b215bb9bea26%3AIRT&Action=DescribeUser&Name=kpepple&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-01-30T21%3A45%3A08&Version=nova
                        DEBUG:boto:string_to_sign: GET
                        localhost:8773
                        /services/Admin/
                        AWSAccessKeyId=c593c0ce-b72a-4033-a705-b215bb9bea26%3AIRT&Action=DescribeUser&Name=kpepple&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-01-30T21%3A45%3A08&Version=nova
                        DEBUG:boto:len(b64)=44
                        DEBUG:boto:base64 encoded digest: NoFDLWwN0Y6Ytety/N2fg3DuLfHpXVvaD8f5esKJSkE=
                        DEBUG:boto:Canonical: GET

                        Sun, 30 Jan 2011 21:45:08 GMT
                        /services/Admin/services/Admin/
                        DEBUG:boto:Method: GET
                        DEBUG:botoath: /services/Admin/?AWSAccessKeyId=c593c0ce-b72a-4033-a705-b215bb9bea26%3AIRT&Action=DescribeUser&Name=kpepple&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-01-30T21%3A45%3A08&Version=nova&Signature=NoFDLWwN0Y6Ytety/N2fg3DuLfHpXVvaD8f5esKJSkE%3D
                        DEBUG:botoata:
                        DEBUG:boto:Headers: {'Date': 'Sun, 30 Jan 2011 21:45:08 GMT', 'Content-Length': '0', 'Authorization': 'AWS c593c0ce-b72a-4033-a705-b215bb9bea26:IRT:cL1g13ps8Qe/gL1G9GvkRaFzuUg=', 'User-Agent': 'Boto/1.9b (linux2)'}
DEBUG:boto:Host: None
DEBUG:boto:establishing HTTP connection
DEBUG:boto:<?xml version="1.0" ?><DescribeUserResponse xmlns="http://ec2.amazonaws.com/doc/nova/"><requestId>ES1SL094MSGUKJ7Y8RZ2</requestId><username>kpepple</username><secretkey>f1fa0acc-15f0-4bb2-ad07-06c322880e6d</secretkey><accesskey>c593c0ce-b72a-4033-a705-b215bb9bea26</accesskey><file/></DescribeUserResponse>
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Group_permissions model
Installing index for auth.User_user_permissions model
Installing index for auth.User_groups model
Installing index for auth.Message model
Installing index for admin.LogEntry model
Installing index for comments.Comment model
Installing index for comments.CommentFlag model
No fixtures found.

If you receive errors in this step, check your nova-api.log file (usually /var/log/nova/nova-api.log) for clues. Most likely you are having a mismatch between your username, access keys and project settings.
Run the Server
Now run the built-in server at an unprivileged port so that you can view your results:
$ tools/with_venv.sh dashboard/manage.py runserver 192.168.1.101:8000
Make sure that your firewall isn't blocking TCP/8000 and just point your browser at this server on port 8000. If you are running the server on the same machine as your browser, this would be "http://localhost:8000".

这个地方就可以进行访问: http://192.168.1.101:8000/


十二, 通过api来使用nova实例
        参考openstack 提供的开发文档
        1,
                认证
         zjfhappy@zjfhappy-desktop:~$ curl -v -H 'X-Auth-User:dub' -H 'X-Auth-Key:4fd029bf-74d8-49a7-98f1-216dc765332c' http://192.168.1.101:8774/v1.0/
        2,
                获取服务的列表
                curl -v -H 'X-Auth-Token:a8fbae0d97edd1f014ac60ce020d08b620df7861' http://192.168.1.101:8774/v1.0/servers
        3,
          查看当前帐号所受的限制, 添加一个accept:application/xml的头信息,会返回一个xml格式的数据,可读性好点。
                curl -v -H 'X-Auth-Token:a8fbae0d97edd1f014ac60ce020d08b620df7861' -H 'Accept:application/xml' http://192.168.1.101:8774/v1.0/limits
        4,
          


history:
n,!date
1,2011年 06月 24日 星期五 16:45:18 CST

goldfish.zip

680.67 KB, 下载次数: 269

论坛徽章:
0
2 [报告]
发表于 2011-08-24 09:42 |只看该作者
这这这,这资料太新鲜啦, mark一下

论坛徽章:
0
3 [报告]
发表于 2011-09-20 15:43 |只看该作者
国内竟然有人研究,支持楼主,我也在看

论坛徽章:
0
4 [报告]
发表于 2011-09-21 17:57 |只看该作者
真的看不懂

论坛徽章:
0
5 [报告]
发表于 2011-09-24 20:13 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
6 [报告]
发表于 2011-12-31 09:28 |只看该作者
非常感谢楼主提供

论坛徽章:
0
7 [报告]
发表于 2012-02-03 14:51 |只看该作者
有段时间不来,发现新东西还真不少。非常感谢!

论坛徽章:
5
丑牛
日期:2014-01-21 08:26:26卯兔
日期:2014-03-11 06:37:43天秤座
日期:2014-03-25 08:52:52寅虎
日期:2014-04-19 11:39:48午马
日期:2014-08-06 03:56:58
8 [报告]
发表于 2012-02-04 22:01 |只看该作者
我也看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP