openstack (xiandian v2.4)
基础配置
双节点:
- controller (192.168.100.10)
- compute (192.168.100.20)
CentOS版本:
- CentOS-7-x86_64-DVD-1804.iso
openstack版本:
- xiandian v2.4 (Queens 二次开发)
openstack文档:
拓扑
环境变量
密码名称 | 描述 |
---|---|
Database password | 数据库的根密码 |
ADMIN_PASS | ADMIN 用户密码 |
CINDER_DBPASS | 块存储服务的数据库密码 |
CINDER_PASS | 块存储服务用户密码 |
DASH_DBPASS | 仪表板的数据库密码 |
DEMO_PASS | DEMO 用户密码 |
GLANCE_DBPASS | 影像服务的数据库密码 |
GLANCE_PASS | 图片服务用户密码 |
KEYSTONE_DBPASS | 身份服务的数据库密码 |
METADATA_SECRET | 元数据代理的秘密 |
NEUTRON_DBPASS | 网络服务的数据库密码 |
NEUTRON_PASS | 网络服务用户密码 |
NOVA_DBPASS | 计算服务的数据库密码 |
NOVA_PASS | 计算服务用户密码 |
PLACEMENT_PASS | 展示位置服务用户的密码 |
RABBIT_PASS | RabbitMQ 用户密码 |
基础环境(平台初始化)
1.网络
网卡文件:/etc/sysconfig/network-scripts/ifcfg-eth*
【controller】
eth0
echo "DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.100.10
PREFIX=24
GATEWAY=192.168.100.1"\
> /etc/sysconfig/network-scripts/ifcfg-eth0
eth1
echo "DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.200.10
PREFIX=24
> /etc/sysconfig/network-scripts/ifcfg-eth1
修改控制节点 主机名
hostnamectl set-hostname controller
bash
【compute】
eth0
echo "DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.100.20
PREFIX=24
GATEWAY=192.168.100.1"\
> /etc/sysconfig/network-scripts/ifcfg-eth0
eth1
echo "DEVICE=enp9s0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.200.20
PREFIX=24"\
> /etc/sysconfig/network-scripts/ifcfg-eth1
修改计算节点 主机名
hostnamectl set-hostname compute
bash
注:eth0 为内部管理网络, eth1为外部网络(node节点使用)
2.yum源
使用本地yum 源,yum源仓库位于 controlle节点
-
yum源备份
mv /etc/yum.repos.d/* /opt
-
创建 repo 文件
【controller】
echo "[centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1 [iaas] name=iaas baseurl=file:///opt/iaas-repo gpgcheck=0 enabled=1"\ > /etc/yum.repos.d/centos.repo
【compute 】
echo "[centos] name=centos baseurl=ftp://192.168.100.10/centos gpgcheck=0 enabled=1 [iaas] name=iaas baseurl=ftp://192.168.100.10/iaas-repo gpgcheck=0 enabled=1"\ > /etc/yum.repos.d/centos.repo
-
将镜像通过 xftp,上传到 controller
-
挂载 iso 文件
挂载 CentOS-7-x86_64-DVD-1804.iso
mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt/ mkdir /opt/centos cp -rvf /mnt/* /opt/centos/ umount /mnt/
挂载 chinaskills_cloud_iaas.iso
mount -o loop chinaskills_cloud_iaas.iso /mnt/ cp -rvf /mnt/* /opt/ umount /mnt/
-
搭建 ftp 服务器,开启并设置自启
yum install vsftpd -y echo 'anon_root=/opt/' >> /etc/vsftpd/vsftpd.conf systemctl start vsftpd systemctl enable vsftpd
-
清除缓存,验证 yum 源
yum clean all yum repolist
3.防火墙 & Selinux
【controller/compute】
编辑 selinux 文件
vi /etc/selinux/config
SELINUX=permissive
关闭防火墙并设置开机不自启
systemctl stop firewalld.service
systemctl disable firewalld.service
yum remove -y NetworkManager firewalld
yum -y install iptables-services
systemctl enable iptables
systemctl restart iptables
iptables -F
iptables -X
iptables -Z
service iptables save
4.环境变量
【controller/compute】
echo "HOST_IP=192.168.100.10
HOST_PASS=000000
HOST_NAME=controller
HOST_IP_NODE=192.168.10.10
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/192.168.100.20
INTERFACE_NAME=eth1
Physical_NAME=provider
minvlan=101
maxvlan=200
CINDER_DBPASS=000000
CINDER_PASS=000000
BLOCK_DISK=md126p4
SWIFT_PASS=000000
OBJECT_DISK=md126p5
STORAGE_LOCAL_NET_IP=192.168.10.10
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"\
> /etc/xiandian/openrc.sh
5.openstack包 安装
【controller/compute】
yum -y install openstack-utils openstack-selinux python-openstackclient
yum upgrade
配置域名解析
echo "192.168.100.10 controller
192.168.100.20 compute"\
> /etc/hosts
6.时间同步
-
安装 chrony
【controller/compute】
yum install -y chrony
-
修改配置
【controller】
编辑/etc/chrony.conf 文件 添加以下内容(删除默认 sever 规则) server controller iburst allow 192.168.100.0/24 local stratum 10
【compute】
编辑/etc/chrony.conf 文件 添加以下内容(删除默认 sever 规则) server controller iburst
-
启动 ntp 服务器
systemctl restart chronyd systemctl enable chrony
7.数据库 (Mysql)
【controller】
-
安装 mysql 服务
yum install -y mariadb mariadb-server python2-PyMySQL
-
修改配置文件
vim /etc/my.cnf # 修改 /etc/my.cnf 文件[mysqld]中添加 max_connections=10000 default-storage-engine = innodb innodb_file_per_table collation-server = utf8_general_ci init-connect = 'SET NAMES utf8' character-set-server = utf8
-
启动服务
systemctl enable mariadb.service systemctl start mariadb.service
-
修改 mariadb.service 参数
vim /usr/lib/systemd/system/mariadb.service [Service] # 新添加两行如下参数 LimitNOFILE=10000 LimitNPROC=10000
-
修改 auth_gssapi.cnf 参数
vim /etc/my.cnf.d/auth_gssapi.cnf [mariadb] # 注释一行参数 #plugin-load-add=auth_gssapi.so
-
重新加载系统服务,并重启 mariadb 服务
systemctl daemon-reload service mariadb restart
-
配置 Mysql
mysql_secure_installation 按 enter 确认后设置数据库 root 密码 Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
【compute】
-
安装 MySQL-python
yum -y install MySQL-python
8.消息队列 (RabbitMQ)
【controller】
-
安装 RabbitMQ 服务
yum install -y rabbitmq-server systemctl enable rabbitmq-server.service systemctl restart rabbitmq-server.service rabbitmqctl add_user openstack 000000 rabbitmqctl set_permissions openstack ".*" ".*" ".*"
9.令牌缓存 (memcahce)
【controller】
-
安装 memcahce 服务
yum install memcached python-memcached systemctl enable memcached.service systemctl restart memcached.service
10.etcd 服务
【controller】
-
安装 etcd 服务
yum install etcd –y
-
修改 etcd.conf 配置文件
vim /etc/etcd/etcd.conf ETCD_LISTEN_PEER_URLS="http://192.168.100.10:2380" ETCD_LISTEN_CLIENT_URLS="http://192.168.100.10:2379" ETCD_NAME="controller" ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.100.10:2380" ETCD_ADVERTISE_CLIENT_URLS="http://192.168.100.10:2379" ETCD_INITIAL_CLUSTER="controller=http://192.168.100.10:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" ETCD_INITIAL_CLUSTER_STATE="new"
-
启动服务
systemctl start etcd systemctl enable etcd
评论