解决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 ~]#

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

相关推荐
寻星探路13 小时前
【深度长文】万字攻克网络原理:从 HTTP 报文解构到 HTTPS 终极加密逻辑
java·开发语言·网络·python·http·ai·https
lly20240614 小时前
Bootstrap 警告框
开发语言
2601_9491465315 小时前
C语言语音通知接口接入教程:如何使用C语言直接调用语音预警API
c语言·开发语言
曹牧15 小时前
Spring Boot:如何测试Java Controller中的POST请求?
java·开发语言
KYGALYX15 小时前
服务异步通信
开发语言·后端·微服务·ruby
zmzb010315 小时前
C++课后习题训练记录Day98
开发语言·c++
猫头虎16 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
YUJIANYUE16 小时前
PHP纹路验证码
开发语言·php
仟濹17 小时前
【Java基础】多态 | 打卡day2
java·开发语言
孞㐑¥17 小时前
算法——BFS
开发语言·c++·经验分享·笔记·算法