Openstack計算-存儲-控制分離與計算節點的在線添加node
實驗環境:red hat linux 6.5mysql
Host: 192.168.122.19 server19.example.comlinux
Compute node 1:192.168.122.3 server3.example.comweb
Compute node 2 : 192.168.122.4 server4.example.comsql
Storage node : 192.168.122.5 server5.example.com數據庫
要求:iptable -Fswift
架構解釋:vim
計算節點:即虛擬機最終跑的節點,主要進程:openstcak-nova-compute安全
這個節點資源消耗主要是cpu和內存。因此能夠在實際部署的時候調大點網絡
存儲節點:這裏我單指塊存儲方案(cinder),主要進程:openstack-cinder-volume
這裏是未來雲主機啓動後,雲主機所添加的額外的磁盤的資源池(就是虛 擬機添加多大的磁盤消耗的都是這個)。openstack採用了lvm的磁盤管理 方式。雲主機只認名爲cinder-volumes的vg卷【即只在這個名字的卷下劃分 存儲空間給雲主機】,若是你Host安裝的時候沒有分這個卷,它默認會從 根磁盤上削減一部分出來,而後建立這個卷。
控制節點:有不少控制進程都在這裏個節點上。這裏主要想強調,網絡即neutron部分。
計算節點上的雲主機的數據包都會被轉發到neutron-server所啓動的節點上。
Neutron-sevrer通常會啓動在網絡控制節點。因此網絡控制節點必須使用be- ex的橋接接口,所採用的網絡結構必須是vlan。【local網絡只在你玩all in one的時候生效】火牆策略在創建後會自動幫你重寫。
1.配置好兩臺機子的yum源[目錄地址由你本身實際放的位置設定]:【All】
#vim /etc/yum.repo.d/openstack.repo
...
[openstack]
name=openstack
baseurl=ftp://192.168.122.1/pub/openstack/openstack
gpgcheck=0
…
2.更新機子的iproute:【All】
#yum update -y
注:若是缺乏這一步,可能你機子上有關路由的進程起不來。如:neutron-l3-agent這個nuetron的網絡進程。neutron-l3-agent是主要創建在三層網絡上的,主要完成對數據包的轉發【DNAT和SNAT】。因此它對路由軟件有要求。
讓內核從新加載
#reboot
3.安裝pakcstack【Host】
#yum install openstack-packstack -y
4.虛擬機添加網卡並設定網絡 【All】
#cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
#vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
重啓網卡
#service network restart
5..生成定製文件和修改定製文件 【Host】
#packstack –gen-answer-file=/root/answer.txt
#vim /root/answer.txt
…
#確認安裝swift對象存儲
CONFIG_SWIFT_INSTALL=y
...
#設置ntp時間同步【這一步很重要,若是時間不一樣步兩邊的信息確定不對稱】
CONFIG_NTP_SERVERS=192.168.122.1
...
#指定計算節點
CONFIG_NOVA_COMPUTE_HOSTS=192.168.122.3
…
#由於控制節點與外端有鏈接,數據庫放上面不安全,因此我放到了存儲節點
CONFIG_MYSQL_HOST=192.168.122.5
…
#設定mysql用戶密碼
CONFIG_MYSQL_PW=redhat
#肯定admin用戶的密碼
CONFIG_KEYSTONE_ADMIN_PW=redhat
…
#配置網絡
CONFIG_NEUTRON_OVS_TENANT_NETWORK_TYPE=vlan
CONFIG_NEUTRON_OVS_VLAN_RANGES=physnet1:1:4094
CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-eth1
CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-eth1:eth1
6.計算節點設定時間同步:【Compute node 1 , Compute node 2 and Storage Node】
#yum install -y ntp
#vim /etc/ntp.conf
…
restrict 192.168.122.1
server 192.168.122.1 iburst
#/etc/init.d/ntpd start
7.存儲節點配置iscsi磁盤共享:【Storage Node】
#yum install -y scsi-target-utils-1.0.24-10.el6.x86_64
添加一塊磁盤
#fdisk -cu /dev/vda #分處一塊vda1
#pvcreate /dev/vda1
#vgcreate vg1 /dev/vda1
#lvcreate -L 20G /dev/vg1 -n lv1
#mkfs.ext4 /dev/vg1/lv1
以後寫策略文件:
#vim /etc/tgt/targets.conf
...
<target iqn.2014-08.com.example:server.target1>
#the disk you want to share
backing-store /dev/vg1/lv1
#the ip who allow to connet with you
initiator-address 192.168.122.19
</target>
…
#tgt-adm -s#查看共享信息
8.Host註冊和使用iscsi磁盤 【Host】
安裝iscsi工具
#yum install -y iscsi-initiator-utils-6.2.0.873-10.el6.x86_64
#iscsiadm -m discovery -s st -p 192.168.122.5
#iscsiadm -m node -l -p 192.168.122.5
#fdisk -l#查看是否成功獲取磁盤【看大小,個人是vda】
#fdisk -cu /dev/vda #創建一個vda1
#pvcreate /dev/vda1
#vgcreate cinder-volumes /dev/vda1 #vg名字不能變
9.安裝openstack :【Host】
#packstack --answer-file=/root/answer.txt
【輸入密碼後就正確安裝】
10.安裝完成後現象:
【Host】
#nova-manage service list 2> /dev/null
Binary Host Zone Status State Updated_At
nova-consoleauth server19.example.com internal enabled :-) 2014-08-14 15:23:50
nova-scheduler server19.example.com internal enabled :-) 2014-08-14 15:23:55
nova-conductor server19.example.com internal enabled :-) 2014-08-14 15:23:51
nova-cert server19.example.com internal enabled :-) 2014-08-14 15:23:51
nova-compute server3.example.com nova enabled :-) 2014-08-14 15:23:13
【Compute Node】
#nova-manage service list 2> /dev/null
Binary Host Zone Status State Updated_At
nova-consoleauth server19.example.com internal enabled :-) 2014-08-14 15:23:50
nova-scheduler server19.example.com internal enabled :-) 2014-08-14 15:23:55
nova-conductor server19.example.com internal enabled :-) 2014-08-14 15:23:51
nova-cert server19.example.com internal enabled :-) 2014-08-14 15:23:51
nova-compute server3.example.com nova enabled :-) 2014-08-14 15:23:13
11.嘗試用Firefox登陸web管理界面:
成功啓動雲主機並能夠遠程登陸--成功
12.在線添加Compute Node 2: 【Compute Node 2】
#yum install -y openstcak-nova-compute
#cp /etc/nova/nova.conf /etc/nova/nova.conf.orig
#scp 192.168.122.3:/etc/nova/nova.conf /etc/nova/
#vim /etc/nova/nova.conf
…
vncserver_listen=192.168.122.4
…
vncserver_proxyclient_address=192.168.122.4
…
sql_connection=mysql://nova:redhat@192.168.122.5/nova
#/etc/init.d/openstack-nova-compute start
#nova-manage service list 2> /dev/null
Binary Host Zone Status State Updated_At
nova-consoleauth server19.example.com internal enabled :-) 2014-08-14 15:23:50
nova-scheduler server19.example.com internal enabled :-) 2014-08-14 15:23:55
nova-conductor server19.example.com internal enabled :-) 2014-08-14 15:23:51
nova-cert server19.example.com internal enabled :-) 2014-08-14 15:23:51
nova-compute server3.example.com nova enabled :-) 2014-08-14 15:23:13
nova-compute server4.example.com nova enabled :-) 2014-08-14 15:23:13
13.配置Compute Node2 的網絡結構:【Compute Node2】
確保你的機子已經有eth1的網絡接口
安裝neutron-openvswitch
#yum install -y openstack-neutron-openvswitch
作備份
#cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.orig
#cp /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini.orig
直接拷貝過來
#scp 192.168.122.3:/etc/neutron/neutron.conf /etc/neutron/neutron.conf
#scp 192.168.122.3:/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
啓動
#/etc/init.d/openvswitch start
#chkconfig openvswitch on
添加網絡接口
#ovs-vsctl add-br br-int
#ovs-vsctl add-br br-eth1
#ovs-vsctl add-port br-eth1 eth1
#service neutron-openvswitch-agent start
#chkconfig neutron-openvswitch-agent on
#chkconfig neutron-ovs-cleanup on
14.測試Compute Node2
首先關閉原來的Compute Node1
#nova-mange service disable --host server3.example.com --service nova-manage
以後web啓動另外一個雲主機,正常啓動後
#virsh list
應該能夠看見一臺虛擬機正在運行,若是能遠程登陸--成功