一.备份
####需要备份数据库和以下文件夹
mysqldump -- opt -- all- databases > openstack. sql
/ etc/ chrony. conf
/ etc/ my. cnf. d/ openstack. cnf
/ etc/ sysconfig/ memcached
/ etc/ etcd/ etcd. conf
/ etc/ httpd/ conf/ httpd. conf
/ etc/ placement/ placement. conf
/ etc/ httpd/ conf. d/ 00 - placement- api. conf
/ etc/ nova
/ var / log/ nova
/ var / lib/ nova
/ var / lib/ glance
/ etc/ glance
/ var / log/ glance
/ etc/ keystone
/ var / log/ keystone
/ var / lib/ keystone
/ etc/ cinder
/ var / log/ cinder
/ var / lib/ cinder
/ etc/ neutron
/ var / log/ neutron
/ var / lib/ neutron
备份脚本
vi bak. sh
#/ bin/ bash
#### / var / lib/ glance下的镜像文件较大,可单独备份
echo - ne '' '
/ etc/ chrony. conf
/ etc/ my. cnf. d/ openstack. cnf
/ etc/ sysconfig/ memcached
/ etc/ etcd/ etcd. conf
/ etc/ httpd/ conf/ httpd. conf
/ etc/ placement/ placement. conf
/ etc/ httpd/ conf. d/ 00 - placement- api. conf
/ etc/ nova
/ var / log/ nova
/ var / lib/ nova
/ etc/ glance
/ var / log/ glance
/ etc/ keystone
/ var / log/ keystone
/ var / lib/ keystone
/ etc/ cinder
/ var / log/ cinder
/ var / lib/ cinder
/ etc/ neutron
/ var / log/ neutron
/ var / lib/ neutron
'' ' | while read line; do rsync - azR -- progress $line / opt/ ; rsync - az -- progress / opt
二.恢复
1.初始环境安装
yum install chrony
yum install centos- release- openstack- train - y
yum install https: / / rdoproject. org/ repos/ rdo- release. rpm - y
yum upgrade - y
yum install python- openstackclient openstack- selinux - y
yum install mariadb mariadb- server python2- PyMySQL - y
yum install rabbitmq- server - y
yum install memcached python- memcached - y
yum install etcd - y
yum install openstack- keystone httpd mod_wsgi - y
yum install openstack- glance - y
yum install openstack- placement- api - y
yum install - y openstack- nova- api openstack- nova- conductor \
openstack- nova- novncproxy openstack- nova- scheduler
yum install - y openstack- neutron openstack- neutron- ml2 \
openstack- neutron- linuxbridge ebtables
yum install openstack- cinder - y
echo 'net. bridge. bridge- nf- call- iptables= 1
net. bridge. bridge- nf- call- ip6tables= 1 ' >> / etc/ sysctl. conf
modprobe br_netfilter
sysctl - p
2.恢复备份文件
1. 恢复脚本:
vi recover. sh
#/ bin/ bash
echo - ne '' '
/ etc/ chrony. conf
/ etc/ my. cnf. d/ openstack. cnf
/ etc/ sysconfig/ memcached
/ etc/ etcd/ etcd. conf
/ etc/ httpd/ conf/ httpd. conf
/ etc/ placement/ placement. conf
/ etc/ httpd/ conf. d/ 00 - placement- api. conf
/ etc/ nova
/ var / log/ nova
/ var / lib/ nova
/ etc/ glance
/ var / log/ glance
/ etc/ keystone
/ var / log/ keystone
/ var / lib/ keystone
/ etc/ cinder
/ var / log/ cinder
/ var / lib/ cinder
/ etc/ neutron
/ var / log/ neutron
/ var / lib/ neutron
'' ' | while read line; do rsync - azR -- progress $line / mnt/ tmp/ && rsync - az root@192.168 .5 .35 : / opt/ / ; done
####恢复后注意检查,配置文件和日志文件的权限,文件属主关系,不然启动服务器会有异常报错
2.
ln - s / usr/ share/ keystone/ wsgi- keystone. conf / etc/ httpd/ conf. d/
ln - s / etc/ neutron/ plugins/ ml2/ ml2_conf. ini / etc/ neutron/ plugin. ini
3.恢复数据库
systemctl enable chronyd. service
systemctl start chronyd. service
systemctl status chronyd. service
systemctl enable mariadb. service
systemctl start mariadb. service
systemctl status mariadb. service
mysql < / openstack. sql
5.启动服务
systemctl enable rabbitmq- server. service
systemctl start rabbitmq- server. service
systemctl status rabbitmq- server. service
rabbitmqctl add_user openstack RABBIT_PASS
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
rabbitmqctl set_user_tags openstack administrator
systemctl enable memcached. service
systemctl start memcached. service
systemctl status memcached. service
systemctl enable etcd
systemctl start etcd
systemctl status etcd
systemctl enable httpd. service
systemctl start httpd. service
systemctl status httpd. service
systemctl enable openstack- glance- api. service
systemctl start openstack- glance- api. service
systemctl status openstack- glance- api. service
systemctl enable \
openstack- nova- api. service \
openstack- nova- scheduler. service \
openstack- nova- conductor. service \
openstack- nova- novncproxy. service
systemctl start \
openstack- nova- api. service \
openstack- nova- scheduler. service \
openstack- nova- conductor. service \
openstack- nova- novncproxy. service
systemctl status \
openstack- nova- api. service \
openstack- nova- scheduler. service \
openstack- nova- conductor. service \
openstack- nova- novncproxy. service
systemctl enable neutron- server. service \
neutron- linuxbridge- agent. service neutron- dhcp- agent. service \
neutron- metadata- agent. service
systemctl start neutron- server. service \
neutron- linuxbridge- agent. service neutron- dhcp- agent. service \
neutron- metadata- agent. service
systemctl status neutron- server. service \
neutron- linuxbridge- agent. service neutron- dhcp- agent. service \
neutron- metadata- agent. service
systemctl enable openstack- cinder- api. service openstack- cinder- scheduler. service
systemctl start openstack- cinder- api. service openstack- cinder- scheduler. service
systemctl status openstack- cinder- api. service openstack- cinder- scheduler. service
####多注意各个服务状态
6.检查
1. 服务,和文件属组,权限,是否正常
2. 查看各个服务状态
openstack server list
openstack endpoint list
openstack compute service list
rabbitmqctl list_users
curl http: / / controller: 8778
curl http: / / controller: 5000 / v3
systemctl status chronyd. service
systemctl status rabbitmq- server. service
systemctl status memcached. service
systemctl status etcd
systemctl status httpd. service
systemctl status openstack- glance- api. service
systemctl status \
openstack- nova- api. service \
openstack- nova- scheduler. service \
openstack- nova- conductor. service \
openstack- nova- novncproxy. service
计算节点:
systemctl status neutron- server. service \
neutron- linuxbridge- agent. service neutron- dhcp- agent. service \
neutron- metadata- agent. service
systemctl status openstack- cinder- api. service openstack- cinder- scheduler. service