由于一次误操作,将线上机器的数据库程序目录删除,虽然不影响程序的正常使用,数据也未丢失,但后面如果出现服务器宕机或数据库宕机,数据库将无法启动,而且数据库对应的编译参数也已无法查看,所以征得开发同意后,关闭数据库,重新编译数据库程序,尝试可能正确的参数。其中最重要的是关于数据大小的几个:

  --with-blocksize=BLOCKSIZE
set table block size in kB []
--with-segsize=SEGSIZE set table segment size in GB []
--with-wal-blocksize=BLOCKSIZE
set WAL block size in kB []
--with-wal-segsize=SEGSIZE
set WAL segment size in MB []

如有一个不一致,数据库程序将无法启动数据库。

  刚开始,是根据线上常见几个参数做的尝试,有几次报错,其中block size和wal blocks大小不一致的可以很简单识别,但报的错误中有报出RELSEG_SIZE不一致的,百度、google都没查到这个对应的哪个参数,好在数据都在,后面通过查看数据表的大小来确定了--with-wal-segsize大小为64,--with-segsize大小为8。

  事后,查看相关资料,发现下面几个对应关系:

XLOG_SEG_SIZE  ----  --with-wal-segsize
RELSEG_SIZE ---- --with-segsize
XLOG_BLCKSZ ---- --with-wal-blocksize
BLCKSZ ---- --with-blocksize

  感觉pg的资料还是较少,遇到一些报错的时候,只能看代码中有无说明:

  下面是在src\backend\storage\smgr\md.c中查到的说明:


The magnetic disk storage manager keeps track of open file
descriptors in its own descriptor pool. This is done to make it
easier to support relations that are larger than the operating
system's file size limit (often 2GBytes). In order to do that,
we break relations up into "segment" files that are each shorter than
the OS file size limit. The segment size is set by the RELSEG_SIZE
configuration constant in pg_config.h.

  在src\include\access\xlog_internal.h查到:

  The XLOG is split into WAL segments (physical files) of the size indicated
by XLOG_SEG_SIZE.

  编译数据库后的参数可以通过pg_controldata和pg_config查看。但由于没有了应用程序,所以也就没有了这个渠道。pg_controldata是读取的pg_control file的信息,但pg_control是二进制文件,无法查看,使用strings查看显示为空,说明其中没有可以直接打印的信息。之前了解过丢失pg_control文件如何恢复,至于从pg_control 文件恢复配置信息,后面再研究一下。

参考:

src\backend\storage\smgr\md.c

src\include\access\xlog_internal.h

The database cluster was initialized with RELSEG_SIZE 1048576, but the server was compiled with RELSEG_SIZE 8388608的更多相关文章

  1. 安装PostgreSQL数据库 ,Database Cluster 失败!

    在安装PG数据库的过程中,会选择安装目录以及数据存放目录和端口,并需要选择Local,如果全部使用默认,并且设置好自己的密码后开始安装,前期进展还比较顺利,到了安装Database Cluster时, ...

  2. Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, do

    继上一篇Hive: Exception in thread "main" java.lang.RuntimeException: Hive metastore database i ...

  3. 重新postgresql出现错误:Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed.

    以前正常使用的postgresql,今天出现问题:报*.dll错误.百度了一下,只能重新安装 . 在重新安装过程中报:Problem running post-install step. Instal ...

  4. Postgresql重安装报错The database cluster initialisation failed.

    之前安装过PostgreSQL-9.6.5,卸载后,重装PostgreSQL-9.1.3版本,报错. 清除注册表,删除postgres账户,清除垃圾后,再次安装仍然报错. 最后改变默认安装路径,神奇的 ...

  5. PostgreSQL 报错 Problem running post-install step.Installation may not complete correctlyThe database cluster initialisation failed.

    在点击完next后安装进度条到最后会弹出题目这个错误 之前选择locale选择china/Singapore 或者china/hongkong都会报错 我的解决方案是 不选择,使用默认的就不会报错,并 ...

  6. Database cannot be started in this edition of SQL Server" error when restoring a Microsoft Dynamics CRM database

    处理办法:http://support.microsoft.com/kb/2567984

  7. Postgres Plus Advanced Server installation

    # setenforce Permissive # ./ppasmeta-9.3.1.3-linux-x64.run --mode text Installation Directory [/opt/ ...

  8. [转]Amazon DynamoDB – a Fast and Scalable NoSQL Database Service Designed for Internet Scale Applications

    This article is from blog of Amazon CTO Werner Vogels. -------------------- Today is a very exciting ...

  9. [Kerberos] How to Kerberize an Hadoop Cluster

    Overview Kerberos是一个第三方认证机制,用户和服务(known as principals)通过kerberos server (known as the Key Distributi ...

随机推荐

  1. 【Python+OpenCV】人脸识别基于环境Windows+Python3 version_3(Anaconda3)+OpenCV3.4.3安装配置最新版安装配置教程

    注:本次安装因为我要安装的是win10(64bit)python3.7与OpenCV3.4.3教程(当下最新版,记录下时间2018-11-17),实际中这个教程的方法对于win10,32位又或是64位 ...

  2. eclipse注释快捷键

    1.单行注释 注释: ctrl + / 取消注释: ctrl + / 多行注释 注释: ctrl shift + / 取消注释: ctrl shift + \

  3. 使用Zabbix监控rabbitmq服务

    添加rabbitmq脚本 [root@controller rabbitmq]# cd /etc/zabbix/script/rabbitmq [root@controller rabbitmq]# ...

  4. leetcode个人题解——two sum

    这是leetcode第一题,通过较为简单. 第一题用来测试的,用的c,直接暴力法过, /** * Note: The returned array must be malloced, assume c ...

  5. Docker: 如何修改 Docker 的镜像存储位置

    我用的阿里云的服务器, 但是系统盘只有20G, 默认 Docker 的镜像文件是安装在/var/lib 目录下的, 这样的话我根本装不了太多的镜像... 这个必须得改改... 搜了下, 解决方案如下: ...

  6. 三:QJM HDFS高可用

    本文介绍的是HDFS的一种HA方案.虽然有checkpoint node \backup node等,但是不能实现自动的failover. http://hadoop.apache.org/docs/ ...

  7. canvas学习(四):高级属性

    一:阴影 示例:绘制一个带有阴影的正方形 var canvas = document.getElementById("myCanvas") var ctx = canvas.get ...

  8. Android屏幕适配解析 - 详解像素,设备独立像素,归一化密度,精确密度及各种资源对应的尺寸密度分辨率适配问题

    . 作者 :万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/19698511 . 最近遇到了一系列的屏幕适配问题, 以及 ...

  9. 最长回文子串计算(fail)

    题意: 给定一个字符串s,在s中找到最长的回文子字符串.您可以假设s的最大长度为1000. 例子: 输入: “babad” 输出: “bab” 注: “aba”也是一个有效的答案. 我的答案: 想法: ...

  10. Java容器之Map接口

    Map 接口: 1. 实现 Map 接口的类是用来存储键-值(key-value)对: 2. Map 接口的实现类有 HashMap 和 TreeMap 等: 3. Map 类中存储的键-值对,通过键 ...