赞
踩
文章目录
pc1
- root@localhost ~# hostnamectl set-hostname controller
- root@localhost ~# su
pc2
- root@localhost ~# hostnamectl set-hostname compute
- root@localhost ~# su
- root@controller ~# vi /etc/hosts
- 172.21.69.2 controller
- 172.21.69.3 compute
- [centos]
- name=centos
- gpgcheck=0
- baseurl=http://...................../centos
- enabled=1
-
- [iaas]
- name=iaas
- gpgcheck=0
- baseurl=http://....................../iaas-repo
- enabled=1
pc1
- ssh-keygen
- ssh-copy-id 172.21.69.3
pc2
- ssh-keygen
- ssh-copy-id 172.21.69.2
- root@controller ~# yum -y insatll openstack-iaas #安装软件包
- root@controller ~# vim /etc/openstack/openrc.sh #修改配置文件
- root@controller ~# scp -r /etc/openstack/openrc.sh compute://etc/openstack/openrc.sh #将配置文件传到pc2
- root@controller ~# iaas-pre-host.sh #两边都跑一遍,开始安装
root@compute ~# iaas-install-mysql.sh #开始安装数据
root@controller ~# iaas-install-keystone.sh
在控制节点上安装Keystone服务并创建用户
- root@controller ~# source /etc/keystone/admin-openrc.sh
- root@controller ~# openstack user create chinaskill --password 000000
在控制节点上安装Glance 服务。上传镜像至平台,并设置镜像启动的要求参数
- root@controller ~# iaas-install-glance.sh
- root@controller ~# glance image-create --name cirros --min-disk 10 --min-ram 1024 --container-format bare --disk-format qcow2 --file /cirros-0.3.4-x86_64-disk.img
–-name 上传完镜像在openstack中显示的名称
–-container-format 图片的容器格式(可以是ami,ari,aki,ovf,bare默认是bare)
–-min-disk 这个镜像启动最小需要的大小
-–min-ram 启动这个镜像需要的最小内存
–-file 镜像所在本地目录
–-is-public 【True|False】 是否共享此镜像
–-disk-format 镜像格式
在控制节点和计算节点上分别安装Nova服务。安装完成后,完成Nova相关配置。
在controller上运行iaas-install-placement.sh 脚本
root@controller ~# iaas-install-placement.sh
现在controller上运行aas-install-nova-controller.sh (先完成控制节点的安装,pc节点再去安装)
- root@controller ~# iaas-install-nova-controller.sh
- root@compute ~# iaas-install-nova-compute.sh
在控制和计算节点上正确安装Neutron服务
- root@controller ~# iaas-install-neutron-controller.sh
- root@compute ~# iaas-install-neutron-compute.sh
root@controller ~# iaas-install-dashboard.sh
在控制节点和计算节点上分别安装Swift服务。安装完成后,将cirros镜像进行分片存储。
- root@controller ~# iaas-install-swift-controller.sh
- [root@controller ~]# iaas-install-swift-compute.sh
-
- root@controller ~# swift post exam #先创建一个容器
- root@controller ~]# swift upload exam -S 10000000 /cirros-0.3.4-x86_64-disk.img #上传镜像到容器并进行分片
在控制节点和计算节点分别安装Cinder服务,请在计算节点,对块存储进行扩容操作。
- root@controller ~# iaas-install-cinder-controller.sh
- root@compute ~# iaas-install-cinder-compute.sh
注意:是在计算节点进行扩容操作,我这里为了省事
lsblk 查看磁盘
fdisk /dev/vdb 磁盘划分
创建物理卷
扩展卷
vgs 查看
在控制和计算节点上分别在控制节点和计算节点安装Manila服务。在 控 制 和 计 算 节 点 上 分 别 使 用 iaas-install-manila-controller.sh 和iaas-install-manila-compute.sh 脚本安装 manila 服务。安装服务后创建 default_share_type 共享类型(不使用驱动程序支持),接着创建一个大小为 2G 的共享存储名为 share01 并开放share01 目录对 OpenStack 管理网段使用权限。
————————————————
- root@controller ~# iaas-install-manila-controller.sh
- root@compute ~# iaas-install-manila-compute.sh
安装服务后创建 default_share_type 共享 类型(不使用驱动程序支持)
接着创建一个大小为 2G 的共享存储名为 share01
并开放 share01 目录对 OpenStack 管理网段使用权限。
在控制节点安装cloudkitty服务,安装完毕后,启用hashmap评级模块,并设置计费规则。
- root@controller ~# iaas-install-cloudkitty.sh #开始安装
-
-
- root@controller ~# cloudkitty module list #查看模块状态
- +-----------+---------+----------+
- | Module | Enabled | Priority |
- +-----------+---------+----------+
- | noop | True | 1 |
- | hashmap | False | 1 |
- | pyscripts | False | 1 |
- +-----------+---------+----------+
-
-
- [root@controller ~]# cloudkitty module enable hashmap #开启模块
- +---------+---------+----------+
- | Module | Enabled | Priority |
- +---------+---------+----------+
- | hashmap | True | 1 |
- +---------+---------+----------+
-
-
- [root@controller ~]# cloudkitty module list #验证
- +-----------+---------+----------+
- | Module | Enabled | Priority |
- +-----------+---------+----------+
- | noop | True | 1 |
- | hashmap | True | 1 |
- | pyscripts | False | 1 |
- +-----------+---------+----------+
创建服务匹配规则volume.size,并设置每 GB 的价 格为 0.01
- root@controller ~# openstack rating hashmap service create volume.size #创建服务匹配规则
- +-------------+--------------------------------------+
- | Name | Service ID |
- +-------------+--------------------------------------+
- | volume.size | a5391f4c-567d-4854-9eee-a65d534dc891 |
- +-------------+--------------------------------------+
-
-
- [root@controller ~]# openstack rating hashmap group create volume_thresholds #创建volume_thresholds 组
- +-------------------+--------------------------------------+
- | Name | Group ID |
- +-------------------+--------------------------------------+
- | volume_thresholds | d6c02583-c8ef-4c15-8790-041803b3f98f |
- +-------------------+--------------------------------------+
-s 后面为service id | -g 后面为group id
- root@controller ~# openstack rating hashmap mapping create -s a5391f4c-567d-4854-9eee-a65d534dc891 -g d6c02583-c8ef-4c15-8790-041803b3f98f -t flat 0.01
- +--------------------------------------+-------+------------+------+----------+--------------------------------------+--------------------------------------+------------+
- | Mapping ID | Value | Cost | Type | Field ID | Service ID | Group ID | Project ID |
- +--------------------------------------+-------+------------+------+----------+--------------------------------------+--------------------------------------+------------+
- | 89b4fd80-79f4-4a6f-8f4a-1f489f7ff6f5 | None | 0.01000000 | flat | None | a5391f4c-567d-4854-9eee-a65d534dc891 | d6c02583-c8ef-4c15-8790-041803b3f98f | None |
- +--------------------------------------+-------+------------+------+----------+--------------------------------------+--------------------------------------+------------+
- root@controller ~# openstack rating hashmap threshold create -s a5391f4c-567d-4854-9eee-a65d534dc891 -g d6c02583-c8ef-4c15-8790-041803b3f98f -t rate 50 0.98
- +--------------------------------------+-------------+------------+------+----------+--------------------------------------+--------------------------------------+------------+
- | Threshold ID | Level | Cost | Type | Field ID | Service ID | Group ID | Project ID |
- +--------------------------------------+-------------+------------+------+----------+--------------------------------------+--------------------------------------+------------+
- | 2472eee7-18f6-4be3-8935-2769e756f315 | 50.00000000 | 0.98000000 | rate | None | a5391f4c-567d-4854-9eee-a65d534dc891 | d6c02583-c8ef-4c15-8790-041803b3f98f | None |
- +--------------------------------------+-------------+------------+------+----------+--------------------------------------+--------------------------------------+------------+
-
-
在控制节点安装barbican服务,安装服务完毕后,创建一个密钥
- root@controller ~# openstack secret store --name secre1 --payload secretkey
- +---------------+------------------------------------------------------------------------+
- | Field | Value |
- +---------------+------------------------------------------------------------------------+
- | Secret href | http://controller:9311/v1/secrets/25472878-c6a3-4613-9b5c-9bd8e3ab3353 |
- | Name | secre1 |
- | Created | None |
- | Status | None |
- | Content types | None |
- | Algorithm | aes |
- | Bit length | 256 |
- | Secret type | opaque |
- | Mode | cbc |
- | Expiration | None |
- +---------------+------------------------------------------------------------------------+
搭建完OpenStack平台后,关闭系统的内存共享,打开透明大页
- root@controller ~# find /-name defrag #查找文件位置
- /sys/kernel/mm/transparent_hugepage/defrag
- /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
-
-
- [root@controller ~]# echo never > /sys/kernel/mm/transparent_hugepage/defrag #改写
- [root@controller ~]# cat /sys/kernel/mm/transparent_hugepage/defrag #查看
- always madvise [never]
-
-
- root@controller ~# echo always > /sys/kernel/mm/transparent_hugepage/enabled #透明大页
修改controller节点的相关配置文件,开启SYN cookie,防止SYN洪水攻击
vim /etc/sysctl.conf 进入配置文件
- net.ipv4.tcp_max_syn_backlog=2048
-
- net.ipv4.tcp_syncookies=1
-
- net.ipv4.tcp_syn_retries=0
添加这三行
sysctl -p 查看
修改controller节点的相关配置文件,配置controller节点禁止其他节点可以ping它
- root@controller ~# vim /etc/sysctl.conf #进入配置文件
- net.ipv4.icmp_echo_ignore_all = 1 #添加一条
- root@controller ~# /sbin/sysctl -p #使它生效
- net.bridge.bridge-nf-call-iptables = 1
- net.bridge.bridge-nf-call-ip6tables = 1
- net.ipv4.icmp_echo_ignore_all = 1
在自行搭建的OpenStack私有云平台或赛项提供的all-in-one平台上,修改相关配置文件,启用-device virtio-net-pci in kvm,
- root@controller ~]# vi /etc/nova/nova.conf
- libvirt
- libvirt_use_virtio_for_bridges=true
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。