CentOS6搭建OpenStack[icehouse]计算节点

CentOS6搭建OpenStack[icehouse]计算节点 - 1
OpenStack是IaaS(基礎設施即服務)軟件,讓任何人都可以自行建立和提供雲端運算服務。此外,OpenStack也用作建立防火牆內的「私有雲」(Private Cloud),提供機構或企業內各部門共享資源。
-Wiki
这篇文章主要记录一下openstack计算节点的安装过程
基本环境配置
1.配置hosts文件使多节点间能相互通讯

/etc/hosts
#控制节点
192.168.1.100 CloudController
#计算节点
192.168.1.101 CloudNova
#网络节点
192.168.1.102 CloudNeutron

2.配置yum源

yum install https://repos.fedorapeople.org/repos/openstack/EOL/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm
yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#安装好openstack的源后要修改源文件里面的baseurl
vim /etc/yum.repo.d/rdorelease.repo
https://repos.fedorapeople.org/repos/openstack/EOL/openstack-icehouse/epel-6/

3.安装openstack基本工具
安装openstack基本配置工具和openstackselinux管理工具,更新系统并重启

yum install openstack-utils
yum install openstack-selinux
yum update
reboot

Nova组件安装

#安装nova组件
yum install openstack-nova-compute
#将nova组件与controller链接
openstack-config --set /etc/nova/nova.conf database connection mysql://nova:[email protected]/nova
#配置nova组件与controller keystone进行认证
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://CloudController:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host CloudController
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 123
#配置nova组件使用qpid消息服务器
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname CloudController
#配置nova组件使用vnc提供远程控制台服务
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.6.12.131
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.101
openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_base_url http://CloudController:6080/vnc_auto.html
#为nova配置镜像服务器
openstack-config --set /etc/nova/nova.conf DEFAULT glance_host CloudController
#判断你的处理器是否支持KVM,如果执行第一句发现返回值为0,则使用qemu模式作为底层虚拟化
egrep -c '(vmx|svm)' /proc/cpuinfo(如果返回0,执行下面这句,否则不执行)
openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu
#启动服务并设置开机启动
service libvirtd start
chkconfig libvirtd on
service messagebus start
chkconfig messagebus on
service openstack-nova-compute start
chkconfig openstack-nova-compute on 

安装配置neutron组件

#关闭ip欺骗过滤
vim /etc/sysctl.conf
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.bridge.bridge-nf-call-arptables=1
net.bridge.bridge-nf-call-iptables=1
modprobe bridge
sysctl -p
#安装网络组件
yum install openstack-neutron-ml2 openstack-neutron-openvswitch
#与keystone进行认证
openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_uri http://CloudController:5000
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_host CloudController
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken admin_user neutron
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken admin_password 123
#配置网络组件使用QPID消息服务器
openstack-config --set /etc/neutron/neutron.conf DEFAULT rpc_backend neutron.openstack.common.rpc.impl_qpid
openstack-config --set /etc/neutron/neutron.conf DEFAULT qpid_hostname CloudController
#配置neutron网络模式为ml2
openstack-config --set /etc/neutron/neutron.conf DEFAULT core_plugin ml2
openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins router
#配置ml2组件
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers gre
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types gre
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers openvswitch
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_gre tunnel_id_ranges 1:1000
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs local_ip 192.168.1.101
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs tunnel_type gre
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling True
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_security_group True
#启动服务并设置开机启动
service openvswitch start
chkconfig openvswitch on
#创建桥接网络
ovs-vsctl add-br br-int
#配置nova使用neutron网络服务
openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class nova.network.neutronv2.api.API
openstack-config --set /etc/nova/nova.conf DEFAULT neutron_url http://CloudController:9696
openstack-config --set /etc/nova/nova.conf DEFAULT neutron_auth_strategy keystone
openstack-config --set /etc/nova/nova.conf DEFAULT neutron_admin_tenant_name service
openstack-config --set /etc/nova/nova.conf DEFAULT neutron_admin_username neutron
openstack-config --set /etc/nova/nova.conf DEFAULT neutron_admin_password 123
openstack-config --set /etc/nova/nova.conf DEFAULT neutron_admin_auth_url http://CloudController:35357/v2.0
openstack-config --set /etc/nova/nova.conf DEFAULT linuxnet_interface_driver nova.network.linux_net.LinuxOVSInterfaceDriver
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf DEFAULT security_group_api neutron
#为ML2插件创建链接使其变为neutron的插件
ln -s plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
#将OVS添加到服务当中
cp /etc/init.d/neutron-openvswitch-agent /etc/init.d/neutronopenvswitch-agent.orig
sed -i 's,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g' /etc/init.d/neutron-openvswitch-agent

#启动/重启相关服务并设置开机启动
service openstack-nova-compute restart
service neutron-openvswitch-agent start
chkconfig neutron-openvswitch-agent on

验证
至此计算节点就已经安装配置好了,在conntroller节点上验证

nova host-list
#若配置无误,返回值大概如下
+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
| Binary           | Host            | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+
| nova-cert        | CloudController | internal | enabled | up    | 2016-05-06T13:04:42.000000 | -               |
| nova-consoleauth | CloudController | internal | enabled | up    | 2016-05-06T13:04:43.000000 | -               |
| nova-scheduler   | CloudController | internal | enabled | up    | 2016-05-06T13:04:42.000000 | -               |
| nova-conductor   | CloudController | internal | enabled | up    | 2016-05-06T13:04:41.000000 | -               |
| nova-compute     | CloudNova       | nova     | enabled | up    | 2016-05-06T13:04:43.000000 | -               |
+------------------+-----------------+----------+---------+-------+----------------------------+-----------------+

2 thoughts on “CentOS6搭建OpenStack[icehouse]计算节点”

Leave a Reply

Your email address will not be published. Required fields are marked *