Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hVcXu-00067J-IK for pgsql-general@arkaria.postgresql.org; Tue, 28 May 2019 13:53:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hVcXs-0000jU-2e for pgsql-general@arkaria.postgresql.org; Tue, 28 May 2019 13:53:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hVcXq-0000fk-RI for pgsql-general@lists.postgresql.org; Tue, 28 May 2019 13:53:39 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hVcXn-0004D2-N6 for pgsql-general@lists.postgresql.org; Tue, 28 May 2019 13:53:37 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B5BC0223AD; Tue, 28 May 2019 09:53:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 28 May 2019 09:53:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=W FF+EqqYPsVfndve5O2lcQNz65u6xUFmiZTzHeZhFo0=; b=Zg+cYGEkhmNog72BE RU2Nbsa5Uj9/WyMy6U7w/flIum2gqBGVreJpwq4kZLaz2O/iub0dyuUidIXv7tgk MEe/oWg/dI4vDEB5mJRR3xpdCEmhHIFAzs8JEevcyIExwhca17d/aPPiMZ8Qd817 y4lofVLvhFtowtkiJ8OnBcOMf+DRprzpM8OYGfnCEp2H7wz55bMdFph6YRmQ581p eycL1wQzacO6n/EbEAtUzZSI1U+lQ7hgGnpAqZ3ek49L3U4XK/cBZt5l8l5Xz1Aa +4iI1YuqKRTrbaaKXEoihC/TV/LJH3H09veWA6jrQYtV3SxhO/btmSYWXQ6DwWfR KSs5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=WFF+EqqYPsVfndve5O2lcQNz65u6xUFmiZTzHeZhF o0=; b=htRRtxjr/JM91qVFcnOJZw5JCnQtt6pfhj1FZcr6XTq1j2C5lbPW7IOUM 9Btv0RwMyHLl8dJsI2qDr92LnXKlY9NND3zq7ZjZRfX6uDXJYfUoX75eRIv7DhbI +DgTqY4Omt/fOWWSX0Rkisw0KP28kYqOG/PCJc97VjE8XCnwARtQJiWi/JSTX9zS B2R5DaK07EvUNdtx4ZwBR+qkFogcEq/zXrItHA5DJGSdfvjURVM+blhif7MSStJz RFvqvS8oDVDdDPRnmNLpYD+FAOzrNYm0DhXrT/I/u/lCYiNgh0+LYjptx2Q+bhAN ecovyhRRlzFOOq+ZSJxHFFy5QnVUA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddruddvhedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtke ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejuddrvdduvddrudehtddrvd dtvdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghk lhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id BF8FE8005C; Tue, 28 May 2019 09:53:33 -0400 (EDT) Subject: Re: psql: FATAL: the database system is starting up To: Tom K , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <5b7e0d74-8d6e-c3b8-fb62-3aab1fe0145d@aklaver.com> Date: Tue, 28 May 2019 06:53:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/27/19 9:59 PM, Tom K wrote: > Hey Guy's, > > > I'm running Patroni w/ PostgreSQL 10, ETCD, Haproxy and Keepalived on 3 > RHEL 7.6 VM's.  Every now and then the underlying storage crashes taking > out the cluster.  On recovery, PostgreSQL tends to come up while other > databases just blow up.  That is until now. The above is one master and two standby servers connected via streaming replication, correct? Is there WAL archiving set up? > > After the most recent crash 2-3 weeks ago, the cluster is now running > into this message but I'm not able to make heads or tails out of why > it's throwing this: So you have not been able to run the cluster the past 2-3 weeks or is that more recent? When you refer to history files below are you talking about WAL files or something else? Is this: "recovery command file "recovery.conf" specified neither primary_conninfo nor restore_command" true? > > |-bash-4.2$/usr/pgsql-10/bin/postgres -D /data/patroni > --config-file=/data/patroni/postgresql.conf2019-05-2308:26:34.561EDT > [10101]LOG:listening onIPv4 address "192.168.0.108",port > 54322019-05-2308:26:34.565EDT [10101]LOG:listening onUnix socket > "./.s.PGSQL.5432"2019-05-2308:26:34.591EDT [10101]LOG:redirecting log > output tologging collector process 2019-05-2308:26:34.591EDT > [10101]HINT:Future log output will appear indirectory > "log".^C-bash-4.2/usr/pgsql-10/bin/postgres -D /data/patroni > --config-file=/data/patroni/postgresql.conf --hot_standby=on > --listen_addresses=192.168.0.108 --max_worker_processes=8 > --max_locks_per_transaction=64 --wal_level=replica > --cluster_name=postgres --wal_log_hints=on --max_wal_senders=10 > --track_commit_timestamp=off --max_prepared_transactions=0 --port=5432 > --max_replication_slots=10 > --max_connections=1002019-05-2308:26:45.707EDT [10105]LOG:listening > onIPv4 address "192.168.0.108",port 54322019-05-2308:26:45.715EDT > [10105]LOG:listening onUnix socket > "./.s.PGSQL.5432"2019-05-2308:26:45.740EDT [10105]LOG:redirecting log > output tologging collector process 2019-05-2308:26:45.740EDT > [10105]HINT:Future log output will appear indirectory > "log".^C-bash-4.2$/usr/pgsql-10/bin/postgres -D /data/patroni > --config-file=/data/patroni/postgresql.conf --hot_standby=on > --listen_addresses=192.168.0.1 --max_worker_processes=8 > --max_locks_per_transaction=64 --wal_level=replica > --cluster_name=postgres --wal_log_hints=on --max_wal_senders=10 > --track_commit_timestamp=off --max_prepared_transactions=0 --port=5432 > --max_replication_slots=10 > --max_connections=1002019-05-2308:29:36.014EDT [10188]LOG:listening > onIPv4 address "192.168.0.108",port 54322019-05-2308:29:36.017EDT > [10188]LOG:listening onUnix socket > "./.s.PGSQL.5432"2019-05-2308:29:36.040EDT [10188]LOG:redirecting log > output tologging collector process 2019-05-2308:29:36.040EDT > [10188]HINT:Future log output will appear indirectory "log".| > > The database logs only print out this: > > |2019-05-2308:25:44.476EDT [10088]HINT:The databaseserver will regularly > poll the pg_wal subdirectory tocheckforfiles placed > there.2019-05-2308:25:44.477EDT [10088]LOG:entering standby mode > 2019-05-2308:25:50.209EDT [10086]LOG:received fast shutdownrequest > 2019-05-2308:25:50.215EDT [10089]LOG:shutting down > 2019-05-2308:25:50.221EDT [10086]LOG:databasesystem isshut down > 2019-05-2308:26:11.560EDT [10094]LOG:databasesystem was shut down > inrecovery at 2019-05-2308:25:50EDT 2019-05-2308:26:11.560EDT > [10094]WARNING:recovery command file"recovery.conf"specified neither > primary_conninfo nor restore_command 2019-05-2308:26:11.560EDT > [10094]HINT:The databaseserver will regularly poll the pg_wal > subdirectory tocheckforfiles placed there.2019-05-2308:26:11.562EDT > [10094]LOG:entering standby mode 2019-05-2308:26:17.817EDT > [10092]LOG:received fast shutdownrequest 2019-05-2308:26:17.824EDT > [10095]LOG:shutting down 2019-05-2308:26:17.831EDT > [10092]LOG:databasesystem isshut down 2019-05-2308:26:34.596EDT > [10103]LOG:databasesystem was shut down inrecovery at > 2019-05-2308:26:17EDT 2019-05-2308:26:34.596EDT [10103]WARNING:recovery > command file"recovery.conf"specified neither primary_conninfo nor > restore_command 2019-05-2308:26:34.596EDT [10103]HINT:The databaseserver > will regularly poll the pg_wal subdirectory tocheckforfiles placed > there.2019-05-2308:26:34.598EDT [10103]LOG:entering standby mode > 2019-05-2308:26:43.025EDT [10101]LOG:received fast shutdownrequest > 2019-05-2308:26:43.032EDT [10104]LOG:shutting down > 2019-05-2308:26:43.038EDT [10101]LOG:databasesystem isshut down > 2019-05-2308:26:45.748EDT [10107]LOG:databasesystem was shut down > inrecovery at 2019-05-2308:26:43EDT 2019-05-2308:26:45.748EDT > [10107]WARNING:recovery command file"recovery.conf"specified neither > primary_conninfo nor restore_command 2019-05-2308:26:45.748EDT > [10107]HINT:The databaseserver will regularly poll the pg_wal > subdirectory tocheckforfiles placed there.| > > and when connecting, I get this cryptic message: > > |[root@psql01 log]#psql -U postgres -h 192.168.0.108psql:FATAL:the > databasesystem isstarting up [root@psql01 log]#| > > There's no space issue here.  The cluster stays in recovery. This state > doesn't change and the DB is inaccessible. > > So I ran the above in debug mode ( -d 5 ) and got this: > > > |DEBUG:mmap(148897792)withMAP_HUGETLB failed,huge pages disabled:Cannot > allocate memory| > > so I freed memory on the underlying physical this VM sits on but no > luck. Same memory error and same result as above. > > When patroni is started on just this one node (troubleshooting purposes) > I get the message: > > |[root@psql01 ~]#ps -ef|grep -Ei "patroni|postgres"root > 22172188000:38pts/100:00:00tail -f postgresql-Thu.log postgres > 25121400:42?00:00:01/usr/bin/python2 /bin/patroni /etc/patroni.yml > postgres 25331000:42?00:00:00/usr/pgsql-10/bin/postgres -D /data/patroni > --config-file=/data/patroni/postgresql.conf --hot_standby=on > --listen_addresses=192.168.0.108 --max_worker_processes=8 > --max_locks_per_transaction=64 --wal_level=replica > --cluster_name=postgres --wal_log_hints=on --max_wal_senders=10 > --track_commit_timestamp=off --max_prepared_transactions=0 --port=5432 > --max_replication_slots=10 --max_connections=100postgres > 25352533000:42?00:00:00postgres:postgres:logger process postgres > 25362533000:42?00:00:00postgres:postgres:startup process waiting > for000000010000000000000008root 26642039000:42pts/000:00:00grep > --color=auto -Ei patroni|postgres[root@psql01 ~]#| > > The system prints "postgres: postgres: startup process waiting for > 000000010000000000000008" > > Seems it's trying to replay the history log but can't? Running an strace > on the file reveals that it's looking for the following: > > |read(5,0x7fff9cb4eb87,1)=-1EAGAIN (Resource temporarily > unavailable)read(5,0x7fff9cb4eb87,1)=-1EAGAIN (Resource temporarily > unavailable)open("pg_wal/00000098.history",O_RDONLY)=-1ENOENT (No such > fileordirectory)epoll_create1(EPOLL_CLOEXEC)=3| > > But this file doesn't exist in the directory on this particular cluster > node (psql01).  I copy the missing history files off another cluster > node to this one and it does move forward but just get's stuck on > another history file.  But same error message as above on psql01. > > So I give up and try to recover the secondary node (psql02).  But this > yields this error: > > |PANIC:replicationcheckpointhas wrong magic 0instead of307747550| > > and I'm not able to find very much to move me forward on this one either. > > So again I give up after a few hours of trying to recover psql02 and > move on to the third node.  On the third cluster node (pgsql03) I get > this error which I'm also not able to find much info on: > > |FATAL:syntax error inhistory file:f2W| > > Hoping I'm able to recover the data from at least one of the nodes, make > it primary, and get it to replicate to the others. > > Thx, TK > -- Adrian Klaver adrian.klaver@aklaver.com