使用OpenStack计算主机和管理云计算系统。OpenStack计算节点是基础设计即服务(IaaS)系统中最重要的一个部分。这个主模块有Python实现。OpenStack认证服务为OpenStack计算交互完成授权认证;OpenStack镜像服务提供磁盘和服务镜像;OpenStack仪表盘为用户管理员提供管理界面接口。镜像访问受项目和用户权限限制;每个项目引用限制(实例的数量)。OpenStack计算在标准硬件上可以水平扩展,下载镜像启动实例。
Nova是由多个服务进程组成,每个进程执行不同的功能。用户面接口是REST API,Nova组件内部通信是通过RPC消息传递机制进行的。API服务处理REST请求,典型地包括数据库读/写,选择性发送RPC消息到其他Nova服务,REST调用引起反馈。RPC消息是通过oslo.messaging库完成,一个抽象的顶层消息队列。多数主要的Nova组件可以运行在多个主机上,通过监听RPC消息来进行管理。一个最主要的例外是nova-compute,是一个单进程运行在虚拟机监控程序管理(除了使用VMware或Ironic驱动)。这管理器也是可选的,是一个周期性进程。Nova也使用一个中央数据库(逻辑上)所有组件之间共享。不管怎样,为了帮助更新,数据库是通过一个对象层访问确保更新控制面板始终可以在nova-compute运行在之前发布的版本上进行通信。使这一切成为可能nova-compute 代理DB请求 RPC到中央管理器调用nova-conductor。
- DB:SQL数据库进行数据存储
- API:接收HTTP请求的组件,转换命令和通过oslo.messaging队列或HTTP与其他组件进行通信
- Scheduler:决定实例运行哪个主机上
- Network:管理IP跳转、桥接和vlans
- Compute:与虚拟机监控程序和虚拟机管理通信
- Conductor:处理请求,需要协调(建立/调整),作为一个数据库代理,或处理对象转换。
mysql -uroot -pSWPUcs406mariadb -e "CREATE DATABASE nova_api;"
mysql -uroot -pSWPUcs406mariadb -e "CREATE DATABASE nova;"
mysql -uroot -pSWPUcs406mariadb -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'SWPUcs406dbnova';"
mysql -uroot -pSWPUcs406mariadb -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'SWPUcs406dbnova';"
mysql -uroot -pSWPUcs406mariadb -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'controller' IDENTIFIED BY 'SWPUcs406dbnova';"
mysql -uroot -pSWPUcs406mariadb -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'SWPUcs406dbnova';"
mysql -uroot -pSWPUcs406mariadb -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'SWPUcs406dbnova';"
mysql -uroot -pSWPUcs406mariadb -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'controller' IDENTIFIED BY 'SWPUcs406dbnova';"
mysql -uroot -pSWPUcs406mariadb -e "FLUSH PRIVILEGES;"
openstack user create --domain default --password-prompt nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne \
compute public http://controller:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
compute internal http://controller:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
compute admin http://controller:8774/v2.1/%\(tenant_id\)s
yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:SWPUcs406dbnova@controller/nova_api
openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:SWPUcs406dbnova@controller/nova
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.0.3x
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_hosts controller1,controller2
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid openstack
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password SWPUcs406rabbit
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller1:11211,controller2:11211
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken password SWPUcs406nova
openstack-config --set /etc/nova/nova.conf vnc vncserver_listen ' $my_ip'
openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address ' $my_ip'
openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova
systemctl enable openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl restart openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service \
openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 0
cat > /etc/hosts << OFF
10.0.0.10 controller
10.0.0.11 controller1
10.0.0.12 controller1
10.0.0.31 compute01
10.0.0.32 compute02
10.0.0.33 compute03
10.0.0.34 compute04
10.0.0.35 compute05
10.0.0.36 compute06
10.0.0.37 compute07
10.0.0.38 compute08
10.0.0.39 compute09
10.0.0.40 compute10
10.0.0.41 compute11
10.0.0.42 compute12
10.0.0.51 cinder1
10.0.0.52 cinder2
OFF
yum install -y ntp
sed -i "s/server 0.centos.pool.ntp.org iburst/server 127.127.1.0 iburst/" /etc/ntp.conf
sed -i "22,24d" /etc/ntp.conf
systemctl disable chronyd.service
systemctl enable ntpd.service
systemctl start ntpd.service
yum install -y https://rdoproject.org/repos/rdo-release.rpm
yum upgrade -y
yum install -y python-openstackclient
yum install -y openstack-selinux
由于Compute节点只有两个网卡口,为了方便,把后面需要在Compute节点上安装的软件一次性安装。
yum install -y openstack-nova-compute qemu-kvm libvirt virt-install bridge-utils openstack-utils \
openstack-neutron-linuxbridge ebtables ipset openstack-ceilometer-compute python-ceilometerclient python-pecan nfs-utils zabbix-agent
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.0.31
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_hosts controller1,controller2
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid openstack
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password SWPUcs406rabbit
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller1:11211,controller2:11211
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken password SWPUcs406nova
openstack-config --set /etc/nova/nova.conf vnc enabled True
openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address ' $my_ip'
openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://172.23.253.11:6080/vnc_auto.html
openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
. admin-openrc
openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+ | Id | Binary | Host | Zone | Status | State | Updated At | +----+------------------+------------+----------+---------+-------+----------------------------+ | 1 | nova-scheduler | controller | internal | enabled | up | 2016-05-24T14:23:42.000000 | | 2 | nova-conductor | controller | internal | enabled | up | 2016-05-24T14:23:42.000000 | | 3 | nova-consoleauth | controller | internal | enabled | up | 2016-05-24T14:23:46.000000 | | 9 | nova-compute | compute02 | nova | enabled | up | 2016-05-24T14:23:46.000000 | | 10 | nova-compute | compute03 | nova | enabled | up | 2016-05-24T14:23:45.000000 | | 11 | nova-compute | compute04 | nova | enabled | up | 2016-05-24T14:23:51.000000 | | 12 | nova-compute | compute05 | nova | enabled | up | 2016-05-24T14:23:46.000000 | | 13 | nova-compute | compute06 | nova | enabled | up | 2016-05-24T14:23:44.000000 | | 14 | nova-compute | compute07 | nova | enabled | up | 2016-05-24T14:23:41.000000 | | 15 | nova-compute | compute12 | nova | enabled | up | 2016-05-24T14:23:49.000000 | | 16 | nova-compute | compute11 | nova | enabled | up | 2016-05-24T14:23:41.000000 | | 17 | nova-compute | compute10 | nova | enabled | up | 2016-05-24T14:23:45.000000 | | 18 | nova-compute | compute09 | nova | enabled | up | 2016-05-24T14:23:46.000000 | | 19 | nova-compute | compute08 | nova | enabled | up | 2016-05-24T14:23:42.000000 | | 20 | nova-compute | compute01 | nova | enabled | up | 2016-05-24T14:23:44.000000 | +----+------------------+------------+----------+---------+-------+----------------------------+
参考文章:
http://docs.openstack.org/mitaka/install-guide-rdo/nova-controller-install.html