解决openstack重启swift服务后报错

swift重启报错

    • 问题描述
    • 解决办法

问题描述

swift服务正常状态如下

[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 ~]#
[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 ~]#

重启后报错如下

[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 ~]#

日志如下

[root@controller ~]# tail -f /var/log/swift/*
tail: cannot open ‘/var/log/swift/*’ for reading: No such file or directory
tail: no files remaining
[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脚本里面查看脚本内容

.....
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/
.......

计算节点从新挂载生效

[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 ~]#
├─sdb2                                            8:18   0   20G  0 part /swift/node/sdb2

控制节点验证

[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 ~]#

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

你可能感兴趣的:(私有云(openstack),openstack,swift,开发语言)