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

  --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学习笔记04 --------------基本运算符

    1.算数运算 + 加 - 减 * 乘 /   除 % 取模(先做除法,然后返回余数) ** 乘方(幂运算) //          取整(相除,然后返回商的整数部分) 2.比较运算(返回布尔值) == ...

  2. 博客更换至 www.zhaoch.top

    博客更换至 www.zhaoch.top 随手拷了一些链接 http://www.zhaoch.top/操作系统/linux/常用命令备忘.html http://www.zhaoch.top/操作系 ...

  3. Memcache的客户端连接系列(三) C++

    关键词: Memcached   C++ 客户端 声明:本文并非原创,转自华为云帮助中心的分布式缓存服务(Memcached)的用户指南.客户端连接方法通用,故摘抄过来分享给大家. C++客户端示例 ...

  4. dice2win早期版本

    原理; https://medium.com/dapppub/fairdicedesign-315a4e253ad6 早期版本地址: https://etherscan.io/address/0xD1 ...

  5. MySQL Proxy使用

    使用MySQL将读写请求转接到主从Server. 一 安装MySQL Proxy MySQL Proxy的二进制版非常方便,下载解压缩后即用. 解压缩的目录为: $mysql-proxy_instal ...

  6. 《javascript模式--by Stoyan Stefanov》书摘--函数

    三.函数 1.函数的命名属性 // IE下不支持name属性 var foo = function bar () { // todo }; foo.name; // "bar" 2 ...

  7. Bad Cowtractors(最大生成树)

      Description Bessie has been hired to build a cheap internet network among Farmer John's N (2 <= ...

  8. Thunder团队第一周 - Scrum会议4

    Scrum会议4 小组名称:Thunder 项目名称:爱阅app Scrum Master:代秋彤 工作照片: 参会成员: 王航:http://www.cnblogs.com/wangh013/ 李传 ...

  9. lintcode-197-排列序号

    197-排列序号 给出一个不含重复数字的排列,求这些数字的所有排列按字典序排序后该排列的编号.其中,编号从1开始. 样例 例如,排列 [1,2,4] 是第 1 个排列. 思路 参考http://www ...

  10. 相机上的P,S,A,M分别是什么单词的缩写?

    程序曝光 Programmed Auto快门优先 Shutter Priority光圈优先 aperture-priority 全手动模式 Manual Mode