環境:node
manager:192.168.122.10 4核8G LVM100G硬盤python
nova1: 192.168.122.20 4核4G LVM100G硬盤linux
nova2: 192.168.122.21 4核4G LVM100G硬盤shell
虛擬公有IP池範圍:192.168.122.50-192.168.122.150apache
本次採用kvm虛擬機部署,網絡使用virio,這樣網絡效率會快不少。本博yum倉庫是本身搭建在本地的ftp上的,時間服務器也是同步本機,本機同步阿里雲服務器的,後端鏡像也是本身作的對內核部分和軟件部分進行了優化,製做後端盤重點XML文件中網卡一欄中Interface中千萬不要保留mac address,常識問題我竟然仍是踩坑了。json
首先我使用的個人後端盤進行復用作得這幾個系統,以前系統盤是20G,因此首先是對個人磁盤進行擴容。ubuntu
擴容思路:vim
熱擴容鏡像大小限制(虛擬實例正在運行,爲了避免關機選擇熱擴容)。後端
刷新分區大小。centos
擴容lvm 卷組大小。
擴容lv 邏輯卷大小。
刷新文件系統大小。
開始熱擴容鏡像大小。
lqh@lqh-desktop:~$ virsh blockresize --path /var/lib/libvirt/images/os-manager.qcow2 --size 100G os-manager Block device '/var/lib/libvirt/images/os-nova1.qcow2' is resized
lqh@lqh-desktop:/$ virsh list --all Id Name State ---------------------------------------------------- 4 os-manager running 5 os-nova1 running 6 os-nova2 running lqh@lqh-desktop:/$ virsh console 5 Connected to domain os-nova1 Escape character is ^] Welcome to vitualhost centos7 centos7 login: root Password: Last login: Sat Nov 9 21:32:14 on ttyS0 [root@centos7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom vda 252:0 0 100G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 19G 0 part └─centos_centos7-root 253:0 0 19G 0 lvm / [root@centos7 ~]# growpart /dev/vda 2 CHANGED: partition=2 start=2099200 old: size=39843840 end=41943040 new: size=207615967 end=209715167 [root@centos7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom vda 252:0 0 100G 0 disk ├─vda1 252:1 0 1G 0 part /boot └─vda2 252:2 0 99G 0 part └─centos_centos7-root 253:0 0 19G 0 lvm /
[root@centos7 ~]# vgs VG #PV #LV #SN Attr VSize VFree centos_centos7 1 1 0 wz--n- <19.00g 0 [root@centos7 ~]# pvresize /dev/vda2 Physical volume "/dev/vda2" changed 1 physical volume(s) resized / 0 physical volume(s) not resized [root@centos7 ~]# vgs VG #PV #LV #SN Attr VSize VFree centos_centos7 1 1 0 wz--n- <99.00g 80.00g
[root@centos7 ~]# lvextend -L +79.9G /dev/centos_centos7/root Rounding size to boundary between physical extents: 79.90 GiB. Size of logical volume centos_centos7/root changed from <19.00 GiB (4863 extents) to <98.90 GiB (25318 extents). Logical volume centos_centos7/root successfully resized. [root@centos7 ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root centos_centos7 -wi-ao---- <98.90g
[root@centos7 ~]# xfs_growfs / meta-data=/dev/mapper/centos_centos7-root isize=512 agcount=4, agsize=1244928 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=4979712, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 4979712 to 25925632 [root@centos7 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos_centos7-root 99G 1.1G 98G 2% / devtmpfs 2.1G 0 2.1G 0% /dev tmpfs 2.2G 0 2.2G 0% /dev/shm tmpfs 2.2G 8.5M 2.1G 1% /run tmpfs 2.2G 0 2.2G 0% /sys/fs/cgroup /dev/vda1 1014M 130M 885M 13% /boot tmpfs 278M 0 278M 0% /run/user/0
[root@centos7 ~]# hostnamectl set-hostname os-manager [root@centos7 ~]# hostnamectl set-hostname os-nova1 [root@centos7 ~]# hostnamectl set-hostname os-nova2
[root@centos7 ~]# vim /etc/hosts 192.168.122.10 os-manager 192.168.122.20 os-nova1 192.168.122.21 os-nova2 [root@centos7 ~]# scp /etc/hosts root@os-nova1:/etc/ [root@centos7 ~]# scp /etc/hosts root@os-nova2:/etc/
[root@os-manager ~]# sed -i '/^search*/ d' /etc/resolv.conf
[root@os-manager ~]# chronyc sources -v 210 Number of sources = 1 .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* gateway 3 6 377 6 -568us[ -819us] +/- 2943us
lqh@lqh-desktop:~$ df -h 文件系統 容量 已用 可用 已用% 掛載點 udev 7.8G 0 7.8G 0% /dev tmpfs 1.6G 5.8M 1.6G 1% /run /dev/sda5 492G 29G 438G 7% / tmpfs 7.8G 285M 7.6G 4% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sdb1 98M 33M 66M 33% /boot/efi tmpfs 1.6G 60K 1.6G 1% /run/user/1000 tmpfs 1.6G 0 1.6G 0% /run/user/0 /dev/loop0 8.8G 8.8G 0 100% /srv/ftp/CentOS7-1804 /dev/loop1 169M 169M 0 100% /srv/ftp/extras /dev/loop2 3.0G 3.0G 0 100% /srv/ftp/openstack [root@os-manager ~]# vim /etc/yum.repos.d/local.repo [local] name=local baseurl=ftp://192.168.122.1/CentOS7-1804/ enable=1 gpgcheck=0 [local_extras] name=local_extras baseurl=ftp://192.168.122.1/extras/ enable=1 gpgcheck=0 [local_openstatck_rpms] name=local_ops_rpms baseurl=ftp://192.168.122.1/openstack/rhel-7-server-openstack-10-rpms/ enable=1 gpgcheck=0 [local_openstack_dev] name=local_ops_dev baseurl=ftp://192.168.122.1/openstack/rhel-7-server-openstack-10-devtools-rpms/ enable=1 gpgcheck=0 [root@os-manager ~]# yum repolist 已加載插件:fastestmirror Loading mirror speeds from cached hostfile local | 3.6 kB 00:00 local_extras | 2.9 kB 00:00 local_openstack_dev | 2.9 kB 00:00 local_openstatck_rpms | 2.9 kB 00:00 (1/2): local_openstack_dev/primary_db | 3.7 kB 00:00 (2/2): local_openstatck_rpms/primary_db | 318 kB 00:00 源標識 源名稱 狀態 local local 9,911 local_extras local_extras 76 local_openstack_dev local_ops_dev 3 local_openstatck_rpms local_ops_rpms 680 repolist: 10,670 [root@os-manager ~]# scp /etc/yum.repos.d/local.repo root@192.168.122.20:/etc/yum.repos.d/ [root@os-manager ~]# scp /etc/yum.repos.d/local.repo root@192.168.122.21:/etc/yum.repos.d/
[root@os-manager ~]# yum install -y python-setuptools [root@os-nova1 ~]# yum install -y qemu-kvm libvirt-client libvirt-daemon libvirt-daemon-driver-qemu python-setuptools [root@os-nova2 ~]# yum install -y qemu-kvm libvirt-client libvirt-daemon libvirt-daemon-driver-qemu python-setuptools
[root@os-manager ~]# yum install -y openstack-packstack Error: Package: libselinux-ruby-2.5-12.el7.x86_64 (local) Requires: libselinux(x86-64) = 2.5-12.el7 Installed: libselinux-2.5-14.1.el7.x86_64 (@base) libselinux(x86-64) = 2.5-14.1.el7 Available: libselinux-2.5-12.el7.x86_64 (local) libselinux(x86-64) = 2.5-12.el7 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest #由於我這邊包被安裝了版本較高的libselinux-2.5-14.1.el7.x86_64可是依賴包必需要是 libselinux(x86-64) = 2.5-12.el7,因此須要對安裝包進行降級處理,我在ftp上找到須要的包,而後scp到/tmp目錄下,對其進行降級安裝操做。 root@lqh-desktop:/srv/ftp# scp CentOS7-1804/Packages/libselinux-2.5-12.el7.x86_64.rpm root@192.168.122.10:/tmp [root@centos7 tmp]# yum downgrade libselinux-2.5-12.el7.x86_64.rpm setools-libs libselinux-python libselinux-utils libsemanage policycoreutils ........................................... #這裏看你本身有多少依賴存在問題,你就須要本身看着辦我處理依賴問題是花了幾分鐘的。
[root@os-manager ~]# packstack --gen-answer-file=answer.ini Packstack changed given value to required value /root/.ssh/id_rsa.pub
[root@os-manager ~]# vim answer.ini 42 CONFIG_SWIFT_INSTALL=n #關閉計費相關模塊 45 CONFIG_CEILOMETER_INSTALL=n #關閉計費相關模塊 49 CONFIG_AODH_INSTALL=n #關閉計費相關模塊 53 CONFIG_GNOCCHI_INSTALL=n #關閉計費相關模塊 75 CONFIG_NTP_SERVERS=192.168.122.1 #時間服務器地址 98 CONFIG_COMPUTE_HOSTS=192.168.122.20,192.168.122.21 #計算節點地址 102 CONFIG_NETWORK_HOSTS=192.168.122.10192.168.122.20,192.168.122.21 #加入網絡管理地址 333 CONFIG_KEYSTONE_ADMIN_PW=lqh #管理員密碼 840 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=flat,vxlan #驅動類型 910 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex #物理網橋的名稱 921 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0 #br-ex橋的名稱與eth0鏈接,管理eth0,網橋與哪一個物理網卡鏈接 1179 CONFIG_PROVISION_DEMO=n #是否安裝DEMO測試
[root@os-manager ~]# packstack --answer-file=answer.ini #輸入每臺服務器的root密碼,若是報錯請根據提示進行拍錯。 --> Finished Dependency Resolution You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest stderr: Warning: Permanently added '192.168.122.20' (ECDSA) to the list of known hosts. + trap t ERR + yum install -y puppet hiera openssh-clients tar nc rubygem-json Error: Package: libselinux-ruby-2.5-12.el7.x86_64 (local) Requires: libselinux(x86-64) = 2.5-12.el7 Installed: libselinux-2.5-14.1.el7.x86_64 (@base) libselinux(x86-64) = 2.5-14.1.el7 Available: libselinux-2.5-12.el7.x86_64 (local) libselinux(x86-64) = 2.5-12.el7 ++ t ++ exit 1 Please check log file /var/tmp/packstack/20191110-144950-Wacbht/openstack-setup.log for more information #報錯了如今進行解決,上面錯的描述的是20服務器在安裝libselinux-ruby-2.5-12.el7.x86_64的時候,由於安裝了太高的libselinux致使了沒法進行安裝,如今先將libselinux-2.5-12.el7.x86_64.rpm scp到每臺計算節點的tmp目錄下去,而後對每一臺計算節點其進行降級處理。 [root@os-nova1 tmp]# yum downgrade libselinux-2.5-12.el7.x86_64.rpm libselinux-utils libselinux-python libsemanage setools-libs policycoreutils policycoreutils-python libsemanage-python policycoreutils-python [root@os-nova2 tmp]# yum downgrade libselinux-2.5-12.el7.x86_64.rpm libselinux-utils libselinux-python libsemanage setools-libs policycoreutils policycoreutils-python libsemanage-python policycoreutils-python #接下來回到管理節點上去使用應答文件對其進行安裝,接下來就是漫長的等待時間。 [root@os-manager ~]# packstack --answer-file=answer.ini ERROR : Error appeared during Puppet run: 192.168.122.10_controller.pp Error: Could not set 'present' on ensure: Cannot allocate memory - fork(2) #個人主節點報錯了,看看什麼緣由,原來是內存不足看看個人配置文件。 lqh@lqh-desktop:~$ virsh edit os-manager <domain type='kvm'> <name>os-manager</name> <uuid>ac382c26-5c1c-4f4f-a401-24998a8f177a</uuid> <memory unit='KiB'>1572864</memory> <currentMemory unit='KiB'>1572864</currentMemory> <vcpu placement='static'>4</vcpu> <os> #原來是內存只分配了1.5G給它,如今修改配置將其設置爲8G。 <domain type='kvm'> <name>os-manager</name> <uuid>ac382c26-5c1c-4f4f-a401-24998a8f177a</uuid> <memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <vcpu placement='static'>4</vcpu> <os> #修改內存後須要重啓纔可以生效如今對其重啓 [root@os-manager ~]# free -m total used free shared buff/cache available Mem: 7982 372 7345 8 265 7345 Swap: 0 0 0 #繼續 [root@os-manager ~]# packstack --answer-file=answer.ini **** Installation completed successfully ****** Additional information: * File /root/keystonerc_admin has been created on OpenStack client host 192.168.122.10. To use the command line tools you need to source the file. * To access the OpenStack Dashboard browse to http://192.168.122.10/dashboard . Please, find your login credentials stored in the keystonerc_admin in your home directory. * The installation log file is available at: /var/tmp/packstack/20191110-154532-HEiZGv/openstack-setup.log * The generated manifests are available at: /var/tmp/packstack/20191110-154532-HEiZGv/manifests
[root@os-manager ~]# sed -i '35a WSGIApplicationGroup %{GLOBAL}' /etc/httpd/conf.d/15-horizon_vhost.conf
[root@os-manager ~]# apachectl graceful