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 1hOkgl-0007c0-DK for pgsql-general@arkaria.postgresql.org; Thu, 09 May 2019 15:10:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hOkgk-0001ta-44 for pgsql-general@arkaria.postgresql.org; Thu, 09 May 2019 15:10:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOkgj-0001pL-Am for pgsql-general@lists.postgresql.org; Thu, 09 May 2019 15:10:25 +0000 Received: from mail-oln040092011064.outbound.protection.outlook.com ([40.92.11.64] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOkgg-0002Dq-0w for pgsql-general@postgresql.org; Thu, 09 May 2019 15:10:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CZJPv/fPOsSjbqZfI8f6jPUFSSqYuxc6DX7dqfTKbAM=; b=KdbpSHp5u+ErROwJZ4/2dxMhssRFtEQFTnVs5TkJ4DN00OpMCpskHue61HAqx6j3pxU8qW9f4PH1+IilDb7Q/CYY+nDy93scRyEC6Llu41SV1/4xeNPLC/cnUUWKuaC7oN6P4mc3j6evLbJODneBEAZapfk/AlmEb6/Ct44PXB/TiAA4HvODx9JQdJK8q1/zxS6Ovf6Yv+sojJcxRLoq6Y0DLS9TqneHiUYywG9QCzEelxZXfVCmxWKCcOeNPz8UraFocZr95D3ch8T3uzHcV7DRlY+irq/rXHVuMduYcDtfnEdGdFs4/2KjIZKYmx8WL3V3/vqgH7fqm4IORdl49g== Received: from CO1NAM04FT044.eop-NAM04.prod.protection.outlook.com (10.152.90.53) by CO1NAM04HT151.eop-NAM04.prod.protection.outlook.com (10.152.90.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.15; Thu, 9 May 2019 15:10:19 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com (10.152.90.56) by CO1NAM04FT044.mail.protection.outlook.com (10.152.91.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1856.15 via Frontend Transport; Thu, 9 May 2019 15:10:19 +0000 Received: from BYAPR08MB5014.namprd08.prod.outlook.com ([fe80::d9fb:bca2:3018:3513]) by BYAPR08MB5014.namprd08.prod.outlook.com ([fe80::d9fb:bca2:3018:3513%5]) with mapi id 15.20.1878.022; Thu, 9 May 2019 15:10:19 +0000 From: Julie Nishimura To: Adrian Klaver CC: "pgsql-general@lists.postgresql.org" , pgsql-general Subject: Re: postgresql 9.4 restart Thread-Topic: postgresql 9.4 restart Thread-Index: AQHVBcfma83KtDbVuEyo1YNjnlTS8qZhlxkAgAAfG3eAAAUMAIAAHRkvgAEJU4CAAAUq4Q== Date: Thu, 9 May 2019 15:10:19 +0000 Message-ID: References: <87o94ducuk.fsf@gmail.com> ,<86e74bbc-a495-d15c-fea8-4877b83b1c3d@aklaver.com> In-Reply-To: <86e74bbc-a495-d15c-fea8-4877b83b1c3d@aklaver.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:652A458ADB13BAD31FBC9EF44A2D6957575C67183E7F76FA296E0B52B13219F6;UpperCasedChecksum:E41E9B46E38B9FBA9CBE3AD178B43672A45EC7A11F1AAFE365618DCBC75B6D2E;SizeAsReceived:7360;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [5e/l7ab88UDL9SMGM8n27AxQWwueSrej] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);SRVR:CO1NAM04HT151; x-ms-traffictypediagnostic: CO1NAM04HT151: x-microsoft-antispam-message-info: DZiem+Tk8tEtcqLYUmwKp7XgNi4NmQ5HeRx41m7f8hjrRU9VfpWfVkaSIgEOJB6kZHfiL0Kc97+PKY7lrR0PFoK2BLB06u49hSzW22UAG1gIhDGPqRSL+D46aF6DS24oZqW4EeCMieohzg0MoO3RSbDLmzyqbTN6kifRqXwNFPHN4VZaKWCwoshrinAPqZpo Content-Type: multipart/alternative; boundary="_000_BYAPR08MB50148B7E7635133CA48062CBAC330BYAPR08MB5014namp_" MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 08ffe614-6d95-42f9-7253-08d6d4907369 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2019 15:10:19.5373 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM04HT151 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_BYAPR08MB50148B7E7635133CA48062CBAC330BYAPR08MB5014namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Etc/UTC ________________________________ From: Adrian Klaver Sent: Thursday, May 9, 2019 7:51 AM To: Julie Nishimura Cc: pgsql-general@lists.postgresql.org; pgsql-general Subject: Re: postgresql 9.4 restart On 5/8/19 4:35 PM, Julie Nishimura wrote: > Thanks again for your help. > > 1) max_connections is set to 500 in our config file > 2) our average conn load is 300-400, however, I am not sure if it was > close to max_conn at the moment of restart > 3) we do not have replication on this staging server > 4) These are the snippets from auth logs with the corresponding time: I do not see anything that matches. Do you know what time zone the log entries are in? cat /etc/timezone might help. > > /var/message/syslog: > > May 7 00:02:01 hitw-esg-portal-stage-db-1 CRON[10290]: (postgres) CMD > (/usr/bin/find /data/postgresql/9.4/log -type f ! -name '*.bz2' -mmin > +480 -exec bzip2 {} \;) > May 7 00:03:01 hitw-esg-portal-stage-db-1 CRON[10323]: (postgres) CMD > (/usr/bin/find /data/postgresql/9.4/log -type f -empty -mmin +60 -delete) > May 7 00:05:01 hitw-esg-portal-stage-db-1 CRON[10379]: (root) CMD > (command -v debian-sa1 > /dev/null && debian-sa1 1 1) > May 7 00:15:01 hitw-esg-portal-stage-db-1 CRON[10655]: (root) CMD > (command -v debian-sa1 > /dev/null && debian-sa1 1 1) > May 7 00:17:01 hitw-esg-portal-stage-db-1 CRON[10705]: (root) CMD ( > cd / && run-parts --report /etc/cron.hourly) > May 7 00:25:01 hitw-esg-portal-stage-db-1 CRON[10902]: (root) CMD > (command -v debian-sa1 > /dev/null && debian-sa1 1 1) > May 7 00:27:32 hitw-esg-portal-stage-db-1 crontab[11401]: (root) LIST > (root) > May 7 00:27:32 hitw-esg-portal-stage-db-1 crontab[11403]: (root) LIST > (postgres) > May 7 00:28:24 hitw-esg-portal-stage-db-1 puppet-agent[10914]: > (/Stage[main]/Ci::Db/Package[postgresql-plpython-]/ensure) ensure > changed 'purged' to 'present' > May 7 00:28:40 hitw-esg-portal-stage-db-1 puppet-agent[10914]: Finished > catalog run in 106.68 seconds > May 7 00:35:01 hitw-esg-portal-stage-db-1 CRON[14398]: (root) CMD > (command -v debian-sa1 > /dev/null && debian-sa1 1 1) > > this is from auth.log: > > May 7 00:01:01 hitw-esg-portal-stage-db-1 CRON[10265]: > pam_unix(cron:session): session opened for user postgres by (uid=3D0) > May 7 00:01:01 hitw-esg-portal-stage-db-1 CRON[10265]: > pam_unix(cron:session): session closed for user postgres > May 7 00:02:01 hitw-esg-portal-stage-db-1 CRON[10289]: > pam_unix(cron:session): session opened for user postgres by (uid=3D0) > May 7 00:02:01 hitw-esg-portal-stage-db-1 CRON[10289]: > pam_unix(cron:session): session closed for user postgres > May 7 00:02:29 hitw-esg-portal-stage-db-1 sshd[10306]: Connection > closed by ::1 port 49936 [preauth] > May 7 00:03:01 hitw-esg-portal-stage-db-1 CRON[10322]: > pam_unix(cron:session): session opened for user postgres by (uid=3D0) > May 7 00:03:01 hitw-esg-portal-stage-db-1 CRON[10322]: > pam_unix(cron:session): session closed for user postgres > May 7 00:04:30 hitw-esg-portal-stage-db-1 sshd[10365]: Connection > closed by ::1 port 49942 [preauth] > May 7 00:05:01 hitw-esg-portal-stage-db-1 CRON[10378]: > pam_unix(cron:session): session opened for user root by (uid=3D0) > May 7 00:05:01 hitw-esg-portal-stage-db-1 CRON[10378]: > pam_unix(cron:session): session closed for user root > May 7 00:06:31 hitw-esg-portal-stage-db-1 sshd[10422]: Connection > closed by ::1 port 49948 [preauth] > May 7 00:08:33 hitw-esg-portal-stage-db-1 sshd[10483]: Connection > closed by ::1 port 49954 [preauth] > May 7 00:10:34 hitw-esg-portal-stage-db-1 sshd[10540]: Connection > closed by ::1 port 49960 [preauth] > May 7 00:12:35 hitw-esg-portal-stage-db-1 sshd[10594]: Connection > closed by ::1 port 49966 [preauth] > May 7 00:14:36 hitw-esg-portal-stage-db-1 sshd[10642]: Connection > closed by ::1 port 49972 [preauth] > May 7 00:15:01 hitw-esg-portal-stage-db-1 CRON[10654]: > pam_unix(cron:session): session opened for user root by (uid=3D0) > May 7 00:15:01 hitw-esg-portal-stage-db-1 CRON[10654]: > pam_unix(cron:session): session closed for user root > May 7 00:16:37 hitw-esg-portal-stage-db-1 sshd[10691]: Connection > closed by ::1 port 49978 [preauth] > May 7 00:17:01 hitw-esg-portal-stage-db-1 CRON[10704]: > pam_unix(cron:session): session opened for user root by (uid=3D0) > May 7 00:17:01 hitw-esg-portal-stage-db-1 CRON[10704]: > pam_unix(cron:session): session closed for user root > May 7 00:18:39 hitw-esg-portal-stage-db-1 sshd[10741]: Connection > closed by ::1 port 49984 [preauth] > May 7 00:20:40 hitw-esg-portal-stage-db-1 sshd[10787]: Connection > closed by ::1 port 49990 [preauth] > May 7 00:22:41 hitw-esg-portal-stage-db-1 sshd[10833]: Connection > closed by ::1 port 49996 [preauth] > May 7 00:24:42 hitw-esg-portal-stage-db-1 sshd[10890]: Connection > closed by ::1 port 50002 [preauth] > May 7 00:25:01 hitw-esg-portal-stage-db-1 CRON[10901]: > pam_unix(cron:session): session opened for user root by (uid=3D0) > May 7 00:25:01 hitw-esg-portal-stage-db-1 CRON[10901]: > pam_unix(cron:session): session closed for user root > May 7 00:25:44 hitw-esg-portal-stage-db-1 sudo: root : TTY=3Dunknown > ; PWD=3D/ ; USER=3Dpostgres ; COMMAND=3D/usr/bin/psql -q -t -P > format=3Dunaligned -c SELECT datname, pg_encoding_to_char(encoding) FROM > pg_database WHERE datistemplate =3D false AND datname !=3D 'postgres' > May 7 00:25:44 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:session): > session opened for user postgres by (uid=3D0) > May 7 00:25:44 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:session): > session closed for user postgres > May 7 00:25:51 hitw-esg-portal-stage-db-1 sudo: root : TTY=3Dunknown > ; PWD=3D/ ; USER=3Dpostgres ; COMMAND=3D/usr/bin/psql -q -t -P > format=3Dunaligned -c SHOW server_version > May 7 00:25:51 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:session): > session opened for user postgres by (uid=3D0) > May 7 00:25:51 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:session): > session closed for user postgres > May 7 00:26:44 hitw-esg-portal-stage-db-1 sshd[11327]: Connection > closed by ::1 port 50018 [preauth] > > > For me, it seems like there is some cron job ran shortly after midnight > (either from root or through puppet and restarted the server, because > maybe it was close to max connections - just a guess). What do you think? > > -Julie N > > > ------------------------------------------------------------------------ > *From:* Adrian Klaver > *Sent:* Wednesday, May 8, 2019 2:17 PM > *To:* Julie Nishimura > *Cc:* pgsql-general@lists.postgresql.org; pgsql-general > *Subject:* Re: postgresql 9.4 restart > On 5/8/19 2:01 PM, Julie Nishimura wrote: >> Adrian, thanks for your reply! >> >> >> >> PostgreSQL 9.4.21 on x86_64-pc-linux-gnu (Ubuntu 9.4.21-1.pgdg16.04+1), >> compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit >> >> This is what Ive found in logs prior to the restart: > >> UTC,"hitwise","hitwise_us_stg",8677,"10.200.193.58:49428",5cd0cc7a.21e5,= 3,"startup",2019-05-07 >> 00:08:26 UTC,448/970,0,FATAL,53300,"remaining connection slots are >> reserved for non-replication superuser connections",,,,,,,,,"" >> 2019-05-07 00:08:26.778 > > The above is not good. > > What do you have set for max_connections? > > How many connections are you trying against the database? > > Do you have replication set up to other Postgres instances(uk, au, us)? > > What does the system log show from the same time period? > > > >> UTC,"hitwise","hitwise_us_stg",8675,"10.200.193.58:49424",5cd0cc7a.21e3,= 6,"idle",2019-05-07 >> 00:08:26 UTC,,0,LOG,00000,"disconnection: session time: 0:00:00.021 >> user=3Dhitwise database=3Dhitwise_us_stg host=3D10.200.193.58 >> port=3D49424",,,,,,,,,"" >> 2019-05-07 00:08:26.779 >> UTC,"hitwise","hitwise_us_stg",8676,"10.200.193.58:49426",5cd0cc7a.21e4,= 6,"idle",2019-05-07 >> 00:08:26 UTC,,0,LOG,00000,"disconnection: session time: 0:00:00.018 >> user=3Dhitwise database=3Dhitwise_us_stg host=3D10.200.193.58 >> port=3D49426",,,,,,,,,"" >> 2019-05-07 00:08:28.060 UTC,,,4117,,5cbfb2c9.1015,5,,2019-04-24 00:50:17 >> UTC,,0,LOG,00000,"received fast shutdown request",,,,,,,,,"" >> 2019-05-07 00:08:28.060 UTC,,,4117,,5cbfb2c9.1015,6,,2019-04-24 00:50:17 >> UTC,,0,LOG,00000,"aborting any active transactions",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_uk_stg",8558,"10.200.193.58:49246",5cd0cc20.216e,= 6,"idle",2019-05-07 >> 00:06:56 UTC,54/0,0,FATAL,57P01,"terminating connection due to >> administrator command",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_uk_stg",8559,"10.200.193.58:49248",5cd0cc20.216f,= 6,"idle",2019-05-07 >> 00:06:56 UTC,56/0,0,FATAL,57P01,"terminating connection due to >> administrator command",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_uk_stg",8561,"10.200.193.58:49252",5cd0cc20.2171,= 6,"idle",2019-05-07 >> 00:06:56 UTC,429/0,0,FATAL,57P01,"terminating connection due to >> administrator command",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_au_stg",8578,"10.200.250.49:31100",5cd0cc33.2182,= 6,"idle",2019-05-07 >> 00:07:15 UTC,19/0,0,FATAL,57P01,"terminating connection due to >> administrator command",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_us_stg",8626,"10.200.250.49:31332",5cd0cc61.21b2,= 6,"idle",2019-05-07 >> 00:08:01 UTC,3/0,0,FATAL,57P01,"terminating connection due to >> administrator command",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_uk_stg",8560,"10.200.193.58:49250",5cd0cc20.2170,= 6,"idle",2019-05-07 >> 00:06:56 UTC,227/0,0,FATAL,57P01,"terminating connection due to >> administrator command",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_uk_stg",8558,"10.200.193.58:49246",5cd0cc20.216e,= 7,"idle",2019-05-07 >> 00:06:56 UTC,,0,LOG,00000,"disconnection: session time: 0:01:31.339 >> user=3Dhitwise database=3Dhitwise_uk_stg host=3D10.200.193.58 >> port=3D49246",,,,,,,,,"" >> 2019-05-07 00:08:28.060 >> UTC,"hitwise","hitwise_au_stg",8578,"10.200.250.49:31100",5cd0cc33.2182,= 7,"idle",2019-05-07 >> 00:07:15 UTC,,0,LOG,00000,"disconnection: session time: 0:01:12.215 >> user=3Dhitwise database=3Dhitwise_au_stg host=3D10.200.250.49 >> port=3D31100",,,,,,,,,"" >> >> Does it help? >> >> ------------------------------------------------------------------------ >> *From:* Adrian Klaver >> *Sent:* Wednesday, May 8, 2019 12:07 PM >> *To:* Julie Nishimura >> *Cc:* pgsql-general@lists.postgresql.org; pgsql-general >> *Subject:* Re: postgresql 9.4 restart >> On 5/8/19 11:00 AM, Julie Nishimura wrote: >>> Hello, >>> Our staging 9.4 postgresql has been running couple of weeks with no >>> problem, but yesterday we saw this error from one of our services that >>> connects to the staging DBs: >>> >>> FATAL: terminating connection due to >>> administrator command; nested exception is >>> org.postgresql.util.PSQLException: FATAL: terminating connection due to >>> administrator command=94, >> >> Distro and version? >> >> Well it originated in Java code if that helps? >> >> Anything in the Postgres logs just prior to 'FATAL: terminating >> connection ...' that might be relevant? >> >> Do the system logs showing anything relevant e.g. the OOM killer >> stopping Postgres? >> >> >> >>> >>> Then I could see that postgresql got restarted, based on the output of >>> "select pg_postmaster_start_time()" >>> >>> We are running postgresql on >>> Linux xxx-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 >>> x86_64 x86_64 GNU/Linux >>> >>> How I can find out what cause the restart? Any ideas are welcome. Thank= s! >>> >>> -Julie N >>> >>> >> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com > > > -- > Adrian Klaver > adrian.klaver@aklaver.com -- Adrian Klaver adrian.klaver@aklaver.com --_000_BYAPR08MB50148B7E7635133CA48062CBAC330BYAPR08MB5014namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
Etc/UTC


From: Adrian Klaver <a= drian.klaver@aklaver.com>
Sent: Thursday, May 9, 2019 7:51 AM
To: Julie Nishimura
Cc: pgsql-general@lists.postgresql.org; pgsql-general
Subject: Re: postgresql 9.4 restart
 
On 5/8/19 4:35 PM, Julie Nishimura wrote:
> Thanks again for your help.
>
> 1) max_connections is set to 500 in our config file
> 2) our average conn load is 300-400, however, I am not sure if it was =
> close to max_conn at the moment of restart
> 3) we do not have replication on this staging server
> 4) These are the snippets from auth logs with the corresponding time:<= br>
I do not see anything that matches.

Do you know what time zone the log entries are in?
cat /etc/timezone might help.

>
> /var/message/syslog:
>
> May  7 00:02:01 hitw-esg-portal-stage-db-1 CRON[10290]: (postgres= ) CMD
> (/usr/bin/find /data/postgresql/9.4/log -type f ! -name '*.bz2' -mmin =
> +480 -exec bzip2 {} \;)
> May  7 00:03:01 hitw-esg-portal-stage-db-1 CRON[10323]: (postgres= ) CMD
> (/usr/bin/find /data/postgresql/9.4/log -type f -empty -mmin +60 -= delete)
> May  7 00:05:01 hitw-esg-portal-stage-db-1 CRON[10379]: (root) CM= D
> (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
> May  7 00:15:01 hitw-esg-portal-stage-db-1 CRON[10655]: (root) CM= D
> (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
> May  7 00:17:01 hitw-esg-portal-stage-db-1 CRON[10705]: (root) CM= D (  
> cd / && run-parts --report /etc/cron.hourly)
> May  7 00:25:01 hitw-esg-portal-stage-db-1 CRON[10902]: (root) CM= D
> (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
> May  7 00:27:32 hitw-esg-portal-stage-db-1 crontab[11401]: (root)= LIST
> (root)
> May  7 00:27:32 hitw-esg-portal-stage-db-1 crontab[11403]: (root)= LIST
> (postgres)
> May  7 00:28:24 hitw-esg-portal-stage-db-1 puppet-agent[10914]: <= br> > (/Stage[main]/Ci::Db/Package[postgresql-plpython-]/ensure) ensure
> changed 'purged' to 'present'
> May  7 00:28:40 hitw-esg-portal-stage-db-1 puppet-agent[10914]: F= inished
> catalog run in 106.68 seconds
> May  7 00:35:01 hitw-esg-portal-stage-db-1 CRON[14398]: (root) CM= D
> (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
>
> this is from auth.log:
>
> May  7 00:01:01 hitw-esg-portal-stage-db-1 CRON[10265]:
> pam_unix(cron:session): session opened for user postgres by (uid=3D0)<= br> > May  7 00:01:01 hitw-esg-portal-stage-db-1 CRON[10265]:
> pam_unix(cron:session): session closed for user postgres
> May  7 00:02:01 hitw-esg-portal-stage-db-1 CRON[10289]:
> pam_unix(cron:session): session opened for user postgres by (uid=3D0)<= br> > May  7 00:02:01 hitw-esg-portal-stage-db-1 CRON[10289]:
> pam_unix(cron:session): session closed for user postgres
> May  7 00:02:29 hitw-esg-portal-stage-db-1 sshd[10306]: Connectio= n
> closed by ::1 port 49936 [preauth]
> May  7 00:03:01 hitw-esg-portal-stage-db-1 CRON[10322]:
> pam_unix(cron:session): session opened for user postgres by (uid=3D0)<= br> > May  7 00:03:01 hitw-esg-portal-stage-db-1 CRON[10322]:
> pam_unix(cron:session): session closed for user postgres
> May  7 00:04:30 hitw-esg-portal-stage-db-1 sshd[10365]: Connectio= n
> closed by ::1 port 49942 [preauth]
> May  7 00:05:01 hitw-esg-portal-stage-db-1 CRON[10378]:
> pam_unix(cron:session): session opened for user root by (uid=3D0)
> May  7 00:05:01 hitw-esg-portal-stage-db-1 CRON[10378]:
> pam_unix(cron:session): session closed for user root
> May  7 00:06:31 hitw-esg-portal-stage-db-1 sshd[10422]: Connectio= n
> closed by ::1 port 49948 [preauth]
> May  7 00:08:33 hitw-esg-portal-stage-db-1 sshd[10483]: Connectio= n
> closed by ::1 port 49954 [preauth]
> May  7 00:10:34 hitw-esg-portal-stage-db-1 sshd[10540]: Connectio= n
> closed by ::1 port 49960 [preauth]
> May  7 00:12:35 hitw-esg-portal-stage-db-1 sshd[10594]: Connectio= n
> closed by ::1 port 49966 [preauth]
> May  7 00:14:36 hitw-esg-portal-stage-db-1 sshd[10642]: Connectio= n
> closed by ::1 port 49972 [preauth]
> May  7 00:15:01 hitw-esg-portal-stage-db-1 CRON[10654]:
> pam_unix(cron:session): session opened for user root by (uid=3D0)
> May  7 00:15:01 hitw-esg-portal-stage-db-1 CRON[10654]:
> pam_unix(cron:session): session closed for user root
> May  7 00:16:37 hitw-esg-portal-stage-db-1 sshd[10691]: Connectio= n
> closed by ::1 port 49978 [preauth]
> May  7 00:17:01 hitw-esg-portal-stage-db-1 CRON[10704]:
> pam_unix(cron:session): session opened for user root by (uid=3D0)
> May  7 00:17:01 hitw-esg-portal-stage-db-1 CRON[10704]:
> pam_unix(cron:session): session closed for user root
> May  7 00:18:39 hitw-esg-portal-stage-db-1 sshd[10741]: Connectio= n
> closed by ::1 port 49984 [preauth]
> May  7 00:20:40 hitw-esg-portal-stage-db-1 sshd[10787]: Connectio= n
> closed by ::1 port 49990 [preauth]
> May  7 00:22:41 hitw-esg-portal-stage-db-1 sshd[10833]: Connectio= n
> closed by ::1 port 49996 [preauth]
> May  7 00:24:42 hitw-esg-portal-stage-db-1 sshd[10890]: Connectio= n
> closed by ::1 port 50002 [preauth]
> May  7 00:25:01 hitw-esg-portal-stage-db-1 CRON[10901]:
> pam_unix(cron:session): session opened for user root by (uid=3D0)
> May  7 00:25:01 hitw-esg-portal-stage-db-1 CRON[10901]:
> pam_unix(cron:session): session closed for user root
> May  7 00:25:44 hitw-esg-portal-stage-db-1 sudo:     ro= ot : TTY=3Dunknown
> ; PWD=3D/ ; USER=3Dpostgres ; COMMAND=3D/usr/bin/psql -q -t -P
> format=3Dunaligned -c SELECT datname, pg_encoding_to_char(encoding) FR= OM
> pg_database WHERE datistemplate =3D false AND datname !=3D 'postgres'<= br> > May  7 00:25:44 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:se= ssion):
> session opened for user postgres by (uid=3D0)
> May  7 00:25:44 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:se= ssion):
> session closed for user postgres
> May  7 00:25:51 hitw-esg-portal-stage-db-1 sudo:     ro= ot : TTY=3Dunknown
> ; PWD=3D/ ; USER=3Dpostgres ; COMMAND=3D/usr/bin/psql -q -t -P
> format=3Dunaligned -c SHOW server_version
> May  7 00:25:51 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:se= ssion):
> session opened for user postgres by (uid=3D0)
> May  7 00:25:51 hitw-esg-portal-stage-db-1 sudo: pam_unix(sudo:se= ssion):
> session closed for user postgres
> May  7 00:26:44 hitw-esg-portal-stage-db-1 sshd[11327]: Connectio= n
> closed by ::1 port 50018 [preauth]
>
>
> For me, it seems like there is some cron job ran shortly after midnigh= t
> (either from root or through puppet and restarted the server, because =
> maybe it was close to max connections - just a guess). What do you thi= nk?
>
> -Julie N
>
>
> ----------------------------------------------------------------------= --
> *From:* Adrian Klaver <adrian.klaver@aklaver.com>
> *Sent:* Wednesday, May 8, 2019 2:17 PM
> *To:* Julie Nishimura
> *Cc:* pgsql-general@lists.postgresql.org; pgsql-general
> *Subject:* Re: postgresql 9.4 restart
> On 5/8/19 2:01 PM, Julie Nishimura wrote:
>> Adrian, thanks for your reply!
>>
>>
>>
>> PostgreSQL 9.4.21 on x86_64-pc-linux-gnu (Ubuntu 9.4.21-1.pgdg16.0= 4+1),
>> compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 6= 4-bit
>>
>> This is what Ive found in logs prior to the restart:
>
>> UTC,"hitwise","hitwise_us_stg",8677,"10.2= 00.193.58:49428",5cd0cc7a.21e5,3,"startup",2019-05-07
>> 00:08:26 UTC,448/970,0,FATAL,53300,"remaining connection slot= s are
>> reserved for non-replication superuser connections",,,,,,,,,&= quot;"
>> 2019-05-07 00:08:26.778
>
> The above is not good.
>
> What do you have set for max_connections?
>
> How many connections are you trying against the database?
>
> Do you have replication set up to other Postgres instances(uk, au, us)= ?
>
> What does the system log show from the same time period?
>
>
>
>> UTC,"hitwise","hitwise_us_stg",8675,"10.2= 00.193.58:49424",5cd0cc7a.21e3,6,"idle",2019-05-07
>> 00:08:26 UTC,,0,LOG,00000,"disconnection: session time: 0:00:= 00.021
>> user=3Dhitwise database=3Dhitwise_us_stg host=3D10.200.193.58
>> port=3D49424",,,,,,,,,""
>> 2019-05-07 00:08:26.779
>> UTC,"hitwise","hitwise_us_stg",8676,"10.2= 00.193.58:49426",5cd0cc7a.21e4,6,"idle",2019-05-07
>> 00:08:26 UTC,,0,LOG,00000,"disconnection: session time: 0:00:= 00.018
>> user=3Dhitwise database=3Dhitwise_us_stg host=3D10.200.193.58
>> port=3D49426",,,,,,,,,""
>> 2019-05-07 00:08:28.060 UTC,,,4117,,5cbfb2c9.1015,5,,2019-04-24 00= :50:17
>> UTC,,0,LOG,00000,"received fast shutdown request",,,,,,,= ,,""
>> 2019-05-07 00:08:28.060 UTC,,,4117,,5cbfb2c9.1015,6,,2019-04-24 00= :50:17
>> UTC,,0,LOG,00000,"aborting any active transactions",,,,,= ,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_uk_stg",8558,"10.2= 00.193.58:49246",5cd0cc20.216e,6,"idle",2019-05-07
>> 00:06:56 UTC,54/0,0,FATAL,57P01,"terminating connection due t= o
>> administrator command",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_uk_stg",8559,"10.2= 00.193.58:49248",5cd0cc20.216f,6,"idle",2019-05-07
>> 00:06:56 UTC,56/0,0,FATAL,57P01,"terminating connection due t= o
>> administrator command",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_uk_stg",8561,"10.2= 00.193.58:49252",5cd0cc20.2171,6,"idle",2019-05-07
>> 00:06:56 UTC,429/0,0,FATAL,57P01,"terminating connection due = to
>> administrator command",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_au_stg",8578,"10.2= 00.250.49:31100",5cd0cc33.2182,6,"idle",2019-05-07
>> 00:07:15 UTC,19/0,0,FATAL,57P01,"terminating connection due t= o
>> administrator command",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_us_stg",8626,"10.2= 00.250.49:31332",5cd0cc61.21b2,6,"idle",2019-05-07
>> 00:08:01 UTC,3/0,0,FATAL,57P01,"terminating connection due to=
>> administrator command",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_uk_stg",8560,"10.2= 00.193.58:49250",5cd0cc20.2170,6,"idle",2019-05-07
>> 00:06:56 UTC,227/0,0,FATAL,57P01,"terminating connection due = to
>> administrator command",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_uk_stg",8558,"10.2= 00.193.58:49246",5cd0cc20.216e,7,"idle",2019-05-07
>> 00:06:56 UTC,,0,LOG,00000,"disconnection: session time: 0:01:= 31.339
>> user=3Dhitwise database=3Dhitwise_uk_stg host=3D10.200.193.58
>> port=3D49246",,,,,,,,,""
>> 2019-05-07 00:08:28.060
>> UTC,"hitwise","hitwise_au_stg",8578,"10.2= 00.250.49:31100",5cd0cc33.2182,7,"idle",2019-05-07
>> 00:07:15 UTC,,0,LOG,00000,"disconnection: session time: 0:01:= 12.215
>> user=3Dhitwise database=3Dhitwise_au_stg host=3D10.200.250.49
>> port=3D31100",,,,,,,,,""
>>
>> Does it help?
>>
>> ------------------------------------------------------------------= ------
>> *From:* Adrian Klaver <adrian.klaver@aklaver.com>
>> *Sent:* Wednesday, May 8, 2019 12:07 PM
>> *To:* Julie Nishimura
>> *Cc:* pgsql-general@lists.postgresql.org; pgsql-general
>> *Subject:* Re: postgresql 9.4 restart
>> On 5/8/19 11:00 AM, Julie Nishimura wrote:
>>> Hello,
>>> Our staging 9.4 postgresql has been running couple of weeks wi= th no
>>> problem, but yesterday we saw this error from one of our servi= ces that
>>> connects to the staging DBs:
>>>
>>> FATAL: terminating connection due to
>>> administrator command; nested exception is
>>> org.postgresql.util.PSQLException: FATAL: terminating connecti= on due to
>>> administrator command=94,
>>
>> Distro and version?
>>
>> Well it originated in Java code if that helps?
>>
>> Anything in the Postgres logs just prior to 'FATAL: terminating >> connection ...' that might be relevant?
>>
>> Do the system logs showing anything relevant e.g. the OOM killer >> stopping Postgres?
>>
>>
>>
>>>
>>> Then I could see that postgresql got restarted, based on the o= utput of
>>> "select pg_postmaster_start_time()"
>>>
>>> We are running postgresql on
>>> Linux xxx-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 = x86_64
>>> x86_64 x86_64 GNU/Linux
>>>
>>> How I can find out what cause the restart? Any ideas are welco= me. Thanks!
>>>
>>> -Julie N
>>>
>>>
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com


--
Adrian Klaver
adrian.klaver@aklaver.com
--_000_BYAPR08MB50148B7E7635133CA48062CBAC330BYAPR08MB5014namp_--