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

  --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. error:no module named StringIO or cStringIO

    一般遇到没有某个模块问题的时候,通常的解决方法是pip相应的模块: 不过,鉴于Python2和python3的不同(让人头疼) 解决方法:在python3中,该模块被新的模块取代,即io. 重新imp ...

  2. DataTable转Json,Json转DataTable

    // 页面加载时 /// </summary> /// <param name="sender"></param> /// <param ...

  3. QT打开文件路径中含有中文和空格问题

    使用qt-mingw版做的软件,发给客户以后说工作不正常,配置文件无法打开,或者加载数据文件不正常.远程查看以后,发现客户经常将程序放置在中文带空格的路径下,导致文件打开不正常.所以最近想在程序上解决 ...

  4. .Net并行编程 - Reactive Extensions(Rx)并发浅析

    关于Reactive Extensions(Rx) 关于Reactive Extensions(Rx),先来看一下来自微软的官方描述: The Reactive Extensions (Rx) is ...

  5. 阿里校招内推C++岗位编程题第一题 空格最少的字符串

    给定一个字符串S和有效单词的字典D,请确定可以插入到S中的最小空格数,使得最终的字符串完全由D中的有效单词组成.并输出解. 如果没有解则应该输出n/a 例如: 输入: S = “ilikealibab ...

  6. 【转】Keepalived+Tengine实现高可用集群

    原文出处:http://502245466.blog.51cto.com/7559397/1301772 概述 近年来随着Nginx在国内的发展潮流,越来越多的互联网公司使用Nginx:凭Nginx的 ...

  7. mysql source 恢复 sql数据time_zone报错 已解决

    报了一些变量的错误,类似于"time_zone" 等错误 解决: [root@iz8vbilqy0q9v8tds55bqzz conf.d]# vi /etc/my.cnf [my ...

  8. OpenGL ES 2.0 -- 制作 3D 彩色旋转三角形 - 顶点着色器 片元着色器 使用详解

    最近开始关注OpenGL ES 2.0 这是真正意义上的理解的第一个3D程序 , 从零开始学习 . 案例下载地址 : http://download.csdn.net/detail/han120201 ...

  9. Activemq 消息类型 (转)

    Activemq消息类型JMS规范中的消息类型包括TextMessage.MapMessage.ObjectMessage.BytesMessage.和StreamMessage等五种.ActiveM ...

  10. svn checkout不包括根目录

    在后面加 “.” 即可,如下: svn co svn://127.0.0.1/ylshop/ . 转载请注明博客出处:http://www.cnblogs.com/cjh-notes/