国基北盛云平台搭建
1、前期準備與節點規劃
- 使用搭建的操作系統是:CentOS-7-x86_64-DVD-1804.iso
- 使用搭建的鏡像是:chinaskills_cloud_iaas.iso
- 使用遠程連接的工具是:xshell
- 相關軟件包
提取碼:kkor - 搭建方式:使用兩臺先電云計算服務器進行搭建,一個作為控制節點。另一個作為計算節點。
- 節點網絡規劃
| controller | 192.168.100.10 | 192.168.200.10 |
| compute | 192.168.100.20 | 192.168.200.20 |
=注意=:IP地址根據實際組網情況進行填寫配置
2、基礎環境配置與說明
| Keystone安全認證服務 | ? |
| Glance鏡像服務 | ? |
| Nova計算控制服務 | Nova Compute計算服務 |
| Dashboard管理界面 | ? |
| Neutron Server網絡服務 | Neutron節點網絡服務 |
| Cinder存儲控制服務 | Cinder Volume存儲服務 |
| Rabbit消息服務 | ? |
| Mysql數據庫 | ? |
| Swift 代理服務 | Swift 存儲服務 |
| Heat編配服務 | ? |
| Ceilometer 監控服務 | Ceilometer監控代理 |
`說明:存儲節點安裝操作系統時需劃分兩個空白分區,作為cinder和swift存儲磁盤搭建 ftp服務器作為搭建云平臺的yum源。
controller控制節點虛擬硬件配置:
compute計算節點虛擬硬件配置:
設置對應的網卡模式和網絡地址
通常默認情況下。VMnet0為橋接模式;VMnet1為僅主機模式;VMnet8為NAT模式。
以controller節點安裝為例,compute計算節點安裝步驟與此相同。`
3、配置主機名、網絡(兩節點都要)
通過xShell遠程連接工具連接【controller】節點和【compute】節點,即控制節點和計算節點。
配置主機名【controller】
[root@controller ~]# hostnamectl set-hostname controller [root@controller ~]# bash [root@controller ~]# hostnamectl Static hostname: controllerIcon name: computer-desktopChassis: desktopMachine ID: 03ea1deb7ce84827b40dcc0cad6deba0Boot ID: 73599f8a282c461bb30037e90d8f1702Operating System: CentOS Linux 7 (Core)CPE OS Name: cpe:/o:centos:centos:7Kernel: Linux 3.10.0-862.el7.x86_64Architecture: x86-64配置網絡信息(這里只貼出控制節點了,計算節點自行修改)
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=enp8s0 DEVICE=enp8s0 ONBOOT=yes IPADDR=192.168.100.10 NETMASK=255.255.255.0 GATEWAY=192.168.100.1 DNS1=192.168.100.1[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp9s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes NAME=enp9s0 DEVICE=enp9s0 ONBOOT=yes IPADDR=192.168.200.10 NETMASK=255.255.255.0 GATEWAY=192.168.200.1 DNS1=192.168.200.1關閉控制節點的防火墻,設置開機不啟動
設置SELinux為Permissive 模式
4、上傳鏡像并配置本地YUM源
【controller】
鏡像掛載
配置【controller節點】的本地YUM源
[root@controller yum.repos.d]#mv /etc/yum.repos.d/* /opt/ [root@controller ~]# vi /etc/yum.repos.d/local.repo [root@controller ~]# cat /etc/yum.repos.d/local.repo [centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1 [iaas] name=iaas baseurl=file:///opt/openstack/iaas-repo gpgcheck=0 enabled=1配置【compute節點】的本地YUM源,使用ftp的方式獲取controller節點的YUM源
[root@compute ~]#mv /etc/yum.repos.d/* /opt/ [root@compute yum.repos.d]# vi /etc/yum.repos.d/ftp.repo [root@compute yum.repos.d]# cat /etc/yum.repos.d/ftp.repo [centos] name=centos baseurl=ftp://192.168.100.10/centos gpgcheck=0 enable=1 [iaas] name=openstack baseurl=ftp://192.168.100.10/openstack/iaas-repo gpgcheck=0 enabled=1 [root@controller ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: centos openstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos [root@controller ~]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors centos | 3.6 kB 00:00:00 openstack | 2.9 kB 00:00:00 (1/3): centos/group_gz | 166 kB 00:00:00 (2/3): openstack/primary_db | 1.4 MB 00:00:00 (3/3): centos/primary_db | 3.1 MB 00:00:00 repo id repo name status centos centos 3,971 iaas iaas 3,232 repolist: 7,203 [root@controller ~]# 123456789101112131415161718在controller節點上安裝ftp服務
[root@controller ~]# yum install -y vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed --> Finished Dependency ResolutionDependencies Resolved=======================================================================================================================================Package Arch Version Repository Size ======================================================================================================================================= Installing:vsftpd x86_64 3.0.2-22.el7 centos 169 kTransaction Summary ======================================================================================================================================= Install 1 PackageTotal download size: 169 k Installed size: 348 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transactionInstalling : vsftpd-3.0.2-22.el7.x86_64 1/1 Verifying : vsftpd-3.0.2-22.el7.x86_64 1/1 Installed:vsftpd.x86_64 0:3.0.2-22.el7 Complete! [root@controller ~]# vi /etc/vsftpd/vsftpd.conf [root@controller ~]# systemctl start vsftpd;systemctl enable vsftpd【compute】
[root@compute ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: centos openstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors [root@compute ~]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors centos | 3.6 kB 00:00:00 openstack | 2.9 kB 00:00:00 (1/3): centos/group_gz | 166 kB 00:00:00 (2/3): openstack/primary_db | 1.4 MB 00:00:00 (3/3): centos/primary_db | 3.1 MB 00:00:00 repo id repo name status centos centos 3,971 iaas iaas 3,232 repolist: 7,2035、在【compute】節點上進行空白分區的劃分
[root@compute ~]# parted /dev/sdb (parted) mkpart swift 0G 107.4G //創建swift分區 (parted) mkpart cinder 107.4G 214.8G //創建cinder分區 [root@compute ~]# mkfs.xfs /dev/sdb1[root@compute ~]# mkfs.xfs /dev/sdb26、編輯環境變量
[root@compute ~]# yum install -y iaas-xiandian Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package iaas-xiandian.x86_64 0:2.4-2 will be installed --> Finished Dependency ResolutionDependencies Resolved=======================================================================================================================================Package Arch Version Repository Size ======================================================================================================================================= Installing:iaas-xiandian x86_64 2.4-2 openstack 19 kTransaction Summary ======================================================================================================================================= Install 1 PackageTotal download size: 19 k Installed size: 81 k Downloading packages: iaas-xiandian-2.4-2.x86_64.rpm | 19 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transactionInstalling : iaas-xiandian-2.4-2.x86_64 1/1 Verifying : iaas-xiandian-2.4-2.x86_64 1/1 Installed:iaas-xiandian.x86_64 0:2.4-2 Complete!【controller】openrc.sh配置文件如下
一鍵去注釋 ctrl+v選中所有行,按d
給pass加000000?
:%s/PASS=/PASS=000000/g [root@controller ~]# vi /etc/xiandian/openrc.sh [root@controller ~]# cat /etc/xiandian/openrc.sh #--------------------system Config--------------------## #Controller Server Manager IP. example:x.x.x.x HOST_IP=192.168.100.10#Controller HOST Password. example:000000 HOST_PASS=000000#Controller Server hostname. example:controller HOST_NAME=controller#Compute Node Manager IP. example:x.x.x.x HOST_IP_NODE=192.168.100.20#Compute HOST Password. example:000000 HOST_PASS_NODE=000000#Compute Node hostname. example:compute HOST_NAME_NODE=compute#--------------------Chrony Config-------------------## #Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24) network_segment_IP=192.168.100.0/24#--------------------Rabbit Config ------------------## #user for rabbit. example:openstack RABBIT_USER=openstack#Password for rabbit user .example:000000 RABBIT_PASS=000000#--------------------MySQL Config---------------------## #Password for MySQL root user . exmaple:000000 DB_PASS=000000#--------------------Keystone Config------------------## #Password for Keystore admin user. exmaple:000000 DOMAIN_NAME=demo ADMIN_PASS=000000 DEMO_PASS=000000#Password for Mysql keystore user. exmaple:000000 KEYSTONE_DBPASS=000000#--------------------Glance Config--------------------## #Password for Mysql glance user. exmaple:000000 GLANCE_DBPASS=000000#Password for Keystore glance user. exmaple:000000 GLANCE_PASS=000000#--------------------Nova Config----------------------## #Password for Mysql nova user. exmaple:000000 NOVA_DBPASS=000000#Password for Keystore nova user. exmaple:000000 NOVA_PASS=000000#--------------------Neturon Config-------------------## #Password for Mysql neutron user. exmaple:000000 NEUTRON_DBPASS=000000#Password for Keystore neutron user. exmaple:000000 NEUTRON_PASS=000000#metadata secret for neutron. exmaple:000000 METADATA_SECRET=000000#Tunnel Network Interface. example:x.x.x.x INTERFACE_IP=192.168.100.10#External Network Interface. example:eth1 INTERFACE_NAME=enp9s0#External Network The Physical Adapter. example:provider Physical_NAME=provider#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101 minvlan=101#Last Vlan ID in VLAN RANGE for VLAN Network. example:200 maxvlan=200#--------------------Cinder Config--------------------## #Password for Mysql cinder user. exmaple:000000 CINDER_DBPASS=000000#Password for Keystore cinder user. exmaple:000000 CINDER_PASS=000000#Cinder Block Disk. example:md126p3 BLOCK_DISK=sda4p1#--------------------Swift Config---------------------## #Password for Keystore swift user. exmaple:000000 SWIFT_PASS=000000#The NODE Object Disk for Swift. example:md126p4. OBJECT_DISK=sda4p2#The NODE IP for Swift Storage Network. example:x.x.x.x. STORAGE_LOCAL_NET_IP=192.168.100.20#--------------------Heat Config----------------------## #Password for Mysql heat user. exmaple:000000 HEAT_DBPASS=000000#Password for Keystore heat user. exmaple:000000 HEAT_PASS=000000#--------------------Zun Config-----------------------## #Password for Mysql Zun user. exmaple:000000 ZUN_DBPASS=000000#Password for Keystore Zun user. exmaple:000000 ZUN_PASS=000000#Password for Mysql Kuryr user. exmaple:000000 KURYR_DBPASS=000000#Password for Keystore Kuryr user. exmaple:000000 KURYR_PASS=000000#--------------------Ceilometer Config----------------## #Password for Gnocchi ceilometer user. exmaple:000000 CEILOMETER_DBPASS=000000#Password for Keystore ceilometer user. exmaple:000000 CEILOMETER_PASS=000000#--------------------AODH Config----------------## #Password for Mysql AODH user. exmaple:000000 AODH_DBPASS=000000#Password for Keystore AODH user. exmaple:000000 AODH_PASS=000000#--------------------Barbican Config----------------## #Password for Mysql Barbican user. exmaple:000000 BARBICAN_DBPASS=000000#Password for Keystore Barbican user. exmaple:000000 BARBICAN_PASS=000000 [root@controller ~]# scp /etc/xiandian/openrc.sh 192.168.100.20:/etc/xiandian/openrc.sh The authenticity of host '192.168.100.20 (192.168.100.20)' can't be established. ECDSA key fingerprint is SHA256:Gwi9FGsddkAOsnxzxoJKmgLRFE+ZHKV8HhOfsupYapA. ECDSA key fingerprint is MD5:e6:e9:42:34:5f:b9:57:7c:7c:db:02:60:3b:14:f3:ac. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.100.20' (ECDSA) to the list of known hosts. root@192.168.100.20's password: openrc.sh 100% 3812 1.5MB/s 00:00【compute】
將從控制節點傳輸過來的openrc.sh配置文件進行修改,修改內容如下。
7、執行相關腳本安裝各個組件服務
(1)通過腳本安裝服務
【controller】
[root@controller ~]# iaas-pre-host.sh
[root@controller ~]# reboot
【compute】
[root@compute ~]# iaas-pre-host.sh
[root@compute ~]# reboot
(2)通過腳本安裝數據庫服務
【controller】
[root@controller ~]# iaas-install-mysql.sh
(3)通過腳本安裝keystone服務
【controller】
[root@controller ~]# iaas-install-keystone.sh
(4)通過腳本安裝glance服務
【controller】
[root@controller ~]# iaas-install-glance.sh
上傳鏡像并使用命令查詢是否上傳成功
[root@controller ~]# cd /opt/openstack/images/ [root@controller images]# ll total 1539152 -rw-r--r--. 1 root root 283181056 Nov 3 11:39 CentOS_6.5_x86_64_XD.qcow2 -rw-r--r--. 1 root root 381696512 Nov 3 11:39 CentOS7_1804.tar -rw-r--r--. 1 root root 400752640 Nov 3 11:39 CentOS_7.2_x86_64_XD.qcow2 -rw-r--r--. 1 root root 510459904 Nov 3 11:39 CentOS_7.5_x86_64_XD.qcow2 [root@controller images]# source /etc/keystone/admin-openrc.sh [root@controller images]# glance image-create --name "centos7.5" --disk-format qcow2 --container-format bare --progress < CentOS_7.5_x86_64_XD.qcow2 [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 3d3e9c954351a4b6953fd156f0c29f5c | | container_format | bare | | created_at | 2020-11-03T06:20:20Z | | disk_format | qcow2 | | id | d0122867-8ac2-444b-9c9f-556ede05e9f4 | | min_disk | 0 | | min_ram | 0 | | name | centos7.5 | | owner | 25e184cdfaf44d29b11d9b435293253f | | protected | False | | size | 510459904 | | status | active | | tags | [] | | updated_at | 2020-11-03T06:20:23Z | | virtual_size | None | | visibility | shared | +------------------+--------------------------------------+ [root@controller images]# glance image-create --name "centos7.2" --disk-format qcow2 --container-format bare --progress < CentOS_7.2_x86_64_XD.qcow2 [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | ea197f4c679b8e1ce34c0aa70ae2a94a | | container_format | bare | | created_at | 2020-11-03T06:20:40Z | | disk_format | qcow2 | | id | 428e4940-fc03-484f-96e2-4b8d5310e372 | | min_disk | 0 | | min_ram | 0 | | name | centos7.2 | | owner | 25e184cdfaf44d29b11d9b435293253f | | protected | False | | size | 400752640 | | status | active | | tags | [] | | updated_at | 2020-11-03T06:20:42Z | | virtual_size | None | | visibility | shared | +------------------+--------------------------------------+ [root@controller images]# glance image-create --name "centos6.5" --disk-format qcow2 --container-format bare --progress < CentOS_6.5_x86_64_XD.qcow2 [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 3e565ace16066679ea363dde5411ed25 | | container_format | bare | | created_at | 2020-11-03T06:20:58Z | | disk_format | qcow2 | | id | 6a3333a2-0125-4654-bbb3-d9004ace3788 | | min_disk | 0 | | min_ram | 0 | | name | centos6.5 | | owner | 25e184cdfaf44d29b11d9b435293253f | | protected | False | | size | 283181056 | | status | active | | tags | [] | | updated_at | 2020-11-03T06:21:44Z | | virtual_size | None | | visibility | shared | +------------------+--------------------------------------+ [root@controller images]# glance image-list +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | 6a3333a2-0125-4654-bbb3-d9004ace3788 | centos6.5 | | 428e4940-fc03-484f-96e2-4b8d5310e372 | centos7.2 | | d0122867-8ac2-444b-9c9f-556ede05e9f4 | centos7.5 | +--------------------------------------+-----------+ [root@controller images]# openstack image list +--------------------------------------+-----------+--------+ | ID | Name | Status | +--------------------------------------+-----------+--------+ | 6a3333a2-0125-4654-bbb3-d9004ace3788 | centos6.5 | active | | 428e4940-fc03-484f-96e2-4b8d5310e372 | centos7.2 | active | | d0122867-8ac2-444b-9c9f-556ede05e9f4 | centos7.5 | active | +--------------------------------------+-----------+--------+(5)通過腳本安裝nova服務
【controller】
[root@controller ~]# iaas-install-nova-controller.sh
【compute】
[root@compute ~]# iaas-install-nova-compute.sh
(6)通過腳本安裝neutron服務
【controller】
[root@controller ~]# iaas-install-neutron-controller.sh
【compute】
[root@compute ~]# iaas-install-neutron-compute.sh
注意:使用真實服務器搭建的話,網絡模式選擇vlan模式;使用虛擬機搭建的話,網絡模式選擇flat模式。
(7)通過腳本安裝dashboard服務
【controller】
[root@controller ~]# iaas-install-dashboard.sh
(8)通過腳本安裝Cinder服務
【controler】
[root@controller ~]# iaas-install-cinder-controller.sh
【compute】
[root@compute ~]# iaas-install-cinder-compute.sh
(9)通過腳本安裝Swift服務
【controller】
[root@controller ~]# iaas-install-swift-controller.sh
【compute】
[root@compute ~]# iaas-install-swift-compute.sh
(10)通過腳本安裝heat服務
【controller】
[root@controller ~]# iaas-install-heat.sh
(11)通過腳本安裝Zun服務
【controller】
[root@controller ~]# iaas-install-zun-controller.sh
【compute】
[root@compute ~]# iaas-install-zun-compute.sh
(12)通過腳本安裝Ceilometer服務
【controller】
[root@controller ~]# iaas-install-ceilometer-controller.sh
【compute】
[root@compute~]# iaas-install-ceilometer-compute.sh
(13)通過腳本安裝Aodh服務
【controller】
[root@controller ~]# iaas-install-aodh.sh
8、添加控制節點資源到云平臺
【controller】修改openrc.sh
把compute節點的IP地址和主機名改為controller節點的IP和主機名
在控制節點運行iaas-install-nova-compute.sh
執行過程中需要確認登錄controller節點和輸入controller節點root用戶密碼。
修改openrc.sh配置文件
#Compute Node Manager IP. example:x.x.x.x HOST_IP_NODE=192.168.100.10#Compute Node hostname. example:compute HOST_NAME_NODE=controller [root@controller ~]# iaas-install-nova-compute.sh(只敲這行) Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service. Pseudo-terminal will not be allocated because stdin is not a terminal. The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established. ECDSA key fingerprint is SHA256:rX1rbCElY3mREAkrNRYC+yob0sFY+VyQAoUxPHPZucs. ECDSA key fingerprint is MD5:18:11:82:84:98:8b:fd:3d:58:df:18:82:f7:a5:2e:50. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts. root@192.168.1.10's password: (這里輸入密碼) +----+--------------+------------+------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+------------+------+---------+-------+----------------------------+ | 10 | nova-compute | compute | nova | enabled | up | 2020-11-03T07:34:09.000000 | | 11 | nova-compute | controller | nova | enabled | up | 2020-11-03T07:34:09.000000 | +----+--------------+------------+------+---------+-------+----------------------------+ Found 2 cell mappings. Skipping cell0 since it does not contain hosts. Getting computes from cell 'cell1': b7e5c36e-d44d-4886-b756-7f37fe2bff2d Checking host mapping for compute host 'controller': a35af4bb-d210-4e8e-a2eb-1ed65fd439d9 Creating host mapping for compute host 'controller': a35af4bb-d210-4e8e-a2eb-1ed65fd439d9 Found 1 unmapped computes in cell: b7e5c36e-d44d-4886-b756-7f37fe2bff2d9、登錄web界面
輸入http://192.168.100.10/dasboard
至此,IaaS搭建完成。
總結
- 上一篇: SPSS处理多自变量多因变量分析以及描述
- 下一篇: 智慧城市的下一站-空间驱动智慧场景