分享一下Rocky版本的OpenStack安裝管理經驗:html
OpenStack每半年左右更新一版,目前是版本是201808月發佈的版本-R版(Rocky),目前版本安裝方法優化較好,不過依然是比較複雜python
官方文檔地址:https://docs.openstack.org/install-guide/openstack-services.htmlmysql
本文主要分享控制節點的環境配置方法:linux
---------------- 完美的分割線 ------------------web
1)生產測試應用的服務器最好是物理機,虛擬目前能夠完成搭建測試體驗sql
2)系統選擇是目前的最新版本:CentOS Linux release 7.5.1804 (Core) 數據庫
3)控制節點Controller :192.168.1.81
計算節點Nova:192.168.1.82vim
# 主機名設置好就不能修改,不然會出問題,控制節點和計算節點配置相同,且都須要配置centos
hostname openstack01.zuiyoujie.com hostname echo "openstack01.zuiyoujie.com"> /etc/hostname cat /etc/hostname
vim /etc/hosts ----------------------------------- 192.168.1.81 openstack01.zuiyoujie.com controller 192.168.1.82 openstack02.zuiyoujie.com compute02 block02 object02 -----------------------------------
# 配置主機名的FQDN格式,和集羣內部角色名稱方便後續配置瀏覽器
# 在CentOS7上面是firewalld
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
setenforce 0 getenforce sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux grep SELINUX=disabled /etc/sysconfig/selinux
yum install chrony -y
vim /etc/chrony.conf -------------------------------- server ntp1.aliyun.com iburst server ntp2.aliyun.com iburst allow 192.168.1.0/24 --------------------------------
systemctl restart chronyd.service
systemctl status chronyd.service
systemctl enable chronyd.service
systemctl list-unit-files |grep chronyd.service
timedatectl set-timezone Asia/Shanghai
chronyc sources
timedatectl status
# 配置完成,以下顯示
[root@openstack01 ~]# chronyc sources 210 Number of sources = 2 MS Name/IP address Stratum Poll Reach LastRx Last sample ================================================================================== ^* 120.25.115.20 2 6 17 9 +17ms[ +22ms] +/- 34ms ^+ 203.107.6.88 2 6 17 9 +3029us[+8251us] +/- 54ms [root@openstack01 ~]# timedatectl status Local time: 一 2018-10-22 15:13:51 CST Universal time: 一 2018-10-22 07:13:51 UTC RTC time: 一 2018-10-22 07:13:52 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
mv -f /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install centos-release-openstack-rocky -y
yum clean all
yum makecache
# 也能夠手動建立OpenStack的阿里雲yum源地址
vim /etc/yum.repos.d/CentOS-OpenStack-Rocky.repo ---------------------------------- [centos-openstack-rocky] name=CentOS-7 - OpenStack rocky baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud [centos-openstack-rocky-test] name=CentOS-7 - OpenStack rocky Testing baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/ gpgcheck=0 enabled=0 [centos-openstack-rocky-debuginfo] name=CentOS-7 - OpenStack rocky - Debug baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud [centos-openstack-rocky-source] name=CentOS-7 - OpenStack rocky - Source baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud [rdo-trunk-rocky-tested] name=OpenStack rocky Trunk Tested baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/rdo-trunk-rocky-tested/ gpgcheck=0 enabled=0 -----------------------------------
yum update -y
yum install python-openstackclient openstack-selinux -y
# 能夠修改系統內核更改最大鏈接數和文件句柄數
# CentOS7.5默認數據庫爲maraidb
yum install mariadb mariadb-server MySQL-python python2-PyMySQL -y
vim /etc/my.cnf.d/mariadb_openstack.cnf # 在[mysqld]添加如下配置 ----------------------------------- [mysqld] bind-address = 0.0.0.0 default-storage-engine = innodb innodb_file_per_table = on max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8 init-connect = 'SET NAMES utf8' -----------------------------------
# 配置解釋:
default-storage-engine = innodb 默認存儲引擎 innodb_file_per_table 使用獨享表空間模式,每個表都會建一個表空間,都會有索引文件,查索引快,共享表空間,共用一個表空間和索引,若是有損壞很難修復,好比說zabbix用到的數據庫若是不使用的獨享表空間,很難進行優化 collation-server = utf8_general_ci init-connect = 'SET NAMES utf8' character-set-server = utf8
systemctl restart mariadb.service
systemctl status mariadb.service
systemctl enable mariadb.service
systemctl list-unit-files |grep mariadb.service
# 設置密碼,默認密碼爲空,而後輸入密碼123456,一路y回車
/usr/bin/mysql_secure_installation
systemctl restart mariadb.service
# 注意:生產環境可使用pwgen工具生成數據庫密碼
openssl rand -hex 10
# 測試下數據庫,相關的數據庫在須要時單首創建
mysql -p123456 -----------------------------------
flush privileges; show databases; select user,host from mysql.user; exit -----------------------------------
# 至此,數據庫配置完畢
消息隊列( MQ)全稱爲 Message Queue, 是一種應用程序對應用程序的通訊方法。應用程序經過讀寫出入隊列的消息(針對應用程序的數據)來通訊,而無需專用鏈接來連接它們。
消息傳遞指的是程序之間經過在消息中發送數據進行通訊,而不是經過直接調用彼此來通訊,直接調用一般是用於諸如遠程過程調用的技術。排隊指的是應用程序經過 隊列來通訊。
隊列的使用除去了接收和發送應用程序同時執行的要求。
RabbitMQ 是一個在 AMQP 基礎上完整的,可複用的企業消息系統。他遵循 Mozilla Public License 開源協議。
yum install rabbitmq-server -y
# 端口5672,15672,用於拍錯
systemctl start rabbitmq-server.service systemctl status rabbitmq-server.service systemctl enable rabbitmq-server.service systemctl list-unit-files |grep rabbitmq-server.service
# 添加openstack用戶和密碼,配置用戶權限,配置讀,寫權限
rabbitmqctl add_user openstack openstack rabbitmqctl set_permissions openstack ".*" ".*" ".*"
rabbitmqctl set_permissions -p "/" openstack ".*" ".*" ".*"
# 查看支持的插件
rabbitmq-plugins list
# 啓用web管理插件,須要重啓服務使之生效
rabbitmq-plugins enable rabbitmq_management systemctl restart rabbitmq-server.service rabbitmq-plugins list lsof -i:15672
訪問地址:http://192.168.1.81:15672
# 默認用戶名密碼都是guest
# web界面能夠管理建立用戶,管理權限
# rabbitmq配置完畢
認證服務認證緩存使用Memcached緩存令牌。緩存服務memecached運行在控制節點。在生產部署中,推薦聯合啓用防火牆、認證和加密保證它的安全。
yum install memcached python-memcached -y
vim /etc/sysconfig/memcached ---------------------------------- OPTIONS="-l 127.0.0.1,controller" ----------------------------------
# 若是沒有啓用IPv6地址須要刪掉::1的地址綁定
systemctl start memcached.service systemctl status memcached.service netstat -anptl|grep memcached systemctl enable memcached.service systemctl list-unit-files |grep memcached.service
# memcached參數說明:
-d選項是做爲守護進程在後臺運行 -m是分配給Memcache使用的內存數量,單位是MB,我這裏是10MB, -u是運行Memcache的用戶,我這裏是root, -l是監聽的服務器IP地址,若是有多個地址的話 -p是設置Memcache監聽的端口,我這裏設置了12000,最好是1024以上的端口, -c選項是最大運行的併發鏈接數,默認是1024,我這裏設置了256,按照你服務器的負載量來設定, -P是設置保存Memcache的pid文件 -vv是以very vrebose模式啓動,將調試信息和錯誤輸出到控制檯
# 至此,memcached配置完畢
# 這個Etcd服務是新加入的,用於自動化配置
yum install etcd -y
vim /etc/etcd/etcd.conf ----------------------------------- #[Member] ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="http://192.168.1.81:2380" ETCD_LISTEN_CLIENT_URLS="http://192.168.1.81:2379" ETCD_NAME="controller" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.1.81:2380" ETCD_ADVERTISE_CLIENT_URLS="http://192.168.1.81:2379" ETCD_INITIAL_CLUSTER="controller=http://192.168.1.81:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" ETCD_INITIAL_CLUSTER_STATE="new" ------------------------------------
# 注意上面的IP地址不能用controller替代,沒法解析
systemctl start etcd.service systemctl status etcd.service netstat -anptl|grep etcd systemctl enable etcd.service systemctl list-unit-files |grep etcd.service
# 至此,控制節點controller就完成基礎環境的配置,下面能夠開始安裝 openstack 的組件
# 虛擬機的話配置完成能夠關機作快照
======== 完畢,呵呵呵呵 ========
附:openstack計算節點的系統環境配製方法:http://www.javashuo.com/article/p-somsizya-gh.html