OpenStack multi-node manual deployment

1. Basic environment configuration

1.1 OpenStack environment configuration

CPU name RAM hard disk Network card
controller 8G 30G+1024G VNet1: 192.168.100.100 NAT: 20.0.0.100
compute1 8G 30G+1024G VNet1: 192.168.100.101 NAT: 20.0.0.101
compute2 8G 30G+1024G VNet1: 192.168.100.102 NAT: 20.0.0.102

[Deployment ideas]

一、配置操作系统+OpenStack运行环境
二、配置OpenStack平台基础服务(rabbitmq、mariadb、memcache、Apache)
三、配置OpenStack keystone组件
四、配置OpenStack Glance组件
五、配置placement服务
六、配置OpenStack Nova组件
七、配置OpenStack Neutron组件
八、配置OpenStack dashboard组件
九、配置OpenStack Cinder组件
十、常用云主机操作

Linux system: Minimize the installation of CentOS7.6

1.2 Basic environment configuration

Configuration items (all nodes):

  1. CPU name
hostnamectl set-hostname <主机名>
bash
  1. Firewall, core protection
systemctl disable firewalld
systemctl stop firewalld
setenforce 0
vi /etc/selinux/config
SELINUX=disabled
  1. No interaction
  • Add hosts file
vi /etc/hosts
192.168.100.100  controller
192.168.100.101  compute1
192.168.100.102  compute2
PS:以上为局域网IP
  • Asymmetric key
ssh-keygen -t rsa	
ssh-copy-id controller
ssh-copy-id compute1
ssh-copy-id compute2
  1. Base environment dependency package
yum -y install net-tools bash-completion vim gcc gcc-c++ make pcre  pcre-devel expat-devel cmake  bzip2 
yum -y install centos-release-openstack-train python-openstackclient openstack-selinux openstack-utils

5. Time synchronization

  • Controller node configuration
yum install chrony -y
vim /etc/chrony.conf 
3 #server 0.centos.pool.ntp.org iburst
4 #server 1.centos.pool.ntp.org iburst
5 #server 2.centos.pool.ntp.org iburst
6 #server 3.centos.pool.ntp.org iburst
7 server ntp.aliyun.com iburst      '  //iburst:一次发8个包而不是一个包  '
17 rtcsync       '  自动同步时间,比ntpdate方便   '
27 allow 192.168.100.0/24       
' 注释掉3~6行,添加第7行  '
systemctl enable chronyd
systemctl restart chronyd
  • Use the chronyc sources command to query time synchronization information
chronyc sources

The time synchronization settings of compute1 and compute2 nodes are basically the same, just specify the synchronization source as the controller.

yum install chrony -y
vim /etc/chrony.conf 
server controller iburst
systemctl enable chronyd
systemctl restart chronyd
chronyc sources

Two, OpenStack system environment configuration

Configuration service (control node):

2.1 Install and configure MariaDB

  1. Install Mariadb and necessary environment
yum -y install mariadb mariadb-server python2-PyMySQL
#此包用于openstack的控制端连接mysql所需要的模块,如果不安装,则无法连接数据库;此包只安装在控制端
 yum -y install libibverbs	  
'    // A library and drivers for direct userspace use of RDMA (InfiniBand/iWARP/RoCE) hardware  '
  1. Add MySQL sub-configuration file, add the following content
vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.100.100
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
  1. Auto-start at boot, start service
systemctl enable mariadb
systemctl start mariadb
  1. Execute MariaDB security configuration script to initialize mariadb interactively
mysql_secure_installation
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
 ... skipping.
Remove test database and access to it? [Y/n] Y 
Reload privilege tables now? [Y/n] Y 	

2.2 Install and configure RabbitMQ

All instructions for creating a virtual machine will be sent from the control end to rabbitmq, and the node node monitors rabbitmq

  1. Install RabbitMQ
yum -y install rabbitmq-server
  1. Start the RabbitMQ service and set it to start at boot.
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
  1. Create MQ (message queue) user "openstack" for authentication of rabbitmq connection between controller and node node
rabbitmqctl add_user openstack RABBIT_PASS
  1. Configure the operating permissions of openstack users (regular, configure read and write permissions)
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
'  //Rabbitmq set_permissions [-p <vhost>] <user> <conf> <write> <read>  '

#You can view the two ports 25672 and 5672 (5672 is the default port of Rabbitmq, and 25672 is the port of Rabbit's test tool CLI)

  1. Check the list of rabbitmq plug-ins, open the plug-in of rabbitmq web management interface
rabbitmq-plugins list
rabbitmq-plugins enable rabbitmq_management
netstat -anptu | grep 5672

Use 192.168.100.100:15672 or 20.0.0.100 to access RabbitMQ. The
default account and password are guest.
Insert picture description here
Insert picture description here

2.3 Install memcached

  • effect

    • Install memcached to store session information service
    • The authentication mechanism uses Memcached to cache the token. When logging in to the openstack dashboard, some session information will be generated, which will be stored in memcached
  • Install Memcached

yum install -y memcached python-memcached
'   //python-*模块在OpenStack中起到连接数据库的作用  '
  • Modify Memcached configuration file
vim /etc/sysconfig/memcached 
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1,controller"     '  //仅添加controller    '
  • Auto start
systemctl enable memcached
systemctl start memcached
netstat -nautp | grep 11211

2.4 Install and configure etcd

  1. Install etcd
yum -y install etcd
  1. Modify etcd configuration file
vim /etc/etcd/etcd.conf 
1 #[Member]
3 ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
5 ETCD_LISTEN_PEER_URLS="http://192.168.100.100:2380"
6 ETCD_LISTEN_CLIENT_URLS="http://192.168.100.100:2379"	
9 ETCD_NAME="controller"	
19 #[Clustering]
20 ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.100.100:2380"
21 ETCD_ADVERTISE_CLIENT_URLS="http://192.168.100.100:2379
26 ETCD_INITIAL_CLUSTER="controller=http://192.168.100.100:2380"	
27 ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"		#集群唯一标识
28 ETCD_INITIAL_CLUSTER_STATE="new"   #初始集群状态,new为静态,若为existing,则表示此ETCD服务将尝试加入已有的集群
若为DNS,则表示此集群将作为被加入的对象
  1. Start automatically after boot, open service, detect port
systemctl enable etcd.service
systemctl start etcd.service
netstat -anutp |grep 2379
netstat -anutp |grep 2380

Guess you like

Origin blog.csdn.net/qq_46480020/article/details/112981477