最开始是存储的卷组受损,使用的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. dt6.0之mip改造-img正则替换mip-img

    最近没事,打算把自己的小项目改造为mip,进行测试学习,想把资讯栏目:http://zhimo.yuanzhumuban.cc/news/.全部改造为mip.但是MIP改造一项是:图片标签的改造.而且 ...

  2. 学习Kubernetes,这些负载均衡知识点得知道!

    负载均衡 负载均衡是高可用架构的一个关键组件,主要用来提高性能和可用性,通过负载均衡将流量分发到多个服务器,同时多服务器能够消除这部分的单点故障. 一个没有使用负载均衡的Web架构一般会长得像这样: ...

  3. 神经网络(13)--具体实现:random initialization

    Θ应初始化为什么值 当我们是用logistic regression算法时,将θ初始化为0是可以的:但是如果在神经网络里面,将θ初始化为0是不可行的 若将Θ初始化为0的后果-the problem o ...

  4. 神经网络(10)--有助于对神经网络Backpropagation算法的理解

    为了更好的理解backpropagation,先来了解一下forward propagation的内部 我们在forward propagation中计算Z1(3)的方法与在back propagat ...

  5. 【IT】在线技术工具

    1.IP地址查询: (1)http://www.ip138.com/ 注:可查询此IP地址的服务器归属地 (2)https://x.threatbook.cn/ 注:可查询域名.ip等的反查域名 2.

  6. 金蝶K3表

    系统ID     表ID     表名     表中文名     表说明     FType     FSefDefSign0     0     t_VoucherGroup     凭证字表    ...

  7. Mac OpenSSL 生成支付宝 2048位密钥

    安装OpenSSL: brew install openssl 然后: OpenSSL> genrsa -out rsa_private_key.pem 2048 #生成私钥 OpenSSL&g ...

  8. UVA 1672不相交的正规表达式

    题意 输入两个正规表达式,判断两者是否相交(即存在一个串同时满足两个正规表达式).本题的正规表达式包含如下几种情况: 单个小写字符 $c$ 或:($P | Q$). 如果字符串 $s$ 满足 $P$ ...

  9. [NgRx] Optimistically Editing Entity Data

    First thing first, let's define a action to update entity: import { createAction, props } from " ...

  10. C# 异步的简单用法

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...