修复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 文前说明 作为码农中的一员,需要不断的学习,我工作之余将一些分析总 ...
随机推荐
- Python爬取微信公众号素材库
这是我的之前写的代码,今天发布到博客园上,说不定以后需要用. 开始: #coding:utf-8 import werobot import pymongo class Gongzhonghao( ...
- Homebrew 更新慢问题
cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/hom ...
- 关于跨域介绍和djiago解决跨域问题
什么是跨域? 跨域,指的是浏览器不能执行其他网站的脚本.它是由浏览器的同源策略造成的,是浏览器对javascript施加的安全限制. 什么是同源策略? 同源策略又分为以下两种 DOM同源策略:禁止对不 ...
- Cookie实现记住密码代码
jsp页面 <%-- Created by IntelliJ IDEA. User: 60590 Date: 2019/11/28 Time: 14:10 To change this temp ...
- codepush安装
https://github.com/lisong/code-push-server/blob/master/docs/README.md =====> 安装mysql下载mysql yum r ...
- SIGAI机器学习第十九集 随机森林
讲授集成学习的概念,Bootstrap抽样,Bagging算法,随机森林的原理,训练算法,包外误差,计算变量的重要性,实际应用 大纲: 集成学习简介 Boostrap抽样 Bagging算法 随机森林 ...
- Ubuntu下面删除和卸载软件
1.卸载nginx 1)首先执行第一条命令查出想关的软件包: dpkg --get-selections | grep nginx 2)开始执行卸载列出的common 和core 这个2个安装包 一个 ...
- 如何在Processing中用鼠标获取RGB颜色数值
要做一个抠图应用,所以随手做了个鼠标取色,代码如下: void mousePressed(){ int imgC = get(mouseX,mouseY); int R = (imgC >> ...
- CF891C Envy(离线/在线+可撤销并查集/并查集/LCT)
前置知识 最小生成树及证明 做法 每个不同权值没影响,仅需判断该次询问每种权值是否在"小于该权值的所有边加完"之后,可以全部加进来 离线:询问的所有边全堆到一起,按权值排序,然后同 ...
- java使用freemark生成word/pdf
目录 一. 背景 二.实现的技术选型以及遇到的坑 三.最终的效果 2.1 .doc word效果展示 2.1 .docx word效果展示 2.2 docx word转pdf效果展示 三.准备工作及代 ...