最开始是存储的卷组受损,使用的DRBD,使用了xfs分区格式:

挂载也报错:

mount /dev/drbd0 /var/opt

mount: wrong fs type, bad option, bad superblock on /dev/drbd0,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount. helper program)

/var/log/message 报:XFS (drbd0): Corruption warning: Metadata has LSN (152:651864) ahead of current LSN (129:294808). Please unmount and run xfs_repair (>= v4.3) to resolve.

修复卷组:xfx_repair -L /dev/drbd0

访问 gitlab web是报500:

gitlab-ctl tail是看到报错:

 /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/users/sign_in","format":"html","controller":"SessionsController","action":"new","status":500,"error":"ActiveRecord::StatementInvalid: PG::InternalError: ERROR: missing chunk number 0 for toast value 127916 in pg_toast_2619\n: SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM \"users\" LIMIT 2) subquery_for_count","duration":9.1,"view":0.0,"db":2.41,"time":"2019-07-26T03:16:02.627Z","params":{},"remote_ip":"10.100.17.191","user_id":null,"username":null}

这是postgresql查询users表示报错

访问GitLab的PostgreSQL数据库,看看出什么问题了

1.登陆gitlab的安装服务查看配置文件

cat /var/opt/gitlab/gitlab-rails/etc/database.yml 

production:
adapter: postgresql
encoding: unicode
collation:
database: gitlabhq_production //数据库名
pool: 10
username: 'gitlab' //用户名
password:
host: '/var/opt/gitlab/postgresql' //主机
port: 5432
socket:
sslmode:
sslrootcert:
sslca:

查看/etc/passwd文件里边gitlab对应的系统用户

[root@localhost ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
gitlab-www:x:496:493::/var/opt/gitlab/nginx:/bin/false
git:x:495:492::/var/opt/gitlab:/bin/sh
gitlab-redis:x:494:491::/var/opt/gitlab/redis:/bin/false
gitlab-psql:x:493:490::/var/opt/gitlab/postgresql:/bin/sh //gitlab的postgresql用户

2.根据上面的配置信息登陆postgresql数据库

[root@localhost ~]# su - gitlab-psql     //登陆用户
-sh-4.1$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production 连接到gitlabhq_production库 gitlabhq_production=# \dt; // 查看表
gitlabhq_production=# select * from users; // 报如下错
ERROR:  missing chunk number 0 for toast value 127916 in pg_toast_2619

修复:

参考:https://www.postgresql.org/message-id/CAJfPOeDNcnrPLHm%3DuxO8qLL_g14-QG1O6vyLHvO20oWt0JpPgw%40mail.gmail.com

gitlabhq_production=# select 2619::regclass;
gitlabhq_production=# delete from pg_statistic;
reindex table pg_statistic;
vacuum analyze;

就这样有可以愉快的玩耍了

修复gitlab服务器突然停电导致PostgreSQL损坏的数据库的更多相关文章

  1. 服务器cpu过高修复:操作系统内核bug导致

    服务器cpu过高修复:操作系统内核bug导致修改系统内核参数/etc/sysctl.conf添加下面2条参数:vm.dirty_background_ratio=5vm.dirty_ratio=10

  2. CentOS安装gitLab服务器

    首先利用gitlab-install-el6.sh安装,比较简单: (出处:http://www.linuxidc.com/Linux/2013-06/85754.htm) 1:如果有条件,提供一台全 ...

  3. 搭建 Linux 下 GitLab 服务器

    转自:http://blog.csdn.net/passion_wu128/article/details/8216086 目录: 平台需求 硬件需求 本安装指南已于 DebianUbuntu 测试通 ...

  4. 搭建 Linux 下 GitLab 服务器(转)

    这两天因为项目需求需要搭建一个GitLab服务器,遇到了很多问题,参考了很多网络资料,终于搭建成功,在此把这个过程记录一下,利人利己. 一.最终目的 1,在Linux下创建GitLab服务器,客户端能 ...

  5. Git系列②之部署企业级开源仓库gitlab服务器

    Git系列②之部署企业级开源仓库gitlab服务器 上一篇我们介绍了github的常见使用方法,下面开始部署本地开源仓库gitlab GitLab 是一个用于仓库管理系统的开源项目. 1.安装配置gi ...

  6. 搭建 Linux 下 GitLab 服务器【转】

    转自:http://blog.csdn.net/passion_wu128/article/details/8216086 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 平台 ...

  7. mysql 5.7 停电导致无法启动、如何备份数据,重新安装mysql

    用于记录服务器停电导致,mysql启动失败后,如何备份数据,重新安装mysql,主要分为数据备份,mysql重新安装. 1.mysql无法启动时,进行数据备份. 执行:systemctl start ...

  8. 基于docer搭建私有gitlab服务器

    今天闲着无聊,于是乎想用最近很流行的docker容器搭建一个自己的gitlab的服务器,关于docker和gitlab就不多介绍了,网上查了很多资料,貌似没有一个统一的方法,很乱很杂,而且很容易误导人 ...

  9. [转]Centos 7 安装部署 GitLab 服务器

    Centos 7 安装部署 GitLab 服务器 转自:https://www.jianshu.com/p/79bfded68899 文前说明 作为码农中的一员,需要不断的学习,我工作之余将一些分析总 ...

随机推荐

  1. 【Java】《Java程序设计基础教程》第三章学习

    3.1 类 类在Java语言中是一种最基本的引用数据类型,是组成Java程序的基本要素.具有相同属性(状态)和方法(行为)的一组对象的集合称为类,其内部包括属性和方法两个主要部分. 3.11 类的定义 ...

  2. 十三.Java使用Protobuf3

    为什么使用Protobuf? 本教程翻译自谷歌开发者官网,原文地址:https://developers.google.com/protocol-buffers/docs/javatutorial.开 ...

  3. php 常用字符串函数总结

    php里面自带的字符串函数,日期函数,数组函数等,有时候可以帮助我们解决很复杂的问题,运用起来也比较简单. 下面总结了一下常用的字符串函数. addcslashes — 为字符串里面的部分字符添加反斜 ...

  4. c语言逆序

    #include <stdio.h> #define MAXS 20 void reverse( char *p ); void reverse( char *p ) { int i = ...

  5. celery retry发送的队列

    celery retry时,将发送到原有的队列,并在任务中加入执行的时间,以及当前重试的次数. worker立刻读取该任务,同时记录一条[任务]到 unacked中,表示该任务在worker中还未执行 ...

  6. c字符数组之两头堵模型

    char *其实就是char[length]的首元素地址  实验环境:centos7下qt5.11 中文char类型占3个字节 char[length]="特别车队"其实等价于ch ...

  7. hibernate之关联关系一对多

    什么是关联(association) 关联指的是类之间的引用关系.如果类A与类B关联,那么被引用的类B将被定义为类A的属性.例如:  public class B{        private St ...

  8. 【DP入门到入土】

    DP例题较多,可以根据自己需求食用~ update:下翻有状压DP入门讲解,也只有讲解了(逃~ DP的实质,就是状态的枚举. 一般用DP解决的问题,都是求计数或最优问题,所以这类问题,我们也可以用搜索 ...

  9. IIS相关的常见报错

    1.错误消息 401.3: 无权限 您无权使用您提供的凭据查看此目录或页(由于访问控制列表而导致访问被拒绝).请让 Web 服务器的管理员授予您访问“E:\IIS_Deploy\WebServices ...

  10. C语言指针的使用例子(1)指针地址的输出

    #include <stdio.h> int main(void) { int a=10; int *p = &a; *p = 89; printf("变量值a=%d a ...