openstack-部署一个新的计算节点

听闻少年二字,当与平庸相斥。这篇文章主要讲述openstack-部署一个新的计算节点相关的知识,希望能为你提供帮助。
【openstack-部署一个新的计算节点】?1.准备文件?

#1.
[root@node1 yum.repos.d]# tar czvf openstack-yum.tar.gz ./*
[root@node1 ~]# cd /usr/local/src/
[root@node1 src]# cp /etc/sysctl.conf .
[root@node1 src]# cp /etc/security/limits.conf .
[root@node1 src]# cp /etc/yum.repos.d/openstack-yum.tar.gz .


#2.
[root@node1 ~]# cd /etc/nova/
[root@node1 nova]# tar czvf nova-computer.tar.gz ./*
[root@node1 nova]# scp nova-computer.tar.gz/usr/local/src/
需要修改
[root@node1 nova]# grep 192.168.47.26 ./*
./nova.conf:server_proxyclient_address = 192.168.47.26


#3.
[root@node1 nova]# cd /etc/neutron/
[root@node1 neutron]# tar czvf neutron-computer.tar.gz ./*
[root@node1 neutron]# scp neutron-computer.tar.gz/usr/local/src/

#准备文件
[root@node1 src]# ll
total 136
-rw-r--r-- 1 root root2895 Apr3 14:27 limits.conf
-rw-r--r-- 1 root root24412 Apr3 14:32 neutron-computer.tar.gz
-rw-r--r-- 1 root root 101731 Apr3 14:28 nova-computer.tar.gz
-rw-r--r-- 1 root root3423 Apr3 14:41 openstack-yum.tar.gz
-rw-r--r-- 1 root root2232 Apr3 14:26 sysctl.conf

?2.添加node脚本?
#!/bin/bash
DIR=`pwd`
NOVA_FILE="nova-computer.tar.gz"
NEUTRON_FILE="neutron-computer.tar.gz"

#系统优化
echo "配置本地yum源"
\\rm -rf /etc/yum.repos.d/*
tar xf $DIR/openstack-yum.tar.gz-C /etc/yum.repos.d/
yum makecach
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum install centos-release-openstack-rocky -y
echo "yum源设置完成,开始安装基础命令、nova和neutron服务" & & sleep 1
echo "配置内核参数和系统优化" & & sleep 1
cat $DIR/limits.conf > /etc/security/limits.conf
cat $DIR/sysctl.conf > /etc/sysctl.conf

#第二部分
echo "系统优化完成,开始安装基础命令" & & sleep 1
yum install -y vim wget treelrzsz gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop ntpdate

echo "安装nova服务" & & sleep 1
yum install openstack-nova-compute-y

echo "安装neutron 服务" & & sleep
yum install openstack-neutron-linuxbridge ebtables ipset -y

echo "与ntp服务器同步系统时间" & & sleep 1
/usr/sbin/ntpdatetime3.aliyun.com & & hwclock --systohc
echo "当前系统时间",`date "+%Y年%m月%d日 %H点%M分%S秒"`
echo "设置时间定时同步" & & sleep 1
echo "*/30 * * * */usr/sbin/ntpdate time3.aliyun.com & & hwclock --systohc > /dev/null 2> & 1" > > /var/spool/cron/root
systemctlrestart crond

#第三部分
echo "nova配置文件" & & sleep 1
tar xvf $DIR/nova-computer.tar.gz-C /etc/nova/
echo "替换nova配置文件中IP地址" & & sleep 1
HOST_IP=`ifconfigeth0 | grep inet | head -n1 | awkprint $2`
echo "当前计算节点服务器IP为 $HOST_IP,即将写入nova配置文件" & & sleep 1
sed -i "s/server_proxyclient_address = 192.168.47.26/server_proxyclient_address = $HOST_IP/g" /etc/nova/nova.conf
echo "启动nova服务"
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
echo "启动nova服务启动完成!" & & sleep 1

echo "neutron服务配置" & & sleep 1
tar xvf $DIR/neutron-computer.tar.gz-C /etc/neutron/
echo "启动neutron服务"
systemctl startneutron-linuxbridge-agent.service
systemctl enableneutron-linuxbridge-agent.service

echo "计算节点安装完成,请查看相关日志或在OpenStack 管理界面确认计算服务是否自动添加"

?3.客户端测试?
[root@control1 ~]# neutron agent-list
[root@control1 ~]# nova service-list


创建虚拟机提示如下错误

手动去发现计算节点
[root@control1 ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting computes from cell cell1: 39b5f8c3-bc9c-443d-87ad-5c687a7d87ad
Checking host mapping for compute host node2: 4ff5ef82-5b54-40e5-af0b-f0b34f2f9f5f
Creating host mapping for compute host node2: 4ff5ef82-5b54-40e5-af0b-f0b34f2f9f5f
Found 1 unmapped computes in cell: 39b5f8c3-bc9c-443d-87ad-5c687a7d87ad

[root@control1 ~]# openstack hypervisor list
+----+---------------------+-----------------+---------------+-------+
| ID | Hypervisor Hostname | Hypervisor Type | Host IP| State |
+----+---------------------+-----------------+---------------+-------+
|1 | node1| QEMU| 192.168.47.26 | up|
|2 | node2| QEMU| 192.168.47.27 | up|
+----+---------------------+-----------------+---------------+-------+



    推荐阅读