概述: 在应用devstack时,有时会遇到下面的场景从一台安装成功的devstack服务器上复制devstack 到一台全新的服务器上。当然可以通过虚拟机复制来实现,本文介绍通过手工迁移devstack的方式进行迁移,并最大化减少软件下载时间。
1. 迁移准备
步骤1: 操作系统准备
- 准备一台安装相同的操作系统版本的服务器
- 修改国内软件源,并进行软件升级
个人建议:推荐使用阿里源,速度快些,但是从稳定性来说还是清华源。
# 具体修改源的方法参考链接- 更新源和软件
apt update
apt -y upgrade- 重新安装部分软件
apt-get install python-dev
apt-get install python-pip
pip install --upgrade pip
pip install -U os-testr
#原因见附录
步骤2:【旧服务器】迁移软件准备
- stack 整个目录,包括
tar -zcvf stack_ocata.tar.gz /opt/stack/- python软件相关软件目录
cd /usr/local/lib/
tar -zcvf python_2.7.tar.gz python2.7
注意:迁移该目录下的文件,目的是减少与pip源的交互,减少下载文件的时间
cd /usr/local/bin
tar -zcvf local_bin.tar.gz *
注意:如果不迁移/usr/local/bin 目录下的文件,在运行过程中会遇到命令找不到的情况。
步骤3: 【旧服务器】将准备好的文件上传到新的服务器
步骤4: 【新服务器】将备份文件解压到对应的目录
/usr/local/bin
/user/local/lib/python2.7
/opt/stack
步骤4: 【新服务器】创建 stack 用户,并修改新解压的目录属组
sudo useradd -s /bin/bash -d /opt/stack -m stack
chown -R stack.stack /opt/stack
2. 实施迁移
步骤1:运行安装
su - stack
cd devstack
./stack.sh
运行成功后,日志如下
步骤2:测试运行
附录
问题1
问题现象
运行过程中,遇到 ext/_yaml.c:4:20: fatal error: Python.h 错误
解决方法
sudo apt-get install python-dev
其他相同现象的链接
https://www.cnblogs.com/eating-gourd/p/8578007.html
https://blog.csdn.net/bevison/article/details/78771000
问题2:openstack: command not found
问题现象
2020-02-01 15:28:08.865 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created domain default
2020-02-01 15:28:08.902 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created project admin
2020-02-01 15:28:08.926 70425 DEBUG passlib.registry [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] registered 'sha512_crypt' handler: <class 'passlib.handlers.sha2_crypt.sha512_crypt'> register_crypt_handler /usr/local/lib/python2.7/dist-packages/passlib/registry.py:294
2020-02-01 15:28:08.948 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created user admin
2020-02-01 15:28:08.971 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created role admin
2020-02-01 15:28:08.988 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Granted admin on admin to user admin.
2020-02-01 15:28:09.000 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created region RegionOne
2020-02-01 15:28:09.040 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created admin endpoint http://192.168.221.155/identity_admin
2020-02-01 15:28:09.053 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created internal endpoint http://192.168.221.155/identity
2020-02-01 15:28:09.064 70425 INFO keystone.cmd.cli [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Created public endpoint http://192.168.221.155/identity
2020-02-01 15:28:09.068 70425 INFO keystone.assignment.core [req-b751c46e-c9bc-40fc-8299-85f7024c1474 - - - - -] Creating the default role 9fe2ff9ee4384b1894a90878d3e92bab because it does not exist.
+ ./stack.sh:main:1089 : create_keystone_accounts
+ lib/keystone:create_keystone_accounts:383 : local admin_project
++ lib/keystone:create_keystone_accounts:384 : openstack project show admin -f value -c id
/opt/stack/devstack/lib/keystone: line 384: openstack: command not found
+ lib/keystone:create_keystone_accounts:384 : admin_project=
+ lib/keystone:create_keystone_accounts:1 : exit_trap
+ ./stack.sh:exit_trap:513 : local r=127
++ ./stack.sh:exit_trap:514 : jobs -p
+ ./stack.sh:exit_trap:514 : jobs=
+ ./stack.sh:exit_trap:517 : [[ -n '' ]]
+ ./stack.sh:exit_trap:523 : kill_spinner
+ ./stack.sh:kill_spinner:409 : '[' '!' -z '' ']'
+ ./stack.sh:exit_trap:525 : [[ 127 -ne 0 ]]
+ ./stack.sh:exit_trap:526 : echo 'Error on exit'
Error on exit
+ ./stack.sh:exit_trap:527 : generate-subunit 1580541519 570 fail
+ ./stack.sh:exit_trap:528 : [[ -z /opt/stack/logs ]]
+ ./stack.sh:exit_trap:531 : /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
+ ./stack.sh:exit_trap:537 : exit 127
解决方法
重新安装python-openstackclient之后,问题解决
注意:做好【迁移准备】-【步骤2】 备份/usr/local/bin下的文件迁移,会避免该问题
问题3 generate-subunit: command not found
问题现象
很多人遇到类似的问题,百度一下一大堆。
解决方法
sudo apt-get install python-pip
sudo pip install --upgrade pip
sudo pip install -U os-testr
来源:CSDN
作者:俊男无期
链接:https://blog.csdn.net/laoshu2007/article/details/104141483