分享

openstack零基础入门:OpenStack Grizzly安装指导(2)

sstutu 发表于 2014-4-2 16:18:43 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 5 43862
本帖最后由 howtodown 于 2014-8-19 12:08 编辑
此篇是openstack零基础入门:OpenStack Grizzly安装指导(1)的续篇

3. 网络节点

准备节点
安装 64位 Ubuntu 12.04 or 13.04 Server, 切换sudo 模式:
  1. sudo su
复制代码

添加Grizzly库(适用于 Ubuntu 12.04):
  1. apt-get install -y ubuntu-cloud-keyring
  2. echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main >> /etc/apt/sources.list.d/grizzly.list
复制代码

更新系统:

  1. apt-get update -y
  2. apt-get upgrade -y
  3. apt-get dist-upgrade -y
复制代码

安装 ntp 服务:
  1. apt-get install -y ntp
复制代码

配置NTP保持与控制节点时间同步:
  1. #Comment the ubuntu NTP servers
  2. sed -i 's/server 0.ubuntu.pool.ntp.org/#server 0.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  3. sed -i 's/server 1.ubuntu.pool.ntp.org/#server 1.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  4. sed -i 's/server 2.ubuntu.pool.ntp.org/#server 2.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  5. sed -i 's/server 3.ubuntu.pool.ntp.org/#server 3.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  6. #Set the network node to follow up your conroller node
  7. sed -i 's/server ntp.ubuntu.com/server 10.10.10.51/g' /etc/ntp.conf
  8. service ntp restart
复制代码

安装vlan 与网桥配置工具bridge-utils
  1. apt-get install -y vlan bridge-utils
复制代码

启动 IP_Forwarding:
  1. sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
  2. # To save you from rebooting, perform the following
  3. sysctl net.ipv4.ip_forward=1
复制代码

3.2.网络配置

3 网卡配置如下:
  1. # OpenStack management
  2. auto eth0
  3. iface eth0 inet static
  4. address 10.10.10.52
  5. netmask 255.255.255.0
  6. # VM Configuration
  7. auto eth1
  8. iface eth1 inet static
  9. address 10.20.20.52
  10. netmask 255.255.255.0
  11. # VM internet Access
  12. auto eth2
  13. iface eth2 inet static
  14. address 192.168.100.52
  15. netmask 255.255.255.0
复制代码

3.3 OpenVSwitch (Part1)


安装 openVSwitch:
  1. apt-get install -y openvswitch-switch openvswitch-datapath-dkms
复制代码

添加 bridges:
  1. #br-int will be used for VM integration
  2. ovs-vsctl add-br br-int
  3. #br-ex is used to make to VM accessible from the internet
  4. ovs-vsctl add-br br-ex
复制代码

3.4. Quantum

安装  Quantum openvswitch 代理, l3 代理 and dhcp 代理组件:
  1. apt-get -y install quantum-plugin-openvswitch-agent quantum-dhcp-agent quantum-l3-agent quantum-metadata-agent
复制代码

编辑 /etc/quantum/api-paste.ini:
  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = quantum
  8. admin_password = service_pass
复制代码

编辑 the OVS plugin 配置文件 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini:
  1. #Under the database section
  2. [DATABASE]
  3. sql_connection = mysql://quantumUser:quantumPass@10.10.10.51/quantum
  4. #Under the OVS section
  5. [OVS]
  6. tenant_network_type = gre
  7. tunnel_id_ranges = 1:1000
  8. integration_bridge = br-int
  9. tunnel_bridge = br-tun
  10. local_ip = 10.20.20.52
  11. enable_tunneling = True
  12. #Firewall driver for realizing quantum security group function
  13. [SECURITYGROUP]
  14. firewall_driver = quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
复制代码

更新/etc/quantum/metadata_agent.ini:
  1. # The Quantum user information for accessing the Quantum API.
  2. auth_url = http://10.10.10.51:35357/v2.0
  3. auth_region = RegionOne
  4. admin_tenant_name = service
  5. admin_user = quantum
  6. admin_password = service_pass
  7. # IP address used by Nova metadata server
  8. nova_metadata_ip = 10.10.10.51
  9. # TCP Port used by Nova metadata server
  10. nova_metadata_port = 8775
  11. metadata_proxy_shared_secret = helloOpenStack
复制代码

更新文件 /etc/quantum/quantum.conf,确保rabbitMQ IP指向了控制节点
  1. rabbit_host = 10.10.10.51
  2. #And update the keystone_authtoken section
  3. [keystone_authtoken]
  4. auth_host = 10.10.10.51
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = quantum
  9. admin_password = service_pass
  10. signing_dir = /var/lib/quantum/keystone-signing
复制代码
编辑 /etc/sudoers.d/quantum_sudoers

  1. nano /etc/sudoers.d/quantum_sudoers
  2. #Modify the quantum user
  3. quantum ALL=NOPASSWD: ALL
复制代码
注释与说明:上面配置的作用是quantum用户执行任何命令都不需要密码

重启quantum的所有服务
  1. cd /etc/init.d/; for i in $( ls quantum-* ); do sudo service $i restart; done
复制代码

3.4. OpenVSwitch (第二部分)

编辑 eth2   /etc/network/interfaces:
  1. # VM internet Access
  2. auto eth2
  3. iface eth2 inet manual
  4. up ifconfig $IFACE 0.0.0.0 up
  5. up ip link set $IFACE promisc on
  6. down ip link set $IFACE promisc off
  7. down ifconfig $IFACE down
复制代码


建立虚拟网桥与物理网口的链接
  1. #Internet connectivity will be lost after this step but this won't affect OpenStack's work
  2. ovs-vsctl add-port br-ex eth2
  3. #If you want to get internet connection back, you can assign the eth2's IP address to the br-ex in the /etc/network/interfaces file.
复制代码

4.计算节点

4.1. 准备环境

准备节点
安装 64位 Ubuntu 12.04 or 13.04 Server, 切换sudo 模式:
  1. sudo su
复制代码

添加Grizzly库(适用于 Ubuntu 12.04):
  1. apt-get install -y ubuntu-cloud-keyring
  2. echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main >> /etc/apt/sources.list.d/grizzly.list
复制代码

更新系统:

  1. apt-get update -y
  2. apt-get upgrade -y
  3. apt-get dist-upgrade -y
复制代码

安装 ntp 服务:
  1. apt-get install -y ntp
复制代码

配置NTP保持与控制节点时间同步:
  1. #Comment the ubuntu NTP servers
  2. sed -i 's/server 0.ubuntu.pool.ntp.org/#server 0.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  3. sed -i 's/server 1.ubuntu.pool.ntp.org/#server 1.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  4. sed -i 's/server 2.ubuntu.pool.ntp.org/#server 2.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  5. sed -i 's/server 3.ubuntu.pool.ntp.org/#server 3.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  6. #Set the compute node to follow up your conroller node
  7. sed -i 's/server ntp.ubuntu.com/server 10.10.10.51/g' /etc/ntp.conf
  8. service ntp restart
复制代码

安装vlan 与网桥配置工具bridge-utils
  1. apt-get install -y vlan bridge-utils
复制代码

启动 IP_Forwarding:
  1. sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
复制代码

4.2.网络配置

  1. # OpenStack management
  2. auto eth0
  3. iface eth0 inet static
  4. address 10.10.10.53
  5. netmask 255.255.255.0
  6. # VM Configuration
  7. auto eth1
  8. iface eth1 inet static
  9. address 10.20.20.53
  10. netmask 255.255.255.0
复制代码

4.3 KVM

确保你的硬件支持虚拟化:
  1. apt-get install -y cpu-checker
  2. kvm-ok
复制代码
上面命令分别执行,当我们看到如下信息时,其实可以的。因为虽然不支持加速,但是是可以使用的。

fenbiezhixing.png


如果上面是好的,我们安装和配置KVM
  1. apt-get install -y kvm libvirt-bin pm-utils
复制代码

添加 cgroup_device_acl 数组到文 /etc/libvirt/qemu.conf:

  1. cgroup_device_acl = [
  2. "/dev/null", "/dev/full", "/dev/zero",
  3. "/dev/random", "/dev/urandom",
  4. "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
  5. "/dev/rtc", "/dev/hpet","/dev/net/tun"
  6. ]
复制代码

如下图所示

ad.png



删除virtual bridge(执行下面命令即可)
  1. virsh net-destroy default
  2. virsh net-undefine default
复制代码

更新文件 /etc/libvirt/libvirtd.conf:
  1. listen_tls = 0
  2. listen_tcp = 1
  3. auth_tcp = "none"
复制代码

注释与说明:
上面可以找到相应的注释,去掉注释即可。

list.png


这里面因为注释内容比较多,可以使用查询如下图所示:我们输入/listten_tls回车即可找到相应内容。
find.png


在文件 /etc/init/libvirt-bin.conf中添加 libvirtd_opts 变量:
  1. env libvirtd_opts="-d -l"
复制代码

注释与说明:
如下图位置所示
libbiertd.png



编辑 /etc/default/libvirt-bin 文件
  1. libvirtd_opts="-d -l"
复制代码
如下图红色箭头所示,我们只要在libvirtd_opts="-d"中添加-1即可,即为libvirtd_opts="-d -l"
libvirt-1.png



重 libvirt service与 service libvirt-bin:
  1. service dbus restart && service libvirt-bin restart
复制代码
看到如下信息:
restart.png


4.4. OpenVSwitch

安装 openVSwitch:
  1. apt-get install -y openvswitch-switch openvswitch-datapath-dkms
复制代码

创建 bridges:


  1. #br-int will be used for VM integration
  2. ovs-vsctl add-br br-int
复制代码

4.5. Quantum

安装 Quantum openvswitch 代理:
  1. apt-get -y install quantum-plugin-openvswitch-agent
复制代码
编辑 the OVS plugin配置文件 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini:
  1. #Under the database section
  2. [DATABASE]
  3. sql_connection = mysql://quantumUser:quantumPass@10.10.10.51/quantum
  4. #Under the OVS section
  5. [OVS]
  6. tenant_network_type = gre
  7. tunnel_id_ranges = 1:1000
  8. integration_bridge = br-int
  9. tunnel_bridge = br-tun
  10. local_ip = 10.20.20.53
  11. enable_tunneling = True
  12. #Firewall driver for realizing quantum security group function
  13. [SECURITYGROUP]
  14. firewall_driver = quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
复制代码
注释与说明:
注意上面的文件不能一次性全部复制到文件中,需要找到相应的标签,如下图所示为ovs的配置
ovs.png




确保你的 rabbitMQ IP  在 /etc/quantum/quantum.conf文件中配置指向控制节点:

  1. rabbit_host = 10.10.10.51
  2. #And update the keystone_authtoken section
  3. [keystone_authtoken]
  4. auth_host = 10.10.10.51
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = quantum
  9. admin_password = service_pass
  10. signing_dir = /var/lib/quantum/keystone-signing
复制代码
注释与说明:
同理上面的内容也是相应的内容放到相应的标签下面。切忌全部复制。

重启服务:
  1. service quantum-plugin-openvswitch-agent restart
复制代码



4.6. Nova

安装nova所需要组件:
  1. apt-get install -y nova-compute-kvm
复制代码

修改文件  /etc/nova/api-paste.ini   authtoken 部分   
  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = nova
  8. admin_password = service_pass
  9. signing_dirname = /tmp/keystone-signing-nova
  10. # Workaround for https://bugs.launchpad.net/nova/+bug/1154809
  11. auth_version = v2.0
复制代码

编辑文件 /etc/nova/nova-compute.conf  
  1. [DEFAULT]
  2. libvirt_type=kvm
  3. libvirt_ovs_bridge=br-int
  4. libvirt_vif_type=ethernet
  5. libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
  6. libvirt_use_virtio_for_bridges=True
复制代码

修改文件 /etc/nova/nova.conf如下:
  1. [DEFAULT]
  2. logdir=/var/log/nova
  3. state_path=/var/lib/nova
  4. lock_path=/run/lock/nova
  5. verbose=True
  6. api_paste_config=/etc/nova/api-paste.ini
  7. compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler
  8. rabbit_host=10.10.10.51
  9. nova_url=http://10.10.10.51:8774/v1.1/
  10. sql_connection=mysql://novaUser:novaPass@10.10.10.51/nova
  11. root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
  12. # Auth
  13. use_deprecated_auth=false
  14. auth_strategy=keystone
  15. # Imaging service
  16. glance_api_servers=10.10.10.51:9292
  17. image_service=nova.image.glance.GlanceImageService
  18. # Vnc configuration
  19. novnc_enabled=true
  20. novncproxy_base_url=http://192.168.100.51:6080/vnc_auto.html
  21. novncproxy_port=6080
  22. vncserver_proxyclient_address=10.10.10.53
  23. vncserver_listen=0.0.0.0
  24. # Network settings
  25. network_api_class=nova.network.quantumv2.api.API
  26. quantum_url=http://10.10.10.51:9696
  27. quantum_auth_strategy=keystone
  28. quantum_admin_tenant_name=service
  29. quantum_admin_username=quantum
  30. quantum_admin_password=service_pass
  31. quantum_admin_auth_url=http://10.10.10.51:35357/v2.0
  32. libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
  33. linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver
  34. #If you want Quantum + Nova Security groups
  35. firewall_driver=nova.virt.firewall.NoopFirewallDriver
  36. security_group_api=quantum
  37. #If you want Nova Security groups only, comment the two lines above and uncomment line -1-.
  38. #-1-firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
  39. #Metadata
  40. service_quantum_metadata_proxy = True
  41. quantum_metadata_proxy_shared_secret = helloOpenStack
  42. # Compute #
  43. compute_driver=libvirt.LibvirtDriver
  44. # Cinder #
  45. volume_api_class=nova.volume.cinder.API
  46. osapi_volume_listen_port=5900
  47. cinder_catalog_info=volume:cinder:internalURL
复制代码


注释与说明:
我们打开文件会看到如下内容:把文件内容清空,添加上面内容即可。
duibiqian.png


重启 nova所有服务:
  1. cd /etc/init.d/; for i in $( ls nova-* ); do sudo service $i restart; done
复制代码
查看是否安装成功:

  1. nova-manage service list
复制代码






欢迎加入about云群425860289432264021 ,云计算爱好者群,关注about云腾讯认证空间

已有(5)人评论

跳转到指定楼层
wangnanredhat 发表于 2015-3-29 22:47:36
做到glance报错了。。。
root@node1:~# glance image-list
Request returned failure status.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 383, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 362, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
回复

使用道具 举报

arsenduan 发表于 2015-3-29 22:49:34
wangnanredhat 发表于 2015-3-29 22:47
做到glance报错了。。。
root@node1:~# glance image-list
Request returned failure status.




试试这个命令
  1. keystone user-list
复制代码
可能环境变量的问题
回复

使用道具 举报

wangnanredhat 发表于 2015-3-30 08:46:53
arsenduan 发表于 2015-3-29 22:49
试试这个命令
可能环境变量的问题

之前没有任何问题,可以显示用户
就是到glance报错,郁闷!

回复

使用道具 举报

arsenduan 发表于 2015-3-30 08:49:06
wangnanredhat 发表于 2015-3-30 08:46
之前没有任何问题,可以显示用户
就是到glance报错,郁闷!

进入mysql检查下glance数据以及glance的相关服务是否正常

回复

使用道具 举报

wangnanredhat 发表于 2015-3-30 09:04:43
arsenduan 发表于 2015-3-30 08:49
进入mysql检查下glance数据以及glance的相关服务是否正常

ok。。我晚上回去试试。非常感谢!

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条