修复gitlab服务器突然停电导致PostgreSQL损坏的数据库
最开始是存储的卷组受损,使用的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
修复:
gitlabhq_production=# select 2619::regclass;
gitlabhq_production=# delete from pg_statistic;
reindex table pg_statistic;
vacuum analyze;
就这样有可以愉快的玩耍了
修复gitlab服务器突然停电导致PostgreSQL损坏的数据库的更多相关文章
- 服务器cpu过高修复:操作系统内核bug导致
服务器cpu过高修复:操作系统内核bug导致修改系统内核参数/etc/sysctl.conf添加下面2条参数:vm.dirty_background_ratio=5vm.dirty_ratio=10
- CentOS安装gitLab服务器
首先利用gitlab-install-el6.sh安装,比较简单: (出处:http://www.linuxidc.com/Linux/2013-06/85754.htm) 1:如果有条件,提供一台全 ...
- 搭建 Linux 下 GitLab 服务器
转自:http://blog.csdn.net/passion_wu128/article/details/8216086 目录: 平台需求 硬件需求 本安装指南已于 DebianUbuntu 测试通 ...
- 搭建 Linux 下 GitLab 服务器(转)
这两天因为项目需求需要搭建一个GitLab服务器,遇到了很多问题,参考了很多网络资料,终于搭建成功,在此把这个过程记录一下,利人利己. 一.最终目的 1,在Linux下创建GitLab服务器,客户端能 ...
- Git系列②之部署企业级开源仓库gitlab服务器
Git系列②之部署企业级开源仓库gitlab服务器 上一篇我们介绍了github的常见使用方法,下面开始部署本地开源仓库gitlab GitLab 是一个用于仓库管理系统的开源项目. 1.安装配置gi ...
- 搭建 Linux 下 GitLab 服务器【转】
转自:http://blog.csdn.net/passion_wu128/article/details/8216086 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 平台 ...
- mysql 5.7 停电导致无法启动、如何备份数据,重新安装mysql
用于记录服务器停电导致,mysql启动失败后,如何备份数据,重新安装mysql,主要分为数据备份,mysql重新安装. 1.mysql无法启动时,进行数据备份. 执行:systemctl start ...
- 基于docer搭建私有gitlab服务器
今天闲着无聊,于是乎想用最近很流行的docker容器搭建一个自己的gitlab的服务器,关于docker和gitlab就不多介绍了,网上查了很多资料,貌似没有一个统一的方法,很乱很杂,而且很容易误导人 ...
- [转]Centos 7 安装部署 GitLab 服务器
Centos 7 安装部署 GitLab 服务器 转自:https://www.jianshu.com/p/79bfded68899 文前说明 作为码农中的一员,需要不断的学习,我工作之余将一些分析总 ...
随机推荐
- 07 c++中的内联函数inline
文章链接: 问题描述:类中成员函数缺省默认是内联的,如果在类定义时就在类内给出函数定义,那当然最好.如果在类中未给出成员函数定义,而又想内联该函数的话,那在类外要加上 inline,否则就认为不是内联 ...
- vscode——tab转空格
前言 为了规范写法,开启了eslint,但是tab没设置转空格,这里记录下设置过程. 步骤 进入设置并搜索tab 配置设置 复制相应的设置 写入到json文件中 "editor.detect ...
- laravel 依赖注入
<?php interface Animal{ public function attack(); public function talk(); } class People implemen ...
- pwn第一周
源码 #include <stdio.h> #include <stdlib.h> #include <unistd.h> void setbufs() { set ...
- MySQL 必会知识
一.为什么用自增列作为主键 1.如果我们定义了主键(PRIMARY KEY),那么InnoDB会选择主键作为聚集索引. 如果没有显式定义主键,则InnoDB会选择第一个不包含有NULL值的唯一索引作为 ...
- learning java 字符串常用操作
// 字符串索引取值 "; System.)); // 字符串比较 "; "; "; System.out.println(s1.compareTo(s2)); ...
- Reed-Solomon纠错码的译码
其中用到了等比数列展开:1/(1-\alpha). 此时,似乎应该将\alpha视为模远小于1的复数. 只有这样,\alpha^i 才能作为一个有限域中的元素展开.它在一个半径小于1的圆上,由若干具 ...
- ELK教程1:ElasticSearch集群的部署ELK
在分布式系统中,应用数量众多,应用调用链复杂,常常使用ELK作为日志收集.分析和展示的组件.本篇文章将讲讲解如何部署ELK,然后讲解如何使用Filebeat采集Spring Boot的日志输出到Log ...
- linux 下终端通过证书、私钥快捷登录
ssh -i 你的证书 root@IP地址 -p 端口号 ssh -i {您的 .pem 文件的完整路径} ec2-user@{实例 IP 地址} 设置秘钥权限chmod 600 ~/.ssh/id_ ...
- 《挑战30天C++入门极限》C++运算符重载函数基础及其值返回状态
C++运算符重载函数基础及其值返回状态 运算符重载是C++的重要组成部分,它可以让程序更加的简单易懂,简单的运算符使用可以使复杂函数的理解更直观. 对于普通对象来说我们很自然的会频繁使用算数运 ...