openstack Train版本部署
节点名称 |
IP地址 |
控制节点(controller) |
192.168.30.100 |
计算节点(compute) |
192.168.30.120 |
虚拟机 x2
centos7.9镜像
openstack Train版本
两块网卡nat
基础环境
#两台虚拟机都要做---- #关闭防火墙 [root@controller ~]# systemctl stop firewalld.service #关闭防火墙开机自启 [root@controller ~]# systemctl disable firewalld.service #关闭selinux [root@controller ~]# setenforce 0
[root@controller ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: |
||
# # # |
enforcing - SELinux security policy is enforced. permissive - SELinux prints warnings instead of enforcing. disabled - No SELinux policy is loaded. |
|
SELINUX=disabled # SELINUXTYPE= can take one of three values: |
||
# # |
targeted - Targeted processes are protected, minimum - Modification of targeted policy. Only selected processes are |
|
protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted #配置网络 [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" DEVICE="ens33" |
ONBOOT="yes" IPADDR=192.168.30.100 NETMASK=255.255.255.0 GATEWAY=192.168.30.2 DNS1=114.114.114.114
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens36 DEVICE=ens36 TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none"
#配置hosts [root@compute ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.30.120 compute 192.168.30.100 controller |
[root@compute ~]# yum install chrony -y #更改配置文件 /etc/chrony.conf #更改第三行 地址为阿里云ntp服务器地址 #server ntp.aliyun.com iburst
#启动chronyd开启开机自启 [root@controller ~]# systemctl enable chronyd.service [root@controller ~]# systemctl start chronyd.service
#验证ntp [root@controller ~]# chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 203.107.6.88 2 6 17 51 +1490us[ +12ms] +/- 23ms |
#安装软件包 [root@controller ~]# yum install centos-release-openstack-train -y #安装openstack客户端 [root@controller ~]# yum install python-openstackclient -y #安装openstack-selinux 用于对openstack服务安全策略进行自动管理 [root@controller ~]# yum install openstack-selinux -y |
“#安装mariadb数据库 [root@controller ~]# yum install mariadb mariadb-server python2-PyMySQL -y |
#创建编辑数据库配置文件/etc/my.cnf.d/openstack.cnf [root@controller ~]# vim /etc/my.cnf.d/openstack.cnf #在配置文件中添加以下内容 [root@controller ~]# cat /etc/my.cnf.d/openstack.cnf [mysqld] bind-address = 192.168.30.100 #这里改成你的控制节点IP default-storage-engine = innodb innodb_file_per_table = on max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8 [root@controller ~]# #启动mariadb并设置开机自启 [root@controller ~]# systemctl enable mariadb.service Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service. Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service. Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. [root@controller ~]# systemctl start mariadb.service |
#安装rabbitmq-server软件包 [root@controller ~]# yum install rabbitmq-server -y #启动rabbitmq-server并设置开机自启 [root@controller ~]# systemctl enable rabbitmq-server.service Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq- server.service to /usr/lib/systemd/system/rabbitmq-server.service. [root@controller ~]# systemctl start rabbitmq-server.service #添加openstack用户 [root@controller ~]# rabbitmqctl add_user openstack 000000 Creating user "openstack" #授权openstack权限 [root@controller ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" Setting permissions for user "openstack" in vhost "/" |
安装缓存MomJeJuop)只需要在控制节点执行(
#安装memcachedmemcached并设置开机自启 软件包 [root@controller ~]# yum install memcached python-memcached -y #配置memcached /etc/sysconfig/memcached [root@controller ~]# cat /etc/sysconfig/memcached PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="128" OPTIONS="-l 127.0.0.1,::1,controller" #启动memcachedmemcached并设置开机自启 [root@controller ~]# systemctl enable memcached.service Created symlink from /etc/systemd/system/multi- user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service. [root@controller ~]# systemctl start memcached.service
OpenStack 平台中的 etcd 是一个分布式键值存储系统,用于存储 OpenStack 组件的配置信息。在 OpenStack 中, etcd 通常用于存储一些关键的配置信息,如网络、存储和计算等方面的配置信息。这些 信息可以被分布式地存储在多个 etcd 节点上,以提高可用性和容错性。
etcd 可以被用作 OpenStack 中的共享存储,所有的 OpenStack 组件都可以通过 etcd 存储和获取配置 信息。这样, etcd 可以提供一个中心化的配置管理系统,使得 OpenStack 组件可以更加方便地进行配置 和管理。同时, etcd 还可以提供一些高级功能,如分布式锁和事务处理等,以支持更加复杂的应用场 景。
#安装etcd软件包 [root@controller ~]# yum install etcd -y #配置etcd配置文件 /etc/etcd/etcd.conf [root@controller ~]# cat /etc/etcd/etcd.conf #[Member] ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="http://192.168.30.100:2380" ETCD_LISTEN_CLIENT_URLS="http://192.168.30.100:2379" ETCD_NAME="controller" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.30.100:2380" ETCD_ADVERTISE_CLIENT_URLS="http://192.168.30.100:2379" ETCD_INITIAL_CLUSTER="controller=http://192.168.30.100:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" ETCD_INITIAL_CLUSTER_STATE="new" #启动并设置etcd开机自启 [root@controller ~]# systemctl enable etcd Created symlink from /etc/systemd/system/multi-user.target.wants/etcd.service to /usr/lib/systemd/system/etcd.service. [root@controller ~]# systemctl start etcd |