设为首页 收藏本站
查看: 1027|回复: 0

[经验分享] OpenStack三个节点icehouse

[复制链接]

尚未签到

发表于 2017-6-26 15:18:30 | 显示全部楼层 |阅读模式
一、环境准备

1、架构
  创建3台虚拟机,分别作为controll节点、network节点和compute1节点。
  Controller节点:1processor,2G memory,5G storage。
  Network节点:1processor,2G memory,5G storage。
  Comute1节点:1processor,2G memory,5G storage。
  架构图:
DSC0000.gif View Code  配置/etc/hosts如下:


View Code  Network节点:三张网卡,配置eth0为管理网络,eth1为业务网络,eth2为外部网络,需特殊配置。


View Code  配置/etc/hosts如下:


View Code  Comput节点:两张网卡,配置eth0为管理网络,配置eth1为业务网络。


View Code  配置/etc/hosts如下:


View Code
3、确认网络已经配置好
  Controller节点:
  # ping -c 4 openstack.org【ping通外网】
  # ping -c 4 network【ping通网络节点的管理网络】
  # ping -c 4 compute1【ping通计算节点的管理网络】
  Network节点:
  # ping -c 4 openstack.org【ping通外网】
  # ping -c 4 controller【ping 通控制节点的管理网络】
  # ping -c 4 10.0.1.31【ping 通计算节点的tunnel网络】
  Compute节点:
  # ping -c 4 openstack.org【ping外网通】
  # ping -c 4 controller【ping 控制节点的管理网络通】
  # ping -c 4 10.0.1.21【ping 通网络节点的tunnel网络】

二、基础环境配置

1、设置全局环境变量
  为了方便配置后续配置,先设置全局的环境变量。
  controller节点设置:


View Code  compute节点设置:


View Code
2、更新系统
  在三个节点都要执行下面操作。
  第一步、安装Ubuntu Cloud Archive



# apt-get install python-software-properties
# add-apt-repository cloud-archive:icehouse
  Ubuntu Cloud Archive是一个特殊的库允许你安装Ubuntu支持的稳定的最新发布的OpenStack。
  第二步、更新系统



# apt-get update
# apt-get dist-upgrade 【//lxy:需要十分钟,耐心等待】
  第三步,安装Ubuntu 13.10 backported kernel
  Ubuntu12.04需要安装这个Linux kernel来提升系统的稳定性。



# apt-get install linux-image-generic-lts-saucy  
  第四步,重启系统生效



# reboot
3、安装NTP(Network Time Protocal)
  为做到每个节点的时间同步,需要在每个节点都安装ntp,然后修改配置,将/etc/ntp.conf添加controller为时间源。
  在controller节点:
  第一步、安装



# apt-get install ntp
  第二步、配置/etc/ntp.conf



# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10
  将ntp.ubuntu.com作为时间源,此外添加一个本地时间源,以防网络时间服务中断,其中server 127.127.1.0表示本机是ntp服务器。
  或者执行下面命令:


View Code  第三步,重启ntp服务。



#service ntp restart
  在controller之外的节点,
  第一步,安装



# apt-get install ntp
  第二步,配置/etc/ntp.conf,将controller作为时间源。



# Use Ubuntu's ntp server as a fallback.
server controller
  或者执行命令:


View Code  第三步:重启NTP服务。

4、安装数据库
  每个节点都要安装python-mysqldb组件,用于数据库连接,只有主控需要安装mysqlserver。
  controller节点:
  第一步安装:



# apt-get install python-mysqldb mysql-server
  Note:安装过程终端会提醒输入mysql root账户的密码,这里设置为password。
  第二步,配置/etc/mysql/my.conf文件
  将[mysqld]模块中bind-address设置为controller节点管理网络的ip,确保其他节点通过管理网络获取Mysql服务。也可以设置为0.0.0.0,就是将mysql服务绑定到所有网卡。



[mysqld]
...
bind-address = 10.1.101.11
  在[mysqld]模块bind-address后面增加如下配置,来设置UTF-8字符集和InnoDB。


View Code  第三步,重启mysql服务使设置生效



# service mysql restart
  第四步,删除匿名用户
  数据库第一次启动时会创建一些匿名用户,必须将这些用户删除,否则后面数据库连接会出错。



# mysql_secure_installation
  Note:
  1、该命令提供一堆选择给你来改善mysql数据库的安全性,除了不要改密码,其他都选yes,除非有你自己的理由。
  2、如果mysql_secure_installation命令失败则执行
# mysql_install_db

  # mysql_secure_installation
  第五步,创建OpenStack中的Database,Users,Privileges


View Code  在controller之外的节点安装python-mysqldb



# apt-get install python-mysqldb
5、安装消息代理RabbitMQ
  第一步,安装



# apt-get -y install rabbitmq-server
  第二步,改密码
  RabbitMQ默认创建一个用户,用户名密码都是guest,执行以下命令将guest用户的密码改为password



#rabbitmqctl change_password guest $RABBIT_PASSWORD
  在用到RabbitMQ的openstack服务配置文件中都要修改rabbit_password。

三、安装OpenStack服务
DSC0001.gif


1、安装keystone
  在controller节点安装OpenStack认证服务.
  第一步、安装keystone



# apt-get install keystone
  第二步、配置/etc/keystone/keystone.conf


View Code  更新keystone.conf中MySQL连接
  默认使用的是connection = sqlite:////var/lib/keystone/keystone.db,而不是mysql。



[database]
# The SQLAlchemy connection string used to connect to the database
connection = mysql://keystone:KEYSTONE_DBPASS@controller/keystone
  或者执行命令


View Code  第三步、删除keystone.db
  默认情况,Ubuntu包创建了一个SQLite数据库。删除/var/lib/keystone/目录下的keystone.db文件确保后面不会出错。



# rm /var/lib/keystone/keystone.db
  第四步、重启keystone并同步数据库



# service keystone restart
# keystone-manage db_sync
  第五步、创建OpenStack中的users, tenants, services
  首先创建Keystone数据导入脚本Ksdata.sh ,内容如下:


View Code  运行脚本



#bash Ksdata.sh
  第六步,创建endpoints
  首先创建脚本Ksendpoints.sh


View Code  运行脚本



# bash Ksendpoints.sh
  第七步,验证
  现在keystone已经安装完成,验证身份认证服务安装是否正确。



# keystone user-list
# keystone user-role-list --user admin --tenant admin
2、安装OpenStack客户端
  安装完后,可以通过命令来调用OpenStack各个服务的api。


View Code
3、安装Glance(镜像服务)
  在controller节点安装image服务
  第一步、安装glance。



# apt-get install glance
  第二步、配置
  因为glance包含两类服务所以修改配置文件/etc/glance/glance-api.conf和/etc/glance/glance-registry.conf
  更新glance的认证配置。
  默认:
  [keystone_authtoken]
auth_host = 127.0.0.1
auth_port = 35357
auth_protocol = http
admin_tenant_name = %SERVICE_TENANT_NAME%
admin_user = %SERVICE_USER%
admin_password = %SERVICE_PASSWORD%
  修改为:
  [keystone_authtoken]
auth_host = 127.0.0.1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = password
  或者用下面命令:


View Code  修改两个文件中[database]模块数据库连接,
  默认为:
  #connection = <None>修改为:



connection = mysql://glance:password@controller/glance
  或直接执行命令


View Code
在[DEFAULT]中增加以下配置




[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
rabbit_password = RABBIT_PASS
  设置flavor为keystone



sed -i 's/#flavor=/flavor=keystone/g' /etc/glance/glance-api.conf /etc/glance/glance-registry.conf
  第三步、删除glance.sqlite



# rm /var/lib/glance/glance.sqlite
  第四步、检查配置





[keystone_authtoken]
#auth_host = 127.0.0.1
auth_uri = http://controller:5000
auth_host = controller
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = password


  第五步、重启glance相关服务并同步数据库



#service glance-api restart
#service glance-registry restart
#glance-manage db_sync
  第六步、下载镜像测试glance服务



#wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
#wget http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
  添加cirros镜像



#glance add name=cirros-0.3.2-x86_64 is_public=true container_format=bare \
disk_format=qcow2 < cirros-0.3.2-x86_64-disk.img
  查看镜像



#glance index
4、安装cinder(块存储)
  块存储,cinder用作虚拟机存储管理,管理卷,卷快照,卷类型。包括cinder-ap、cinder-volume、 cinder-scheduler daemon、 Messaging queue。在controller节点安装cider。
  第一步、安装cinder组件



# apt-get install -y cinder-api cinder-scheduler cinder-volume iscsitarget \
open-iscsi iscsitarget-dkms python-cinderclient linux-headers-`uname -r`
  第二步,修改iscsitarget配置文件并重启服务



# sed -i 's/false/true/g' /etc/default/iscsitarget
# service iscsitarget start
# service open-iscsi start
  第三步,配置cinder文件
  默认为:
  [DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
api_paste_confg = /etc/cinder/api-paste.ini
iscsi_helper = tgtadm
volume_name_template = volume-%s
volume_group = cinder-volumes
verbose = True
auth_strategy = keystone
state_path = /var/lib/cinder
lock_path = /var/lock/cinder
volumes_dir = /var/lib/cinder/volumes
  配置为:





# cat >/etc/cinder/cinder.conf <<EOF
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
sql_connection = mysql://cinder:$MYSQL_PASS@$MASTER:3306/cinder
iscsi_helper = ietadm
volume_group = cinder-volumes
rabbit_password= $RABBIT_PASSWORD
logdir=/var/log/cinder
verbose=true
auth_strategy = keystone
EOF

# sed -i -e " s/%SERVICE_TENANT_NAME%/service/g; \
s/%SERVICE_USER%/cinder/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " \
/etc/cinder/api-paste.ini

  第四步、同步cinder数据库,并重启相关服务



# cinder-manage db sync
# service cinder-api restart
# service cinder-scheduler restart
# service cinder-volume restart
5、安装nova(计算服务)

controller节点:
  第一步、安装nova组件



# apt-get install nova-api nova-cert nova-conductor nova-consoleauth \
nova-novncproxy nova-scheduler python-novaclient
  第二步、修改配置/etc/nova/nova.conf


View Code  第三步、删除nova.sqlite数据库



# rm /var/lib/nova/nova.sqlite  
  第四步、同步数据库、重启服务





# nova-manage db sync
# service nova-conductor restart
# service nova-api restart
# service nova-cert restart
# service nova-consoleauth restart
# service nova-scheduler restart
# service nova-novncproxy restart

  第五步、检查nova服务是否安装成功(确保nova-cert、nova-consoleauth、nova-scheduler和nova-conductor均开启)



# nova-manage service list
Compute节点:
  第一步、安装nova组件



# apt-get install nova-compute-kvm python-guestfs
  第二步、make the current kernel readable for qemu and libguestfs



# dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-$(uname -r)
  第三步、Enable this override for all future kernel updates





cat > /etc/kernel/postinst.d/statoverride <<EOF
#!/bin/sh
version="\$1"
# passing the kernel version is required
[ -z "\${version}" ] && exit 0
dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-\${version}
EOF

#make the file executable
chmod +x /etc/kernel/postinst.d/statoverride

  第四步、配置 /etc/nova/nova.conf


View Code  第五步、删除nova.sqlite数据库



# rm /var/lib/nova/nova.sqlite
  第六步、配置/etc/nova/nova-compute.conf,使用qemu而非kvm。


View Code  第七步、重启服务



# service nova-compute restart
  第八步、检查nova服务是否安装成功(确保nova-cert、nova-consoleauth、nova-scheduler、nova-conductor和nova-compute均开启)



# nova-manage service list
6、安装neutron(网络服务)

controller节点:
  第一步、安装neutron 组件



# apt-get install neutron-server neutron-plugin-ml2
  第二步、配置/etc/neutron/neutron.conf
  需要配置包括数据库,认证,消息代理,拓扑改变通知和plugin。
  数据库连接
  默认为:onnection = sqlite:////var/lib/neutron/neutron.sqlite,用以下命令修改



sed -i '/connection = .*/{s|sqlite:///.*|mysql://'"neutron"':'"$MYSQL_PASS"'@'"$CONTROLLER_IP"'/neutron|g}' \
/etc/neutron/neutron.conf
  身份验证



sed -i 's/# auth_strategy = keystone/auth_strategy = keystone/g' \
/etc/neutron/neutron.conf

sed -i -e " s/%SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/neutron/g; \
s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; \
s/auth_host = 127.0.0.1/auth_host = $CONTROLLER_IP/g" /etc/neutron/neutron.conf
  配置消息代理



sed -i -e " s/# rpc_backend = neutron.openstack.common.rpc.impl_kombu/rpc_backend = neutron.openstack.common.rpc.impl_kombu/g; \
s/# rabbit_host = localhost/rabbit_host = $CONTROLLER_IP/g; \
s/# rabbit_password = guest/rabbit_password = $SERVICE_PASSWORD/g; \
s/# rabbit_userid = guest/rabbit_userid = guest/g" \
/etc/neutron/neutron.conf
  配置网络拓扑改变通知compute





service_id=`keystone tenant-get service | awk '$2~/^id/{print $4}'`

sed -i -e " s/# notify_nova_on_port_status_changes = True/notify_nova_on_port_status_changes = True/g; \
s/# notify_nova_on_port_data_changes = True/notify_nova_on_port_data_changes = True/g; \
s/# nova_url = http:\/\/127.0.0.1:8774\/v2/nova_url = http:\/\/$MASTER:8774\/v2/g; \
s/# nova_admin_username =/nova_admin_username = nova/g; \
s/# nova_admin_tenant_id =/nova_admin_tenant_id = $service_id/g; \
s/# nova_admin_password =/nova_admin_password = $SERVICE_PASSWORD/g; \
s/# nova_admin_auth_url =/nova_admin_auth_url = http:\/\/$MASTER:35357\/v2.0/g" \
/etc/neutron/neutron.conf
其中,# keystone tenant-get service用来获得service租户的id

  配置ML2 plug-in



sed -i -e 's/core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin/core_plugin = ml2/g' /etc/neutron/neutron.conf
sed -i -e 's/# service_plugins =/service_plugins = router/g' /etc/neutron/neutron.conf
sed -i -e 's/# allow_overlapping_ips = False/allow_overlapping_ips = True/g' /etc/neutron/neutron.conf
  第三步、配置/etc/neutron/plugins/ml2/ml2_conf.ini
  ML2代理使用OVS代理来创建虚拟网络架构。然而,controller节点不需要OVS代理或服务,因为controller节点不处理虚拟机网络通信。
  在[ml2]模块,[ml2_type_gre]模块增加以下配置,并增加[securitygroup]新模块的配置。





[ml2]
type_drivers = gre
tenant_network_types = gre
mechanism_drivers =openvswitch
[ml2_type_gre]
tunnel_id_ranges =1:1000
[securitygroup]
# Controls if neutron security group is enabled or not.
# It should be false when you use nova security group.
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
enable_security_group = True

  第四步、配/etc/nova/nova.conf
  默认情况,虚拟机会使用legacy networking,所以必须配置。确认按照下面配置。





network_api_class = nova.network.neutronv2.api.API
neutron_url = http://10.1.101.11:9696
neutron_auth_strategy = keystone
neutron_admin_tenant_name = service
neutron_admin_username = neutron
neutron_admin_password = password
neutron_admin_auth_url = http://10.1.101.11:35357/v2.0
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api = neutron

  因为默认虚拟机使用内部防火墙服务,因为Networking有防火墙,所以需要要配置防火墙为firewall_driver = nova.virt.firewall.NoopFirewallDriver
  第五步、完成安装



1. Restart the Compute services:
# service nova-api restart
# service nova-scheduler restart
# service nova-conductor restart
2. Restart the Networking service:
# service neutron-server restart
network节点:
  第一步、在安装OpenStack之前需要开启一些核心的网络服务,IP转发。



echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter=0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter=0" >> /etc/sysctl.conf
sysctl -p
  第二步、安装neutron组件



# apt-get install neutron-plugin-ml2 neutron-plugin-openvswitch-agent
openvswitch-datapath-dkms \
neutron-l3-agent neutron-dhcp-agent
  Tip:


View Code  第三步、配置/etc/neutron/neutron.conf
  [DEFAULT]模块和[keystone_authtoken]模块





[DEFAULT]
...
auth_strategy = keystone
rpc_backend = neutron.openstack.common.rpc.impl_kombu
rabbit_host = controller
rabbit_password = RABBIT_PASS
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_host = controller
auth_protocol = http
auth_port = 35357
admin_tenant_name = service
admin_user = neutron
admin_password = NEUTRON_PASS

  注释掉[service_providers]所有行
  第四步、配置L3agent /etc/neutron/l3_agent.ini



[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
use_namespaces = True
debug = True
  第五步、配置DHCP agent /etc/neutron/dhcp_agent.ini



[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
use_namespaces = True
debug = True
  第六步、配置metadata agent  /etc/neutron/metadata_agent.ini
  Metadate代理为远程访问虚拟机授权提供配置信息





[DEFAULT]
...
auth_url = http://controller:5000/v2.0【一定要配置对】
auth_region = regionOne
admin_tenant_name = service
admin_user = neutron
admin_password = NEUTRON_PASS
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET

  下面两步在controller节点完成
  1、编辑/etc/nova/nova.conf在[DEFAULT]加上, METADATA_SECRET为对应密码,我改为password。



[DEFAULT]
...
service_neutron_metadata_proxy = true
neutron_metadata_proxy_shared_secret = METADATA_SECRET
  2、在controller节点,重启Compute API服务。



# service nova-api restart
  第七步、配置ML2 plug-in网络/etc/neutron/plugins/ml2/ml2_conf.ini
  在[ml2]模块增加



[ml2]
...
type_drivers = gre
tenant_network_types = gre
mechanism_drivers = openvswitch
  在[ml2_type_gre]模块增加



[ml2_type_gre]
...   
tunnel_id_ranges = 1:1000
  新增[ovs]模块并增加下面内容,其中INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS替换为network节点虚拟机tunnels网络的网卡ip地址。这里为10.0.1.21



[ovs]
...
local_ip = INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS
tunnel_type = gre
enable_tunneling = True
  新增[securitygroup]模块并增加



[securitygroup]
...
firewall_driver = neutron.agent.linux.iptables_firewall.
OVSHybridIptablesFirewallDriver
enable_security_group = True
  第八步,配置OVS服务
  OVS提供底层虚拟机网络架构。br-int处理虚拟机内部网络通信。br-ext处理虚拟机外部网络通信。br-ext需要一个port在物理外网网卡来为虚拟机提供外部网络通信。这个port 桥接虚拟网络和物理外网。
  重启OVS服务。



# service openvswitch-switch restart
  添加集成网桥



# ovs-vsctl add-br br-int
  添加外部网桥



# ovs-vsctl add-br br-ex
  添加外部网卡借以通外网
  将INTERFACE_NAME  替换为当前网卡的名字。比如eth2或者ens256.我的是eth2.



# ovs-vsctl add-port br-ex INTERFACE_NAME
  然后要配置network节点的/etc/network/interface中的br-ex网卡,完整内容如下:


View Code  重启服务



/etc/init.d/networking restart
  第九步、完成安装



# service neutron-plugin-openvswitch-agent restart
# service neutron-l3-agent restart
# service neutron-dhcp-agent restart
# service neutron-metadata-agent restart
compute节点:
  第一步,开启ip转发



echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter=0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter=0" >> /etc/sysctl.conf
sysctl -p
  第二步、安装neutron组件



# apt-get install neutron-common neutron-plugin-ml2 neutron-plugin-openvswitch-agent
超过3.11的Ubuntu内核版本都不需要安装openvswitch-datapath-dkms,
因为我的Ubuntu版本是3.12所以不需要安装openvswitch-datapath-dkms
  第三步、配置/etc/neutron/neutron.conf
  需要配置认证服务,消息代理和plugin
  认证



[DEFAULT]
...
auth_strategy = keystone
  在[keystone_authtoken]模块增加下面内容,要修改NEUTRON_PASS为对应密码,我的是password




[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_host = controller
auth_protocol = http
auth_port = 35357
admin_tenant_name = service
admin_user = neutron
admin_password = NEUTRON_PASS

  消息代理,在[DEFAULT]模块增加下面内容,注意要替换RABBIT_PASSRabbitMQ的密码。



[DEFAULT]
...
rpc_backend = neutron.openstack.common.rpc.impl_kombu
rabbit_host = controller
rabbit_password = RABBIT_PASS
  配置ML2,在[DEFAULT]模块增加下面内容



[DEFAULT]
...
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
verbose = True
  注释掉[service_providers]模块所有行
  第四步、配置ML2 plug-in /etc/neutron/plugins/ml2/ml2_conf.ini
  ML2 plug-in用OVS来建立虚拟机网络。
  在[ml2]模块增加



[ml2]
...
type_drivers = gre
tenant_network_types = gre
mechanism_drivers = openvswitch
  在[ml2_type_gre]模块增加



[ml2_type_gre]
...
tunnel_id_ranges = 1:1000
  增加[ovs]模块,并增加下面内容,注意INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS要替换成compute节点虚拟机tunnels网卡的ip,这里是10.0.1.31



[ovs]
...
local_ip = INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS
tunnel_type = gre
enable_tunneling = True
  增加[securitygroup]模块,并添加下面内容。



[securitygroup]
...
firewall_driver = neutron.agent.linux.iptables_firewall.
OVSHybridIptablesFirewallDriver
enable_security_group = True
  第五步、配置OVS服务
  OVS提供底层的虚拟网络框架。Br-int处理虚拟机内部网络流量。
  重启OVS服务



# service openvswitch-switch restart
  添加集成网桥



# ovs-vsctl add-br br-int
  第六步、配置计算服务nova使用neutron /etc/nova/nova.conf
  默认虚拟机会使用legacy networking。所以要进行配置使其使用Neutron。
  在[DEFAULT]模块增加下面内容:注意要修改NEUTRON_PASS为真正的密码,我的是password。





[DEFAULT]
...
network_api_class = nova.network.neutronv2.api.API
neutron_url = http://controller:9696
neutron_auth_strategy = keystone
neutron_admin_tenant_name = service
neutron_admin_username = neutron
neutron_admin_password = NEUTRON_PASS
neutron_admin_auth_url = http://controller:35357/v2.0
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api = neutron
  默认虚拟机会使用内部防火墙,这里为了让它使用Neutron的防火墙,所以配置。nova.virt.firewall.NoopFirewallDriver


  第七步、完成配置
  重启计算服务



# service nova-compute restart
  重启OVS代理



# service neutron-plugin-openvswitch-agent restart
7、安装dashboard
  在controller节点安装dashboard
  第一步、安装



# apt-get -y install apache2 libapache2-mod-wsgi openstack-dashboard memcached python-memcache
  删除openstack-dashboard-ubuntu-theme这个软件包,因为它对一些功能有阻碍作用



# apt-get remove --purge openstack-dashboard-ubuntu-theme
  第二步、配置/etc/openstack-dashboard/local_settings.py
  修改['default']['LOCATION']中的CACHES来匹配/etc/memcached.conf的内容。



CACHES = {
'default': {
'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION' : '127.0.0.1:11211'
}
}
  修改OPENSTACK_HOST选项为认证服务的机子。



OPENSTACK_HOST = "controller"
  第三步、启动apache web服务和memcached



# service apache2 restart
# service memcached restart
  第四步、重启keyston服务,并同步数据库



# service keystone restart
# keystone-manage db_sync
  现在基本配置都已经完成,可以使用OpenStack了。
  测试环境可参考用命令测试安装好的OpenStack环境
  以上为我个人配置笔记,仅作参考,更详细介绍请参考官方文档。

8、增加一个compute节点
  1、网卡配置
  Comput2节点:两张网卡,配置eth0为管理网络,配置eth1为业务网络。


View Code  配置/etc/hosts如下:


View Code  compute2网卡配置好以后,在controller、network和compute节点的/etc/hosts加上相应配置。
  2、确认网络配置正确
  Compute节点:
  # ping -c 4 openstack.org【ping外网通】
  # ping -c 4 controller【ping 控制节点的管理网络通】
  # ping -c 4 10.0.1.21【ping 通网络节点的tunnel网络】
  # ping -c 4 10.0.1.31【ping 通compute节点的tunnel网络】
  3、更新系统



#apt-get update
#apt-get install python-software-properties
#add-apt-repository cloud-archive:icehouse
#apt-get dist-upgrade【//lxy:需要十分钟,耐心等待】


# apt-get install linux-image-generic-lts-saucy  


# reboot
  4、改主机名



# hostname compute2
# echo "compute2" > /etc/hostname
  5、设置IP转发



echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter=0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter=0" >> /etc/sysctl.conf
sysctl -p
  6、装NTP



# apt-get install -y ntp
# sed -i -e " s/server ntp.ubuntu.com/server controller/g" /etc/ntp.conf
# service ntp restart
  7、设置环境变量


View Code  8、装nova-compute





# apt-get -y install nova-compute-kvm python-guestfs
# 选yes
# 为使得当前kernel可读对qemu和libguestfs
# dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-$(uname -r)
# 允许将来内核更新,写个脚本
#cat > /etc/kernel/postinst.d/statoverride <<EOF
#!/bin/sh
version="\$1"
# passing the kernel version is required
[ -z "\${version}" ] && exit 0
dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-\${version}
EOF
# 让脚本可执行
# chmod +x /etc/kernel/postinst.d/statoverride

  配置nova.conf


View Code  用qemu代替kvm



# sed -i 's/kvm/qemu/g' /etc/nova/nova-compute.conf
# service nova-compute restart
  9、装neutron



# apt-get install neutron-common neutron-plugin-ml2 neutron-plugin-openvswitch-agent \
openvswitch-datapath-dkms
  更新配置neutron.conf





#更新数据库连接
sed -i '/connection = .*/{s|sqlite:///.*|mysql://'"neutron"':'"$MYSQL_PASS"'@'"$CONTROLLER_IP"'/neutron|g}' \
/etc/neutron/neutron.conf
#使用身份验证keystone
sed -i 's/# auth_strategy = keystone/auth_strategy = keystone/g' \/etc/neutron/neutron.conf
sed -i -e " s/%SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/neutron/g; \s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; \s/auth_host = 127.0.0.1/auth_host = $CONTROLLER_IP/g" /etc/neutron/neutron.conf
#使用消息代理
sed -i -e " s/# rpc_backend = neutron.openstack.common.rpc.impl_kombu/rpc_backend = neutron.openstack.common.rpc.impl_kombu/g; \
s/# rabbit_host = localhost/rabbit_host = $CONTROLLER_IP/g; \
s/# rabbit_password = guest/rabbit_password = $SERVICE_PASSWORD/g; \
s/# rabbit_userid = guest/rabbit_userid = guest/g" \
/etc/neutron/neutron.conf
#配置使用ML2 plug-in
sed -i -e 's/core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin/core_plugin = ml2/g' /etc/neutron/neutron.conf
sed -i -e 's/# service_plugins =/service_plugins = router/g' /etc/neutron/neutron.conf
sed -i -e 's/# allow_overlapping_ips = False/allow_overlapping_ips = True/g' /etc/neutron/neutron.conf

  10、配置ML plug-in





sed -i -e " s/# type_drivers = local,flat,vlan,gre,vxlan/type_drivers = gre/g; \
s/# tenant_network_types = local/tenant_network_types = gre/g; \
s/# mechanism_drivers =/mechanism_drivers = openvswitch/g; \
s/# tunnel_id_ranges =/tunnel_id_ranges = 1:1000/g;
s/# enable_security_group = True/enable_security_group = True/g" \
/etc/neutron/plugins/ml2/ml2_conf.ini

cat << EOF >> /etc/neutron/plugins/ml2/ml2_conf.ini
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
EOF

cat << EOF >> /etc/neutron/plugins/ml2/ml2_conf.ini
[ovs]
local_ip = $LOCAL_IP
tunnel_type = gre
enable_tunneling = True
EOF

  11、配置OVS服务



# 重启OVS服务
# service openvswitch-switch restart
# 重启neutron服务
# cd /etc/init.d/; for i in $( ls neutron-* ); do sudo service $i restart; done

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-388232-1-1.html 上篇帖子: Openstack 网络服务Neutron [五] 下篇帖子: 【openstack N版】——块存储服务cinder
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表