金砖基础环境配置
openstack基础环境配置(vmware环境下)
IP规划:
主机 | 网卡 | IP | 说明 |
---|
controller | eth0 | 192.168.100.10 | 模拟外网网卡 | | eth1 | 192.168.200.10 | | compute | eth0 | 192.168.100.20 | 模拟外网网卡 | | eth1 | 192.168.200.20 | |
修改主机名:
hostnamectl set-hostname controller
网络配置:
controller IP
compute IP:
添加地址映射:
vi /ets/hosts #追加
192.168.100.10 controller
192.168.100.20 compute
关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
关闭selinux:
setenforce 0 #(临时关闭)
(永久关闭)
head -7 /etc/selinux/config | tail -1 | cut -d '=' -f 2
ssh互信:
ssh-keygen
ssh-copy-id root@compute
磁盘分区:
lsblk
[root@compute bin]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x7a3f3b53 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
分区号 (1-4,默认 1):
起始 扇区 (2048-209715199,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-209715199,默认为 209715199):+50G
分区 1 已设置为 Linux 类型,大小设为 50 GiB
命令(输入 m 获取帮助):n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
分区号 (2-4,默认 2):
起始 扇区 (104859648-209715199,默认为 104859648):
将使用默认值 104859648
Last 扇区, +扇区 or +size{K,M,G} (104859648-209715199,默认为 209715199):
将使用默认值 209715199
分区 2 已设置为 Linux 类型,大小设为 50 GiB
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
lsblk
mkfs.xfs /dev/sdb1
mkfs.xfs /dev/sdb2
openstack (国基版搭建)
1.挂载镜像
1.) 清理无用镜像源
mkdir /etc/yum.repos.d/test
mv /etc/yum.repos.d/C* /etc/yum.repos.d/test
2.)配置镜像源
controller:
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1
compute:
[centos]
name=centos
baseurl=ftp://controller/centos #ftp源
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://controller/iaas/iaas-repo
gpgcheck=0
enabled=1
3.)上传镜像:
使用xftp软件上传所需镜像:
4.)挂载镜像:
创建目录:
挂载:
mount CentOS-7-x86_64-DVD-1804.iso /mnt/ #挂载只能只读挂载,想修改里面的文件就按照如下方式
cp -rvf /mnt/* /opt/centos/
umount /mnt/
mount bricsskills_cloud_iaas.iso /mnt/
cp -rvf /mnt/* /opt/iaas/
yum clean all
yum makecache
5.)安装vsftpd:
yum install -y vsftpd #controller节点装
6.) 修改权限:
vi /etc/vsftpd/vsftpd.conf
systemctl restart vsftpd
systemctl enable vsftpd
yum clean all #compute 测试ftp源是否可用
yum makecache
2.OpenStack搭建
1.) 安装iaas-xiandian
yum install iaas-xiandian -y
2.) 修改配置文件:
sed -i 's/^#//g' /etc/xiandian/openrc.sh
vi /etc/xiandian/openrc.sh
:%s/PASS=/PASS=000000/g
controler:
[root@controller ~]# grep '^[^#]' /etc/xiandian/openrc.sh
HOST_IP=192.168.100.10
HOST_PASS=000000
HOST_NAME=controller
HOST_IP_NODE=192.168.100.20
HOST_PASS_NODE=000000
HOST_NAME_NODE=compute
network_segment_IP=192.168.100.0/24
RABBIT_USER=openstack
RABBIT_PASS=000000
DB_PASS=000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000
KEYSTONE_DBPASS=000000
GLANCE_DBPASS=000000
GLANCE_PASS=000000
NOVA_DBPASS=000000
NOVA_PASS=000000
NEUTRON_DBPASS=000000
NEUTRON_PASS=000000
METADATA_SECRET=000000
INTERFACE_IP=192.168.100.10 #controller IP
INTERFACE_NAME=ens33 #外网网卡
Physical_NAME=provider
minvlan=101
maxvlan=200
CINDER_DBPASS=000000
CINDER_PASS=000000
BLOCK_DISK=sdb1
SWIFT_PASS=000000
OBJECT_DISK=sdb2 #计算节点挂载点
STORAGE_LOCAL_NET_IP=192.168.100.20 #计算节点IP
HEAT_DBPASS=000000
HEAT_PASS=000000
ZUN_DBPASS=000000
ZUN_PASS=000000
KURYR_DBPASS=000000
KURYR_PASS=000000
CEILOMETER_DBPASS=000000
CEILOMETER_PASS=000000
AODH_DBPASS=000000
AODH_PASS=000000
BARBICAN_DBPASS=000000
BARBICAN_PASS=000000
source /etc/xiandian/openrc.sh
echo $INTERFACE_IP
scp /etc/xiandian/openrc.sh root@compute:/etc/xiandian/openrc.sh
compute:
INTERFACE_IP=192.168.100.20 #修改一行 compute IP
source /etc/xiandian/openrc.sh
echo $INTERFACE_IP
3.) 使用脚本搭建
controller compute 都执行
iaas-pre-host.sh
controller执行
iaas-install-mysql.sh
iaas-install-keystone.sh
iaas-install-glance.sh
ocntroller compute都执行
iaas-install-nova-controller.sh #controller
iaas-install-nova-compute.sh #compute
iaas-install-neutron-controller.sh #controller
iaas-install-neutron-compute.sh #compute
controller
iaas-install-dashboard.sh
curl -L http://192.168.100.10/dashboard
controller,compute都执行
iaas-install-cinder-controller.sh
iaas-install-cinder-compute.sh
iaas-install-swift-controller.sh
iaas-install-swift-compute.sh
查看opensatck服务状态
[root@controller bin]# openstack-service status
MainPID=0 Id=neutron-dhcp-agent.service ActiveState=inactive
MainPID=0 Id=neutron-l3-agent.service ActiveState=failed
MainPID=0 Id=neutron-linuxbridge-agent.service ActiveState=inactive
MainPID=19601 Id=neutron-metadata-agent.service ActiveState=active
MainPID=19597 Id=neutron-server.service ActiveState=active
MainPID=38560 Id=openstack-cinder-api.service ActiveState=active
MainPID=42762 Id=openstack-cinder-scheduler.service ActiveState=active
MainPID=13976 Id=openstack-glance-api.service ActiveState=active
MainPID=13977 Id=openstack-glance-registry.service ActiveState=active
MainPID=38463 Id=openstack-nova-api.service ActiveState=active
MainPID=14642 Id=openstack-nova-conductor.service ActiveState=active
MainPID=42797 Id=openstack-nova-consoleauth.service ActiveState=activating
MainPID=14643 Id=openstack-nova-novncproxy.service ActiveState=active
MainPID=42741 Id=openstack-nova-scheduler.service ActiveState=activating
MainP[root@compute bin]# openstack-service status
MainPID=0 Id=neutron-linuxbridge-agent.service ActiveState=inactive
MainPID=19776 Id=openstack-cinder-volume.service ActiveState=active
MainPID=0 Id=openstack-nova-compute.service ActiveState=activating
MainPID=25695 Id=openstack-swift-account-auditor.service ActiveState=active
MainPID=25696 Id=openstack-swift-account-reaper.service ActiveState=active
MainPID=25697 Id=openstack-swift-account-replicator.service ActiveState=active
MainPID=25693 Id=openstack-swift-account.service ActiveState=active
MainPID=25765 Id=openstack-swift-container-auditor.service ActiveState=active
MainPID=25767 Id=openstack-swift-container-replicator.service ActiveState=active
MainPID=25770 Id=openstack-swift-container-updater.service ActiveState=active
MainPID=25760 Id=openstack-swift-container.service ActiveState=active
MainPID=25818 Id=openstack-swift-object-auditor.service ActiveState=active
MainPID=25820 Id=openstack-swift-object-replicator.service ActiveState=active
MainPID=25819 Id=openstack-swift-object-updater.service ActiveState=active
MainPID=25814 Id=openstack-swift-object.service ActiveState=active
ID=42318 Id=openstack-swift-proxy.service ActiveState=active
[root@compute bin]# openstack-service status
MainPID=0 Id=neutron-linuxbridge-agent.service ActiveState=inactive
MainPID=19776 Id=openstack-cinder-volume.service ActiveState=active
MainPID=0 Id=openstack-nova-compute.service ActiveState=activating
MainPID=25695 Id=openstack-swift-account-auditor.service ActiveState=active
MainPID=25696 Id=openstack-swift-account-reaper.service ActiveState=active
MainPID=25697 Id=openstack-swift-account-replicator.service ActiveState=active
MainPID=25693 Id=openstack-swift-account.service ActiveState=active
MainPID=25765 Id=openstack-swift-container-auditor.service ActiveState=active
MainPID=25767 Id=openstack-swift-container-replicator.service ActiveState=active
MainPID=25770 Id=openstack-swift-container-updater.service ActiveState=active
MainPID=25760 Id=openstack-swift-container.service ActiveState=active
MainPID=25818 Id=openstack-swift-object-auditor.service ActiveState=active
MainPID=25820 Id=openstack-swift-object-replicator.service ActiveState=active
MainPID=25819 Id=openstack-swift-object-updater.service ActiveState=active
MainPID=25814 Id=openstack-swift-object.service ActiveState=active
|