`
ssydxa219
  • 浏览: 622336 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

OpenStack入门介绍及penStack-Icehouse(nova-network)多节点基础环境部署

 
阅读更多
内容列表
一、组件介绍
二、系统准备
三、Controller Node部署
1.MySQL
2.Qpid
3.Glance
4.Nova
5.Horizon
四、Compute Node部署
1.Nova-Compute
2.Nova-Network
五、部署云主机
MySQL数据库:负责保存Openstack系统中的各类数据
Qpid:完成Openstack各组件间的消息交换工作
Keystone:用于租户与服务认证
Glance:负责提供创建虚拟机使用的操作系统镜像
glance-api:负责接收云系统的镜像创建、删除和镜像数据服务
glance-registry:负责云系统的镜像注册服务

Nova:(compute)管理虚拟机
   nova-api:负责接收来自Nova客户端或Horizon的控制指令并完成虚拟机创建、删除等管理工作
   nova-network:负责为虚拟机配置网络并分配IP地址
   nova-cert:负责来自EC2接口命令的用户身份提供认证服务
   nova-consoleauth、nova-novncproxy负责为来自Horizon的Web VNC管理页面提供认证与VNC服
   nova-scheduler:负责决定在哪台计算节点上创建虚拟机工作

Cinder:为云中虚拟机镜像提供存储服务
Swift:对象存储,一般存储虚拟机镜像、图片、存档备份等
Telemetry(Ceilometer):提供云系统中计费功能、监控数据、云系统运行状况等
Orchestration(Heat):利用模板,定制化的实现虚拟机预配置,类似于puppet
Trove:根据云中资源轻松扩展数据库资源使用

二、安装系统准备
操作系统:CentOS6.5_x86_64 minimal

1.禁用NetworkManager服务
service NetworkManager stop
chkconfig NetworkManager off

2.关闭selinux
setenforce 0

3.关闭防火墙
service iptables stop

4.安装NTP时间同步
yum install -y ntp
service ntpd start
chkconfig ntpd on

5.配置Icehouse和epel网络源

6.安装Openstack工具并更新系统
yum install -y openstack-utils openstack-selinux
yum upgrade -y && reboot

7.配置网络

7.1 Controller Node

7.1.1配置管理接口
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.11
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1   

7.1.2配置hosts记录
     192.168.1.11 controlle
     192.168.1.31 compute1

7.2 Compute1 Node

7.2.1配置管理接口
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.31
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1  

7.2.2 配置外部接口
      DEVICE=eth1
TYPE=Ethernet
ONBOOT="yes"
BOOTPROTO="none"  

7.2.3配置hosts记录
192.168.1.11 controlle
    192.168.1.31 compute1

7.3 重启网卡
service network restart
7.4 测试网络连通性
ping -c 4 controller
ping -c 4 compute1

三、Controller Node
1.MySQL数据库安装与配置

1.1安装Msyql
yum install -y mysql mysql-server MySQL-python

1.2修改配置文件
[mysqld]
bind-address= 192.168.1.11
default-storage-engine= innodb
collation-server= utf8_general_ci
init-connect= 'SET NAMES utf8'
character-set-server= utf8

1.3重启Mysql
service mysqld start
chkconfig mysqld on

1.4初始化Mysql并设置密码
mysql_install_db
mysql_secure_installation

2.消息中间件Qpid服务安装与配置
yum install -y qpid-cpp-server

2.1关闭身份认证
# vi /etc/qpidd.conf
auth=no

2.2重启qpidd服务
service qpidd start
chkconfig qpidd on

3.认证服务Keystone安装与配置
3.1安装
yum install -y openstack-keystone

3.2配置数据库
openstack-config --set /etc/keystone/keystone.conf \
database connection mysql://keystone:KEYSTONE_DBPASS@controller/keystone

3.3创建数据库并授权
# mysql -uroot -p
mysql> CREATE DATABASE keystone;
mysql> GRANT ALL PRIVILEGES ON keystone.* TO'keystone'@'localhost' \
IDENTIFIEDBY 'KEYSTONE_DBPASS';
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIEDBY 'KEYSTONE_DBPASS';
mysql> exit
当然,如果你觉得每次创建数据库并授权比较麻烦,可以一次做完!
# vi createdb.sh
CREATE DATABASEkeystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'IDENTIFIED BY'KEYSTONE_DBPASS';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIEDBY'KEYSTONE_DBPASS';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost'IDENTIFIED BY'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY'GLANCE_DBPASS';
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIEDBY'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY'NOVA_DBPASS';
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY'NEUTRON_DBPASS';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY'NEUTRON_DBPASS';
CREATE DATABASE dash;
GRANT ALL PRIVILEGES ON dash.* TO 'dash'@'%' IDENTIFIED BY'DASH_DBPASS';
GRANT ALL PRIVILEGES ON dash.* TO 'dash'@'localhost' IDENTIFIEDBY'DASH_DBPASS';
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIEDBY'CINDER_DBPASS';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY'CINDER_DBPASS';
# mysql -uroot -p123.com < createdb.sh

3.4导入数据库
keystone-manage db_sync

3.5生成字符串秘钥并添加到配置文件
ADMIN_TOKEN=$(openssl rand -hex 10)
echo $ADMIN_TOKEN
openstack-config --set /etc/keystone/keystone.conf DEFAULT \
admin_token $ADMIN_TOKEN

3.6默认keystone使用PKI令牌,创建签名秘钥和证书
keystone-manage pki_setup --keystone-user keystone --keystone-groupkeystone
chown -R keystone:keystone /etc/keystone/ssl
chmod -R o-rwx /etc/keystone/ssl
chown keystone.keystone /var/log/keystone/keystone.log

3.7重启服务
service openstack-keystone start
chkconfig openstack-keystone on

3.8定期清理过期的令牌,提高性能
(crontab -l 2>&1 | grep -q token_flush) || \
echo '@hourly /usr/bin/keystone-manage token_flush>/var/log/keystone/keystone-tokenflush.log 2>&1' >>/var/spool/cron/root

3.9设置令牌及服务位置环境变量
export OS_SERVICE_TOKEN=$ADMIN_TOKEN
export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0

3.10创建admin用户、角色和租户
#创建管理员用户
keystone user-create --name=admin --pass=admin --email=admin@example.com
#创建管理员角色
keystone role-create --name=admin
#为管理员创建租户
keystone tenant-create --name=admin --description="AdminTenant"
#将角色添加到用户
keystone user-role-add --user=admin --tenant=admin --role=admin
keystone user-role-add --user=admin --role=_member_ --tenant=admin

3.11创建service租户
keystone tenant-create --name=service --description="ServiceTenant"

3.12创建keystone标识服务
keystone service-create --name=keystone --type=identity \
--description="OpenStackIdentity"

3.13创建服务端点,指定API的URL
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ identity / {print$2}') \
--publicurl=http://controller:5000/v2.0 \
--internalurl=http://controller:5000/v2.0\
--adminurl=http://controller:35357/v2.0

3.14取消变量
unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT

3.15测试身份认证
# keystone --os-username=admin --os-password=admin \
--os-auth-url=http://controller:35357/v2.0 token-get
# keystone --os-username=admin --os-password=admin \
--os-tenant-name=admin --os-auth-url=http://controller:35357/v2.0token-get

3.16设置环境变量,也可以写在.bash_profile
# vi /root/admin-openrc.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller:35357/v2.0
# source admin-openrc.sh

3.17验证是否授权成功
keystone token-get
keystone user-list
keystone user-role-list --user admin --tenant admin
keystone --os-password admin service-list

3.18安装client通过http访问各组件客户端
yum install -y python-keystoneclient python-glanceclient python-novaclientpython-swiftclient python-neutronclient python-cinderclient

4.镜像服务Glance安装与配置

4.1安装
yum install -y openstack-glance
现在启动glance-api,要不然会可能后面启动不起来。
service openstack-glance-api start

4.2配置数据库及qpid
openstack-config --set /etc/glance/glance-api.conf database \
connection mysql://glance:GLANCE_DBPASS@controller/glance
openstack-config --set /etc/glance/glance-registry.conf database \
connection mysql://glance:GLANCE_DBPASS@controller/glance
openstack-config --set /etc/glance/glance-api.conf DEFAULT rpc_backend qpid
openstack-config --set /etc/glance/glance-api.conf DEFAULT qpid_hostname controller

4.3创建数据库
# mysql -uroot -p
mysql> CREATE DATABASE glance;
mysql> GRANT ALL PRIVILEGES ON glance.* TO'glance'@'localhost' \
IDENTIFIEDBY 'GLANCE_DBPASS';
mysql> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIEDBY 'GLANCE_DBPASS';
mysql> exit

4.4导入数据库
glance-manage db_sync

4.5创建glance用户并加入角色admin
keystone user-create --name=glance --pass=glance--email=glance@example.com
keystone user-role-add --user=glance --tenant=service --role=admin

4.6配置认证信息
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password glance
openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password glance
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone

4.7创建glance标识服务
keystone service-create --name=glance --type=image--description="OpenStackImage Service"

4.8创建Glance API接口URL
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ image / {print$2}') \
--publicurl=http://controller:9292  \
--internalurl=http://controller:9292  \
--adminurl=http://controller:9292

4.9启动glance服务
service openstack-glance-api restart
service openstack-glance-registry start
chkconfig openstack-glance-api on
chkconfig openstack-glance-registry on

4.10上传测试镜像
glance image-create --name "cirros-0.3.2-x86_64" --disk-formatqcow2 \
--container-format bare --is-public True --progress <cirros-0.3.2-x86_64-disk.img

4.11查看上传镜像状态
# glance image-list
[root@controller~]# glance image-list
+--------------------------------------+---------------------+-------------+------------------+-----------+--------+
| ID                                | Name              | Disk Format | Container Format | Size    | Status |
+--------------------------------------+---------------------+-------------+------------------+-----------+--------+
|de8cfa34-2657-4d9c-bc58-19fb11455cbb | cirros-0.3.2-x86_64 | qcow2     | bare             |13167616 | active |
+--------------------------------------+---------------------+-------------+------------------+-----------+--------+

5.计算服务Nova API安装与配置
5.1安装
yum install -y openstack-nova-api openstack-nova-cert openstack-nova-conductoropenstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler

5.2配置数据库
openstack-config --set /etc/nova/nova.conf database \
connection mysql://nova:NOVA_DBPASS@controller/nova

5.3配置Qpid及VNC
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname controller
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.1.11
openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 192.168.1.11
openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address
192.168.1.11

5.4创建数据库
mysql -uroot -p
mysql> CREATE DATABASE nova;
mysql> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
IDENTIFIEDBY 'NOVA_DBPASS';
mysql> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
IDENTIFIEDBY 'NOVA_DBPASS';
mysql> exit

5.5导入数据库
nova-manage db sync

5.6创建nova用户并加入角色admin
keystone user-create --name=nova --pass=nova --email=nova@example.com
keystone user-role-add --user=nova --tenant=service --role=admin

5.7配置认证信息
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken \
auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host controller
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password nova

5.8创建nova服务标识
keystone service-create --name=nova--type=compute --description="OpenStackCompute"

5.9创建Nova API接口URL
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ compute / {print$2}') \
--publicurl=http://controller:8774/v2/%\(tenant_id\)s  \
--internalurl=http://controller:8774/v2/%\(tenant_id\)s  \
--adminurl=http://controller:8774/v2/%\(tenant_id\)s

5.10启动相关服务
service openstack-nova-api start
service openstack-nova-cert start
service openstack-nova-consoleauth start
service openstack-nova-scheduler start
service openstack-nova-conductor start
service openstack-nova-novncproxy start
chkconfig openstack-nova-api on
chkconfig openstack-nova-certon
chkconfig openstack-nova-consoleauth on
chkconfig openstack-nova-scheduler on
chkconfig openstack-nova-conductor on
chkconfig openstack-nova-novncproxy on

5.11查看镜像状态
# nova image-list
[root@controller~]# nova image-list
+--------------------------------------+---------------------+--------+--------+
| ID                                | Name              | Status | Server |
+--------------------------------------+---------------------+--------+--------+
|de8cfa34-2657-4d9c-bc58-19fb11455cbb | cirros-0.3.2-x86_64 | ACTIVE |      |
+--------------------------------------+---------------------+--------+--------+

5.12配置控制节点使用nova网络
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_classnova.network.api.API
openstack-config --set /etc/nova/nova.conf DEFAULT security_group_api nova

5.13重启服务
service openstack-nova-api restart
service openstack-nova-scheduler restart
service openstack-nova-conductor restart
5.13创建网络(一般创建的网络不能与宿主机在同一网段,避免冲突)
# source admin-openrc.sh
nova network-create admin-net --bridge br100 --multi-host T--fixed-range-v4 192.168.1.0/24
[root@controller~]# nova net-list
+--------------------------------------+----------+----------------+
| ID                                | Label    | CIDR            |
+--------------------------------------+----------+----------------+
|5eb05667-ed6b-4cd3-a1d1-b6cc1903ccfa | admin-net | 192.168.1.0/24 |
+--------------------------------------+----------+----------------+

6.Web页面dashboard服务安装与配置

6.1安装
yum install -y memcached python-memcached mod_wsgi openstack-dashboard

6.2配置用memcached来缓存dashboard,并设置允许外部访问与配置数据库
# vi /etc/openstack-dashboard/local_settings
CACHES = {
'default':{
'BACKEND':'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211'
}
}
########### config databases ##############
SESSION_ENGINE = 'django.core.cache.backends.db.DatabaseCache'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dash',
'USER': 'dash',
'PASSWORD': 'DASH_DBPASS',
'HOST': '192.168.1.11',
'default-character-set': 'utf8'
}
}
ALLOWED_HOSTS= ['192.168.1.11', 'my-desktop']
OPENSTACK_HOST= "controller"
############可选:也可以使用redis做缓存#############
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
"default": {
"BACKEND": "redis_cache.cache.RedisCache",
"LOCATION": "127.0.0.1:6379:1",
"OPTIONS": {
"CLIENT_CLASS":"redis_cache.client.DefaultClient",
}
}

6.3创建数据库
mysql -u root -p
mysql> CREATE DATABASE dash;
mysql> GRANT ALL PRIVILEGES ON dash.* TO'dash'@'%'IDENTIFIED BY
'DASH_DBPASS';
mysql> GRANT ALL PRIVILEGES ON dash.* TO'dash'@'localhost'IDENTIFIED BY
'DASH_DBPASS';
mysql> exit

6.4导入数据库
/usr/share/openstack-dashboard/manage.pysyncdb

6.5启动相关服务
service httpd start
service memcached start
chkconfig httpd on
chkconfig memcached on
6.6访问dashboard
http://192.168.1.11/dashboard


四、Compute Node

1.安装MySQL-python
yum install-y MySQL-python

2.计算服务Nova-Compute安装与配置
2.1安装计算服务
yum install -y openstack-nova-compute
2.2配置数据库
openstack-config --set /etc/nova/nova.conf database connectionmysql://nova:NOVA_DBPASS@controller/nova
2.3配置认证信息
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host controller
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password nova
2.4配置Qpid
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostnamecontroller
2.5配置计算服务提供远程控制台访问实例
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.1.31
openstack-config --set /etc/nova/nova.conf DEFAULT vnc_enabled True
openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 192.168.1.31
openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_base_url http://192.168.1.11:6080/vnc_auto.html
2.6如果系统不支持硬件虚拟化则配置libvirt为qemu,生产环境是kvm
# egrep -c '(vmx|svm)' /proc/cpuinfo  #查看是否支持虚拟化
openstack-config --set /etc/nova/nova.conf DEFAULT glance_host controller
openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu
2.7启动相关服务
service libvirtd start
service messagebus start
service openstack-nova-compute start
chkconfig libvirtd on
chkconfig messagebus on
chkconfig openstack-nova-compute on
3.Nova-Network服务安装与配置

3.1安装
yum install -y openstack-nova-network openstack-nova-api

3.2配置FlatDHCP
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class nova.network.api.API
openstack-config --set /etc/nova/nova.conf DEFAULT security_group_api nova
openstack-config --set /etc/nova/nova.conf DEFAULTnetwork_managernova.network.manager.FlatDHCPManager
openstack-config --set /etc/nova/nova.conf DEFAULT \
firewall_driver nova.virt.libvirt.firewall.IptablesFirewallDriver
openstack-config --set /etc/nova/nova.conf DEFAULT network_size 254
openstack-config --set /etc/nova/nova.conf DEFAULT allow_same_net_traffic False
openstack-config --set /etc/nova/nova.conf DEFAULT multi_host True
openstack-config --set /etc/nova/nova.conf DEFAULT send_arp_for_ha True
openstack-config --set /etc/nova/nova.conf DEFAULT share_dhcp_addressTrue
openstack-config --set /etc/nova/nova.conf DEFAULT force_dhcp_release True
openstack-config --set /etc/nova/nova.conf DEFAULT flat_network_bridge br100
openstack-config --set /etc/nova/nova.conf DEFAULT flat_interface eth1
openstack-config --set /etc/nova/nova.conf DEFAULT public_interface eth0

3.3启动相关服务
service openstack-nova-network start
service openstack-nova-metadata-api start
chkconfig openstack-nova-network on
chkconfig openstack-nova-metadata-api on

3.4查看服务与连接Compute节点是否正常
[root@controller~]# nova-manage service list
Binary          Host                  Zone           Status     StateUpdated_At
nova-consoleauthcontroller           internal        enabled    :-)  2014-07-04 18:17:15
nova-cert       controller           internal        enabled    :-)  2014-07-04 18:17:11
nova-conductor  controller            internal       enabled    :-)   2014-07-04 18:17:15
nova-console    controller           internal        enabled    :-)  2014-07-04 18:17:11
nova-scheduler  controller           internal        enabled    :-)  2014-07-04 18:17:16
nova-compute    compute1             nova            enabled   :-)   2014-07-04 18:17:13
nova-network    compute1             internal        enabled    :-)  2014-07-04 18:17:13

3.5查看各组件服务状态,没启动要手动重启下
# cd /etc/init.d/; for i in $( ls openstack-*); do service $i status; done

3.6常见故障解决之nova-api已死,pid还存在(openstack-nova-apidead but pid file exists)
故障现象:dashboard无法访问
故障分析:查看日志,tail /var/log/nova/api.log发现
2014-07-15 12:16:23.714 3046 ERROR nova.wsgi [-] Could not bind to0.0.0.0:8775
2014-07-15 12:16:23.715 3046 CRITICAL nova [-] error: [Errno 98] Addressalready in use
故障解决:可以看出8775已经监听了,但为什么起不起来呢,这就不得而知了,我们可以通过kill这个进程再重启服务,即可解决!
# netstat -tupln | grep 8775
tcp        0     0 0.0.0.0:8775   0.0.0.0:*          LISTEN      3142/python  
# kill 3142
# service openstack-nova-api start

五、创建云主机

1.1创建控制台无密码登陆虚拟机密钥
# ssh-keygen (一直回车)
# nova keypair-add --pub-key ~/.ssh/id_rsa.pub admin-key

1.2查看上传的密钥对
# nova keypair-list

1.3查看创建主机类型,也就是要分配主机资源模板
# nova flavor-list
[root@controller~]# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID |Name      | Memory_MB | Disk | Ephemeral | Swap |VCPUs |RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny   | 512       | 1    | 0       |      | 1     | 1.0       | True      |
| 2 | m1.small  | 2048      | 20   | 0       |      | 1     | 1.0       | True      |
| 3 | m1.medium | 4096      | 40   | 0       |      | 2     | 1.0       | True      |
| 4 | m1.large  | 8192      | 80   | 0       |      | 4     | 1.0       | True      |
| 5 | m1.xlarge | 16384     | 160  | 0       |      | 8     | 1.0       | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+

1.4设置default默认访问规则,允许ping和22访问
# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

1.5创建虚拟机
# nova boot --flavor m1.tiny --image cirros-0.3.2-x86_64 --nicnet-id=ADMIN_NET_ID \
--security-group default --key-name admin-key cirros

1.6查看云主机状态
[root@controller~]# nova list
+---------------+--------+--------+------------+-------------+----------------------+
| ID            | Name   | Status |Task State |Power State | Networks             |
+---------------+--------+--------+------------+-------------+----------------------+
|096123ba-dacf-4d9a-bfe7-c90901cb3d14 |crrios | ACTIVE | -  | Running| admin-net=192.168.1.2 |
+---------------+--------+--------+------------+-------------+----------------------+

1.7登陆Horizon控制台查看云主机



4.png (104.48 KB, 下载次数: 0)

下载附件  保存到相册

2014-9-4 08:15 上传


CentOS6.5磁盘镜像下载地址:
http://repos.fedorapeople.org/repos/openstack/guest-images/centos-6.5-20140117.0.x86_64.qcow2
以上基本的Openstack I版部署完毕,接触不久,有什么问题,可以一起交流,有时间会部署块存储Cinder、对象存储Swift、Neutron等,到时候会发布博客与大家分享。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics