[root@controller ~]# hostnamectl set-hostname controller
yum install -y bash*
[root@controller ~]# logout
[root@controller ~]# vi /etc/hosts
[root@controller ~]# setenforce 0
[root@controller ~]# sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
ssh -keygen
ssh-copy-id compute
[root@controller ~]# rm -rvf /etc/yum.repos.d/*
[root@controller ~]# vi /etc/yum.repos.d/http.repo
name baseurl enable=1 gpgcheck=0
yum clean all?
scp /etc/yum.repos.d/http.repo compute: /etc/repos.d
[root@compute ~]# hostnamectl set-hostname compute
[root@compute ~]# bash
[root@compute ~]# vi /etc/hosts
[root@compute ~]# setenforce 0
[root@compute ~]# sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
[root@compute ~]# rm -rvf /etc/yum.repos.d/*
[root@compute ~]# vi /etc/yum.repos.d/ftp.repo
[root@compute ~]# umount /dev/vdb
[root@compute ~]# fdisk /dev/vdb
[root@controller ~]# yum install -y openstack-iaas vim
[root@controller ~]# vim /etc/openstack/openrc.sh
%s/# //
%s/PASS=/PASS=000000
[root@controller ~]# scp /etc/openstack/openrc.sh 172.100.0.25:/etc/openstack/openrc.sh
[root@controller ~]# iaas-pre-host.sh
reboot
[root@controller ~]# iaas-install-mysql.sh
vi /etc/my.conf
lower_case_table_names =1
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 64MB
#設置數(shù)據庫的redo log即redo日志大小
innodb_log_file_size = 256MB
#數(shù)據庫的redo log文件組即redo日志的個數(shù)配置
innodb_log_files_in_group = 2
[root@controller ~]# iaas-install-keystone.sh
source /etc/keystone/admin-openrc.sh?
openstack user create --password 000000 chinaskill
[root@controller ~]# iaas-install-glance.sh
curl -O http://10.18.4.100/cirros-0.3.4-x86_64-disk.img
[root@controller ~]# iaas-install-placement.sh
openstack image create --min-disk 10 --min-ram 1024 --file cirros-0.3.3-x86_64-disk.img? cirros
[root@controller ~]# iaas-install-placement.sh
[root@controller ~]# iaas-install-nova-controller.sh
cat /etc/nova/nova.conf |grep vif_plugging_is_fatal
vif_plugging_is_fatal=false
systemctl restart openstack-nova*
[root@controller ~]# iaas-install-neutron-controller.sh
[root@controller ~]# iaas-install-dashboard.sh
cat /etc/openstack-dashboard/local_settings |grep django
SESSION_ENGINE = 'django.contrib.sessions.backends.file'
systemctl restart httpd
[root@controller ~]# iaas-install-cinder-controller.sh
pvcreate /dev/vdb4
gextend cinder-volumes /dev/vdb4
vgdisplay
[root@controller ~]# iaas-install-swift-controller.sh
#通過命令行創(chuàng)建容器
openstack container create examcontainer
openstack container list
#下載鏡像
curl -O http://10.18.4.46/cirros-0.3.4-x86_64-disk.img
#swfit切片上傳cirros
#-S 上載不大于<size>(字節(jié))的段中的文件,然后創(chuàng)建一個“清單”文件,該文件將下載所有段雨涛,就像它是原始文件一樣笛园。
swift upload examcontainer -S 10485760 cirros-0.3.4-x86_64-disk.img
swift stat examcontainer cirros-0.3.4-x8664-disk.img
[root@controller ~]# iaas-install-trove.sh # network
[root@controller ~]# iaas-install-heat.sh
[root@controller ~]# iaas-install-ceilometer-controller.sh
[root@controller ~]# iaas-install-aodh.sh
[root@controller ~]# iaas-install-zun-controller.sh
[root@controller ~]# iaas-install-octavia.sh # sudo dhclient -v o-hm0 -cf /etc/dhcp/octavia
[root@controller ~]# iaas-install-manila-controller.sh
[root@controller ~]# iaas-install-cloudkitty.sh
[root@controller ~]# iaas-install-barbican.sh
[root@controller ~]# iaas-install-fwaas-and-vpnaas.sh
[root@compute ~]# yum install -y openstack-iaas vim
[root@compute ~]# iaas-pre-host.sh # umount /dev/vdb
[root@compute ~]# iaas-install-nova-compute.sh
[root@compute ~]# iaas-install-neutron-compute.sh
[root@compute ~]# iaas-install-cinder-compute.sh
[root@compute ~]# iaas-install-swift-compute.sh
[root@compute ~]# iaas-install-ceilometer-compute.sh
[root@compute ~]# iaas-install-zun-compute.sh
[root@compute ~]# iaas-install-manila-compute.sh
[root@controller ~]# yum install -y bash-completion
[root@controller ~]# source /usr/share/bash-completion/bash_completion
[root@controller ~]# openstack complete >> /root/.bashrc
[root@controller ~]# source /root/.bashrc
[root@controller ~]# file cirros-0.3.4-x86_64-disk.img # list
[root@controller ~]# glance image-create --name test-glance-image --disk-format qcow2 --container-format bare --min-ram 512 --min-disk 20 --tags test? --progress --file cirros-0.3.4-x86_64-disk.img # creat
[root@controller ~]# glance image-update IMAGE_ID --name glance-image2 --min-ram 1024 --min-disk 25 #
[root@controller ~]# glance image-list?
[root@controller ~]# glance image-show IMAGE_ID?
[root@controller ~]# glance image-delete IMAGE_ID
[root@controller ~]# openstack catalog list?
[root@controller ~]# openstack token issue?
[root@controller ~]# openstack domain create test-domain --descripti "Test Domain"
[root@controller ~]# openstack domain list?
[root@controller ~]# openstack domain show test-domain?
[root@controller ~]# openstack domain set test-domain --disable
[root@controller ~]# openstack domain delete test-domain?
[root@controller ~]# openstack project create test-project --domain test-domain --descripti "Test-Project"?
[root@controller ~]# openstack project set test-project --name test-project2 --domain test-domain --description "Test Project" --enable
[root@controller ~]# openstack user create test-user --domain test-domain --password 000000?
[root@controller ~]# openstack user set test-user --name test-user2 --domain test-domain --project test-project --project-domain test-domain? --password 000000 --enable
[root@controller ~]# openstack role create test-role?
[root@controller ~]# openstack role add test-role --project test-project --user test-user??
[root@controller ~]# export OS_PROJECT_NAME=admin?
[root@controller ~]# export OS_USERNAME=admin?
[root@controller ~]# export OS_PASSWORD=000000?
[root@controller ~]# openstack service create --name test-service SERVICE_TYPE?
[root@controller ~]# openstack endpoint create --region RegionOne SERVICE_TYPE public URL?
[root@controller ~]# openstack endpoint create --region RegionOne SERVICE_TYPE internal URL?
[root@controller ~]# openstack endpoint create --region RegionOne SERVICE_TYPE admin URL?
[root@controller ~]# openstack endpoint lis?
[root@controller ~]# openstack image create test-image --disk-format qcow2 --container-format bare --min-disk 20 --min-ram 512 --tag test-image --file cirros-0.3.4-x86_64-disk.img?
[root@controller ~]# openstack image set test-image --name test-image2 --min-disk 25 --min-ram 1024 --tag test-image2?
[root@controller ~]# openstack image list?
[root@controller ~]# openstack image show test-image2?
[root@controller ~]# openstack flavor create test-flavor --id 4 --ram 1024 --disk 30 --vcpus 1
[root@controller ~]# nova flavor-create test-nova-flavor 5 1024 30 1
[root@controller ~]# openstack network create test-net-wai --provider-network-type vlan --provider-physical-network provider --provider-segment 200 --external?
[root@controller ~]# openstack subnet create test-sub-wai --network test-net-wai --gateway 172.100.0.1 --subnet-range 172.100.0.0/24 --allocation-pool start=172.100.0.100,end=172.100.0.200 --dhcp?
[root@controller ~]# openstack network create test-net-nei --provider-network-type vlan --provider-physical-network provider --provider-segment 100
[root@controller ~]# openstack subnet create test-sub-nei --network test-net-nei --gateway 10.10.10.1 --subnet-range 10.10.10.0/24 --dhcp?
[root@controller ~]# openstack router create test-router?
[root@controller ~]# openstack router set test-router --external-gateway test-net-wai
[root@controller ~]# openstack router add subnet test-router test-sub-nei?
[root@controller ~]# openstack floating ip create test-net-wai --floating-ip-address 10.10.10.111?
[root@controller ~]# openstack server add floating ip test-vm 10.10.10.111
[root@controller ~]# openstack security group create test-security-group?
[root@controller ~]# openstack security group list?
[root@controller ~]# openstack security group show test-security-group?
[root@controller ~]# openstack security group rule list test-security-group
[root@controller ~]# openstack security group rule show RULE_ID?
[root@controller ~]# openstack security group rule delete RULE_ID?
[root@controller ~]# openstack security group rule create --protocol icmp --ingress test-security-group?
[root@controller ~]# openstack security group rule create --protocol tcp --ingress test-security-group?
[root@controller ~]# openstack security group rule create --protocol udp --ingress test-security-group?
[root@controller ~]# openstack security group rule create --protocol icmp --egress test-security-group?
[root@controller ~]# openstack security group rule create --protocol tcp --egress test-security-group
[root@controller ~]# openstack security group rule create --protocol udp --egress test-security-group?
[root@controller ~]# openstack server create test-vm --image test-image --flavor test-flavor --network test-net-nei?
[root@controller ~]# openstack server stop test-vm
[root@controller ~]# openstack server start test-vm
[root@controller ~]# openstack server reboot test-vm
[root@controller ~]# openstack server rebuild test-vm --image test-glance-image?
[root@controller ~]# openstack volume service lis?
[root@controller ~]# openstack volume type create lvm?
[root@controller ~]# openstack volume create test-volume --size 2 --type lvm?
[root@controller ~]# openstack server add volume test-vm test-volume
[root@controller ~]# openstack server remove volume test-vm test-volume?
[root@controller ~]# openstack volume set test-volume --size 3?
[root@controller ~]# cinder type-create lvm?
[root@controller ~]# cinder create --name test-cinder --volume-type lvm 2
Swift:
[root@controller ~]# swift stat?
[root@controller ~]# swift post test?
[root@controller ~]# swift stat test
[root@controller ~]# swift upload test -S 10000000 cirros-0.3.4-x86_64-disk.img # 上傳至容器并分片存儲
[root@controller ~]# swift stat test cirros-0.3.4-x86_64-disk.img # 查看存儲路徑
[root@controller ~]# swift list? test_segments # 查看路徑中的數(shù)據片
[root@controller ~]# openstack container create test-con # 創(chuàng)建容器
[root@controller ~]# openstack container list # 顯示容器
[root@controller ~]# openstack container show test-con # 查看容器詳細信息
[root@controller ~]# openstack object create test-con /root/cirros-0.3.4-x86_64-disk.img # 創(chuàng)建對象就是向容器中上傳文件
[root@controller ~]# openstack object list test-con # 查看容器中的所有對象信息
[root@controller ~]# openstack object show test-con? /root/cirros-0.3.4-x86_64-disk.img # 查看容器中對象的詳細信息
[root@controller ~]# openstack object save test-con /root/cirros-0.3.4-x86_64-disk.img --file /tmp/cirros-0.3.4-x86_64-disk.img # 下載容器中的對象到本地
[root@controller ~]# openstack container delete --recursive test-con # 強制刪除容器
[root@controller ~]# openstack object delete test-con? /root/cirros-0.3.4-x86_64-disk.img # 刪除容器里的對象
[root@controller ~]# openstack container delete test-con # 刪除容器,前提得刪除容器里的所有對象
Zun:
[root@controller ~]# openstack image create centos7.5 --public --container-format docker --disk-format raw --file CentOS7_1804.tar # 上傳鏡像
[root@controller ~]# openstack appcontainer run --name centos --image-driver glance --net network=test-net-nei centos7.5 # 創(chuàng)建容器
[root@controller ~]# openstack appcontainer delete --force centos7.5 # 刪除容器
Ceilometer:
[root@controller ~]# openstack alarm create --name cpu_hi \ # 告警名 cpu_hi
> --type gnocchi_resources_threshold \ # 類型
> --metric cpu_util \ # 測量值名稱 cpu_util
> --threshold 70.0 \ # 閥值 700
> --comparison-operator gt \ # 對比方式 大于
> --evaluation-periods 3 \ # 統(tǒng)計次數(shù) 3
> --alarm-action 'log://' \ # 轉為告警狀態(tài)提交的URL 'log://'
> --aggregation-method mean \ # 統(tǒng)計方式平均值
> --resource-type instance \ # 資源類型
> --resource-id INSTANCE_ID # 資源id
[root@controller ~]# openstack alarm update --enabled false cpu_hi # 告警信息不生效
[root@controller ~]# openstack alarm-history show ALARM_ID # 查看告警的歷史改變信息
[root@controller ~]# gnocchi resource-show INSTANCE_ID # 查看云主機所調用的資源
[root@controller ~]# gnocchi resource list # 查詢資源列表
[root@controller ~]# openstack alarm list # 查看告警信息
[root@controller ~]# openstack metric list # 查看測量值列表
[root@controller ~]# openstack alarm update delete cpu_hi # 刪除告警信息
Octavia:
[root@controller ~]# openstack image create amphora-x64-haproxy --disk-format qcow2 --container-format bare --private --tag amphora --file amphora-x64-haproxy.qcow2 # 上傳鏡像
[root@controller ~]# openstack loadbalancer create --name vip vip-network-id LB_MGMT_NET_ID # 創(chuàng)建負載均衡的ip服務瘟仿,