解决openstack重启swift服务后报错

swift重启报错

问题描述

swift服务正常状态如下

bash 复制代码
[root@controller ~]# swift stat
               Account: AUTH_8bde12ff804e42498661b7454994c446
            Containers: 0
               Objects: 0
                 Bytes: 0
       X-Put-Timestamp: 1690507907.67931
           X-Timestamp: 1690507907.67931
            X-Trans-Id: tx56d22fa138ab45908caab-0064c31a82
          Content-Type: text/plain; charset=utf-8
X-Openstack-Request-Id: tx56d22fa138ab45908caab-0064c31a82
[root@controller ~]#
bash 复制代码
[root@compute ~]# lsblk
NAME                                            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                                               8:0    0  200G  0 disk
├─sda1                                            8:1    0    1G  0 part /boot
└─sda2                                            8:2    0   99G  0 part
  ├─centos-root                                 253:0    0   50G  0 lvm  /
  ├─centos-swap                                 253:1    0  3.9G  0 lvm  [SWAP]
  └─centos-home                                 253:2    0 45.1G  0 lvm  /home
sdb                                               8:16   0  100G  0 disk
├─sdb1                                            8:17   0   20G  0 part
│ ├─cinder--volumes-cinder--volumes--pool_tmeta 253:3    0   20M  0 lvm
│ │ └─cinder--volumes-cinder--volumes--pool     253:5    0   19G  0 lvm
│ └─cinder--volumes-cinder--volumes--pool_tdata 253:4    0   19G  0 lvm
│   └─cinder--volumes-cinder--volumes--pool     253:5    0   19G  0 lvm
├─sdb2                                            8:18   0   20G  0 part /swift/node/sdb2
└─sdb3                                            8:19   0   20G  0 part
sr0                                              11:0    1  4.4G  0 rom
[root@compute ~]#

重启后报错如下

bash 复制代码
[root@controller ~]# source /etc/keystone/admin-openrc.sh
[root@controller ~]# swift stat
Account HEAD failed: http://controller:8080/v1/AUTH_8bde12ff804e42498661b7454994c446 503 Service Unavailable
Failed Transaction ID: tx1bac2f2ee5fe45cda0125-0064c3c108
[root@controller ~]#

日志如下

bash 复制代码
[root@controller ~]# tail -f /var/log/swift/*
tail: cannot open '/var/log/swift/*' for reading: No such file or directory
tail: no files remaining
bash 复制代码
[root@compute ~]# lsblk
NAME                                            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                                               8:0    0  200G  0 disk
├─sda1                                            8:1    0    1G  0 part /boot
└─sda2                                            8:2    0   99G  0 part
  ├─centos-root                                 253:0    0   50G  0 lvm  /
  ├─centos-swap                                 253:1    0  3.9G  0 lvm  [SWAP]
  └─centos-home                                 253:2    0 45.1G  0 lvm  /home
sdb                                               8:16   0  100G  0 disk
├─sdb1                                            8:17   0   20G  0 part
│ ├─cinder--volumes-cinder--volumes--pool_tmeta 253:3    0   20M  0 lvm
│ │ └─cinder--volumes-cinder--volumes--pool     253:5    0   19G  0 lvm
│ └─cinder--volumes-cinder--volumes--pool_tdata 253:4    0   19G  0 lvm
│   └─cinder--volumes-cinder--volumes--pool     253:5    0   19G  0 lvm
├─sdb2                                            8:18   0   20G  0 part
└─sdb3                                            8:19   0   20G  0 part
sr0                                              11:0    1  4.4G  0 rom
loop0                                             7:0    0   20G  0 loop /swift/node
[root@compute ~]#

解决办法

实际上是因为脚本里面设置的是临时挂载,重启后会失效,只需要重新挂载即可

在swift-compute脚本里面查看脚本内容

bash 复制代码
.....
echo "/dev/$OBJECT_DISK /swift/node xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
mkdir -p /swift/node/$OBJECT_DISK
mount /dev/$OBJECT_DISK /swift/node/$OBJECT_DISK
scp $HOST_NAME:/etc/swift/*.ring.gz /etc/swift/
.......

计算节点从新挂载生效

bash 复制代码
[root@compute ~]# umount /swift/node/
[root@compute ~]# source /etc/openstack/openrc.sh
[root@compute ~]# mount /dev/$OBJECT_DISK /swift/node/$OBJECT_DISK
[root@compute ~]# lsblk
NAME                                            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                                               8:0    0  200G  0 disk
├─sda1                                            8:1    0    1G  0 part /boot
└─sda2                                            8:2    0   99G  0 part
  ├─centos-root                                 253:0    0   50G  0 lvm  /
  ├─centos-swap                                 253:1    0  3.9G  0 lvm  [SWAP]
  └─centos-home                                 253:2    0 45.1G  0 lvm  /home
sdb                                               8:16   0  100G  0 disk
├─sdb1                                            8:17   0   20G  0 part
│ ├─cinder--volumes-cinder--volumes--pool_tmeta 253:3    0   20M  0 lvm
│ │ └─cinder--volumes-cinder--volumes--pool     253:5    0   19G  0 lvm
│ └─cinder--volumes-cinder--volumes--pool_tdata 253:4    0   19G  0 lvm
│   └─cinder--volumes-cinder--volumes--pool     253:5    0   19G  0 lvm
├─sdb2                                            8:18   0   20G  0 part /swift/node/sdb2
└─sdb3                                            8:19   0   20G  0 part
sr0                                              11:0    1  4.4G  0 rom
[root@compute ~]#
bash 复制代码
├─sdb2                                            8:18   0   20G  0 part /swift/node/sdb2

控制节点验证

bash 复制代码
[root@controller ~]# source /etc/keystone/admin-openrc.sh
[root@controller ~]# swift stat
               Account: AUTH_8bde12ff804e42498661b7454994c446
            Containers: 0
               Objects: 0
                 Bytes: 0
       X-Put-Timestamp: 1690509333.32481
           X-Timestamp: 1690509333.32481
            X-Trans-Id: txcc8962b244bb4ff397885-0064c32014
          Content-Type: text/plain; charset=utf-8
X-Openstack-Request-Id: txcc8962b244bb4ff397885-0064c32014
[root@controller ~]#

还有一个办法就是直接弄成永久挂载,这样即使重启也没事

相关推荐
布莱克60533 分钟前
C/C++ 中变量的声明与定义:区别、联系与常见误区
c语言·开发语言·c++·声明·定义
LabVIEW开发42 分钟前
LabVIEW 局部变量为何引发竞争条件?四种同步机制
开发语言·labview
benchmark_cc1 小时前
A 股、港股、美股如何建立统一的标的主数据格式?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
Zenova EdgeOS3 小时前
Go 工业边缘错误处理实战:用 errors 构建可追溯错误链
开发语言·数据库·golang
取名真是3 小时前
Python 算法知识点从基础到进阶
开发语言·python·算法
FRing033 小时前
vue2干货总结3(computed计算属性、watch监听器)
开发语言·前端·vue.js·vue2
Fatbobman(东坡肘子)4 小时前
快速消失的硬盘容量 -- 肘子的 Swift 周报 #160
开发语言·人工智能·redis·ios·swiftui·iphone·swift
揽星河..4 小时前
【C语言】底层程序设计
c语言·开发语言
JavaPub-rodert4 小时前
从零搭建通用管理后台:ShiyuAdmin 的 Go、React 与 RBAC 实践
开发语言·react.js·golang
海的透彻5 小时前
dockerfile如何快速构建容器(java服务)
java·开发语言