文章目錄
- 一、部署OpenStack平台基礎服務
-
- 1、配置作業系統+OpenStack運作環境
- 1.1、基礎環境配置
-
- 1.11主機名
- 1.12防火牆、核心防護
- 1.13配置DNS和内網節點
- 1.14免互動
- 1.15每個節點都安裝基礎環境依賴包
- 1.15控制節點ct時間同步配置
-
- ct ->同步阿裡雲時鐘伺服器;c1、c2 -> 同步ct
- 1.6周期性計劃任務
- 2、系統環境配置
-
- 2.1安裝服務
- 2.2 開啟服務
- 2.3執行腳本
- 3、安裝RabbitMQ
-
- 3.1選擇配置:
- 4、安裝memcached
- 4.1安裝軟體
- 4.2開啟服務
- 5.安裝etcd
-
- 5.1安裝etcd
- 4.1 1.修改etcd配置檔案
- 5.2啟動服務
一、部署OpenStack平台基礎服務
1、配置作業系統+OpenStack運作環境
主機名 記憶體 硬碟 網卡 系統
ct 8 300+300 VM:192.168.10.154 NAT:192.168.35.155 CentOS7.6
c1 8 300+300 VM:192.168.10.136 NAT:192.168.35.157 CentOS7.6
C2 8 300+300 VM:192.168.10.133 NAT:192.168.35.156 CentOS7.6
1.1、基礎環境配置
1.11主機名
hostnamectl set-hostname ct
hostnamectl set-hostname c1
hostnamectl set-hostname c2
su
1.12防火牆、核心防護
systemctl stop firewalld ##關閉防火牆
systemctl disable firewalld
setenforce 0 ##核心防護
1.13配置DNS和内網節點
vi /etc/resolv.conf ##配置DNS(所有節點)
nameserver 114.114.114.114
vi /etc/hosts ##配置内網位址
192.168.10.154 ct
192.168.10.136 c1
192.168.10.133 c2
1.14免互動
三台節點做免互動
ssh-keygen -t rsa ##非對稱密鑰
ssh-copy-id ct
ssh-copy-id c1
ssh-copy-id c2
1.15每個節點都安裝基礎環境依賴包
yum -y install net-tools bash-completion vim gcc gcc-c++ make pcre pcre-devel expat-devel cmake bzip2 lrzsz
EXPAT C語言發開庫
yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils
1.15控制節點ct時間同步配置
ct ->同步阿裡雲時鐘伺服器;c1、c2 -> 同步ct
yum -y install chrony ##安裝時鐘同步服務
vi /etc/chrony.conf
server 0.centos.pool.ntp.org iburst ##注釋掉
server 1.centos.pool.ntp.org iburst ##注釋掉
server 2.centos.pool.ntp.org iburst ##注釋掉
server 3.centos.pool.ntp.org iburst ##注釋掉
server ntp1.aliyun.com iburst ###配置阿裡雲時鐘伺服器源
allow 192.168.10.0/24 ##允許192.168.10.0/24網段的主機來同步時鐘服務
systemctl restart chronyd
systemctl enable chronyd
chronyc sources ##使用chronyc指令查詢時間同步資訊
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 120.25.115.20 2 6 33 6 -341us[ -57us] +/- 23ms
- 控制節點c1、c2時間同步配置
vim /etc/chrony.conf
server 0.centos.pool.ntp.org iburst ##注釋掉
server 1.centos.pool.ntp.org iburst ##注釋掉
server 2.centos.pool.ntp.org iburst ##注釋掉
server 3.centos.pool.ntp.org iburst ##注釋掉
server ct iburst ##配置阿裡雲時鐘伺服器源
systemctl restart chronyd ##重新開機時間同步伺服器
systemctl enable chronyd ##永久開啟時間同步伺服器
chronyc sources
1.6周期性計劃任務
crontab -e ##配置計劃任務,每隔2分鐘同步一次
*/2 * * * * /usr/bin/chronyc sources >>/var/log/chronyc.log
2、系統環境配置
ct節點(192.168.10.1545)
2.1安裝服務
yum -y install mariadb mariadb-server python2-PyMySQL ##此包用于openstack的控制端連接配接mysql所需要的子產品,如果不安裝,則無法連接配接資料庫;此包隻安裝在控制端
yum -y install libibverbs ##安裝lib庫
vim /etc/my.cnf.d/openstack.cnf ##添加MySQL子配置檔案,增加如下内容
[mysqld]
bind-address = 192.168.10.154 ##控制節點區域網路位址,即本機
default-storage-engine = innodb ##預設引擎
innodb_file_per_table = on ##開啟表空間
max_connections = 4096 ##最大連接配接4096
collation-server = utf8_general_ci ##預設字元集
character-set-server = utf8
2.2 開啟服務
systemctl start mariadb ##開啟服務
systemctl enable mariadb ##開機自啟動
2.3執行腳本
mysql_secure_installation ##執行MariaDB 安全配置腳本
Enter current password for root (enter for none): ##回車
OK, successfully used password, moving on...
Set root password? [Y/n] Y ##是否需要建立密碼
Remove anonymous users? [Y/n] Y ##是否需要移除其他使用者
... Success!
Disallow root login remotely? [Y/n] N ##是否不允許root使用者遠端登陸
... skipping.
Remove test database and access to it? [Y/n] Y ##是否删除test測試庫
Reload privilege tables now? [Y/n] Y ##是否現在就重載以上的配置
3、安裝RabbitMQ
yum -y install rabbitmq-server ##下載下傳rabbitmq服務
systemctl start rabbitmq-server ##啟動RabbitMQ服務
systemctl enable rabbitmq-server ##設定其開機啟動
rabbitmqctl add_user openstack RABBIT_PASS ##建立消息隊列使用者,用于controler和 計算節點連接配接rabbitmq的認證(關聯);使用者:openstack,密碼:RABBIT_PASS
rabbitmqctl set_permissions openstack ".*" ".*" ".*" ##配置openstack使用者的操作權限(正則,配置讀寫權限);set:修改;permissions:權限
netstat -antp | grep 5672 ##可檢視25672和5672 兩個端口(5672是Rabbitmq預設端口,25672是Rabbit的測試工具CLI的端口)
3.1選擇配置:
rabbitmq-plugins list ##檢視rabbitmq插件清單;plugins:插件
rabbitmq-plugins enable rabbitmq_management ##開啟rabbitmq的web管理界面的插件,端口為15672
netstat -natp | grep 5672 ##檢查端口(25672 5672 15672)
LISTEN 0 128 *:25672 *:* users:(("beam.smp",pid=24596,fd=46))
LISTEN 0 128 :::5672 :::* users:(("beam.smp",pid=24596,fd=55))
可通路192.168.10.155:15672;賬号密碼均預設為:guest
4、安裝memcached
作用:
安裝memcached是用于存儲session資訊;服務身份驗證機制(keystone)使用Memcached來緩存令牌;在登入openstack的dashboard時,會産生一些session資訊,這些session資訊會存放到memcached緩存中;session保持會話資訊
令牌有效期是半小時
4.1安裝軟體
yum install -y memcached python-memcached ##安裝Memcached
#python-*子產品在OpenStack中起到連接配接資料庫的作用
vim /etc/sysconfig/memcached
PORT="11211" #memcached端口11211
USER="memcached" #使用者memcached
MAXCONN="1024" #最大連接配接數1024
CACHESIZE="64" #字元集大小64位
OPTIONS="-l 127.0.0.1,::1,ct" #監聽位址,127.0.0.1:本地位址,::是ipv6位址,ct是本地VMnet1位址
4.2開啟服務
systemctl start memcached
systemctl enable memcached
netstat -nautp | grep 11211
5.安裝etcd
5.1安裝etcd
etcd是一個分布式可靠的鍵值存儲系統,資料庫
控制節點ct(192.168.10.155)
4.1 1.修改etcd配置檔案
cd /etc/etcd/
vim etcd.conf
删除所有内容,複制粘貼以下内容并進行修改
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.10.154:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.10.154:2379"
ETCD_NAME="ct"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.10.154:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.10.154:2379"
ETCD_INITIAL_CLUSTER="ct=http://192.168.10.154:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
5.2啟動服務
systemctl start etcd ##開啟服務
systemctl enable etcd ##開機自啟動
netstat -anutp |grep 2379 ##檢測端口
netstat -anutp |grep 2380