Openstack计算节点安装

1、计算节点IP划分

(本机IP为172.18.2.108/172.10.2.108/192.168.1.108)

1
2
3
Eth0 172.18.2.xx 
Eth1 172.10.2.xx 管理网络
Eth2 192.168.1.xx 存储网络

2、添加源

1
2
apt install software-properties-common
add-apt-repository cloud-archive:queens

3、更新系统

1
2
3
apt update
apt upgrade
apt autoremove

4、安装基础组件

1
apt install chrony aptitude build-essential git openssh-server python-dev sudo bridge-utils debootstrap ifenslave ifenslave-2.6 lsof lvm2 tcpdump vlan apt-show-versions python python-pip parted software-properties-common python-openstackclient

(卸载程序命令:apt-get –purge remove xxxxxxxx)

5、安装KVM

1
sudo apt-get install qemu-kvm qemu-system libvirt-bin virt-manager bridge-utils vlan virt-viewer qemu-utils

6、修改网络配置

1
2
echo 'bonding' >> /etc/modules
echo '8021q' >> /etc/modules

7、修改时区

1
2
3
4
5
tzselect

(按提示操作,选择Asia、China、Shanghai)

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

8、设置NTP时间同步

(修改时间服务器为172.18.2.101)

1
2
3
vim /etc/chrony/chrony.conf
注释掉pool xxxx那行,添加以下内容:
server 172.18.2.101 iburst

添加自启动:

1
2
service chrony restart
update-rc.d chrony start 20 3 4 5

9、修改hosts

1
vim /etc/hosts
1
2
3
4
172.18.2.108    xlw-cloudcomputer-008
172.10.2.101 controller
192.168.1.103 xlw-cloudstorage-001
172.10.2.101 w-cloudcontroller-001

10、添加cephuser用户

(密码1234zxcv)

1
2
3
4
useradd -m -s /bin/bash cephuser
passwd cephuser
echo "cephuser ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/cephuser
chmod 0440 /etc/sudoers.d/cephuser

11、在controller节点上切换到cephuser用户,添加~/.ssh/config

(contaoller节点IP:172.18.2.101)

1
2
3
su - cephuser
vi ~/.ssh/config
在末尾添加本机:
1
2
3
Host xlw-cloudcomputer-008
Hostname xlw-cloudcomputer-008
User cephuser

12、在controller节点上添加hosts

1
2
vim /etc/hosts
添加:
1
2
3
172.18.2.108 xlw-cloudcomputer-008
192.168.1.108 xlw-cloudcomputer-008
172.10.2.108 xlw-cloudcomputer-008

13、在controller节点上复制ssh id到新服务器上

1
2
cd /home/cephuser/cluster/
ssh-copy-id xlw-cloudcomputer-008

试试直接ssh到新服务器是不是不需要密码:

1
ssh 172.18.2.208

14、在controller节点上安装ceph到新服务器上

1
2
ceph-deploy install --release luminous xlw-cloudcomputer-008
ceph-deploy admin xlw-cloudcomputer-008

15、在新服务器上执行

1
chmod +r /etc/ceph/ceph.client.admin.keyring

16、在新服务器上查看状态

1
ceph -s

17、新服务器上安装nova

1
apt-get install nova-compute=2:17.0.7-0ubuntu2~cloud0

18、从旧的计算节点直接复制配置文件到当前节点

1
scp -r 172.18.2.100:/etc/nova/* /etc/nova/

修改配置文件为本机IP:

1
2
3
cd /etc/nova/
find . -type f |xargs grep "172"
vim nova.conf
1
my_ip =172.10.2.108

设置权限:

1
chown -R nova:nova /var/lib/nova

重启nova服务:

1
service nova-compute restart

查看日志:

1
tail -f /var/log/nova/nova-compute.log

19、修改KVM配置

从其他节点复制/etc/libvirt/libvirtd.conf/etc/default/libvirtd /etc/default/libvirtd到本机

1
2
scp -r 172.18.2.100:/etc/libvirt/libvirtd.conf /etc/libvirt/
scp -r 172.18.2.100:/etc/default/libvirtd /etc/default/libvirtd

20、添加虚拟机的秘钥

创建secret.xml和secret1.xml文件输入以下内容:

1
vi secret.xml
1
2
3
4
5
6
<secret ephemeral='no' private='no'>
<uuid>08b21556-b8e3-4b18-bad0-b6a2f0c0fb34</uuid>
<usage type='ceph'>
<name>client.nova secret</name>
</usage>
</secret>

1
vi secret1.xml
1
2
3
4
5
6
<secret ephemeral='no' private='no'>
<uuid>1593d76a-62f5-480e-ae63-3ba112f9cabc</uuid>
<usage type='ceph'>
<name>client.cinder secret</name>
</usage>
</secret>

分别导入这两个文件:

1
2
virsh secret-define --file secret.xml
virsh secret-define --file secret1.xml

获取Base64的值:

1
2
ceph auth get-key client.nova
ceph auth get-key client.cinder

执行以下两条命令设置上Base64的值:

1
2
3
virsh secret-set-value --secret 08b21556-b8e3-4b18-bad0-b6a2f0c0fb34 --base64 AQCI3LRaknomBhAAZaMjxry36lUrBGg9AadsZA==

virsh secret-set-value --secret 1593d76a-62f5-480e-ae63-3ba112f9cabc --base64 AQDkurRaiv3gJhAANT49J9mi6GnYNADrxkQRGg==

21、拷贝配置文件

复制其他计算节点的/etc/ceph/配置文件到本地

1
scp -r 172.18.2.100:/etc/ceph/* /etc/ceph/

22、修改权限

1
2
chown -R nova:nova /etc/ceph/
chown -R nova:nova /var/lib/nova/

重启nova服务:

1
service nova-compute restart

23、安装网桥服务

1
apt install neutron-linuxbridge-agent

从其它计算节点拷贝/etc/neutron/的配置文件:

1
scp -r 172.18.2.100:/etc/neutron/ /etc/neutron/

找到所有配置并修改:

1
2
cd /etc/neutron/
find . -type f |xargs grep "172"
1
vim ./neutron/plugins/ml2/linuxbridge_agent.ini
1
local_ip = 172.10.2.108

24、重启nova服务

1
service nova-compute restart
博主QQ:1012405802
技术交流QQ群:830339411
版权声明:网站内容有原创和转载,如有侵权,请联系删除,谢谢!!
感谢打赏,93bok因你们而精彩!!(支付宝支持花呗)
0%