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

  --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. n! 阶乘

    其实1.2.3.4.6.7…都是可以不用考虑的,因此选择以5为迭代步数即可. 首先,这些数字都可以不用进行%5(对5取余数)运算,因此每次循环时可以直接将函数的count变量直接加1.其次,考虑25. ...

  2. 机器学习-聚类Clustering

    简介 前面介绍的线性回归,SVM等模型都是基于数据有标签的监督学习方法,本文介绍的聚类方法是属于无标签的无监督学习方法.其他常见的无监督学习还有密度估计,异常检测等. 聚类就是对大量未知标注的数据集, ...

  3. 零基础自学人工智能,看这些资料就够了(300G资料免费送)

    为什么有今天这篇? 首先,标题不要太相信,哈哈哈. 本公众号之前已经就人工智能学习的路径.学习方法.经典学习视频等做过完整说明.但是鉴于每个人的基础不同,可能需要额外的学习资料进行辅助.特此,向大家免 ...

  4. kafka启动出现:Unsupported major.minor version 52.0 错误

    具体的错误输出: Exception in thread "main" java.lang.UnsupportedClassVersionError: kafka/Kafka : ...

  5. linux 相关的问题

    1,查找当前目录下的文件名,并重定向到文件t中 ls > t mac 下快速补全目录名快捷键tab

  6. canvas drawImage 不显示

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. java计算某日期之后的日期

    public static void main(String[] args) { // 时间表示格式可以改变,yyyyMMdd需要写例如20160523这种形式的时间 SimpleDateFormat ...

  8. opencv 和 parfor

    一次遇到两个不熟悉的,因此在一起记一下. OpenCV的全称是:Open Source Computer Vision Library. OpenCv是一个基于(开源)发行的跨平台计算机视觉库,可以运 ...

  9. CS6的安装与破解

    大家在Mac下肯定也少不了对图片进行修改,那也就少不了Photoshop这款软件. 今天在这里分享下苹果下的Adobe PhotoshopCS6,这个软件大家应该都很熟悉,主要功能什么我就不多做介绍了 ...

  10. AC自动机裸题

    HDU 2222 Keywords Search 模板题.对模式串建立AC自动机然后在trie树上找一遍目标串即可. # include <cstdio> # include <cs ...