Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu32B-0006uL-Tl for pgsql-general@arkaria.postgresql.org; Thu, 08 Mar 2018 21:25:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eu329-00060C-VX for pgsql-general@arkaria.postgresql.org; Thu, 08 Mar 2018 21:25:05 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu329-0005zd-Jw for pgsql-general@lists.postgresql.org; Thu, 08 Mar 2018 21:25:05 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu325-0008T0-CM for pgsql-general@postgresql.org; Thu, 08 Mar 2018 21:25:04 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7C7CA20CD2; Thu, 8 Mar 2018 16:25:00 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Thu, 08 Mar 2018 16:25:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=H5CdWEModf4vJfP3TWErFFBWSMPn9 VbUWkpScHqNoVM=; b=K5M5KwZSVf5isieVG4TAfLgi0mM4ZXnu3JTr/HwzrUkPp o9zoN20eqA98+nXzWWWpm8UBjH+8nTvyrfXHmWtki7QP04UWvNTszhE+AJEAOy5W +k8RCjuv4Dr1DmSNGKHtLqQZ/AkdSLsS8zdAYJGJejVoptXvyiIuKHHdqB6fKkfr /zcAzyRIMXRgh495yBvMHU99N7rhK4hp2x5T3rHxJu0vwjMkX7+yITvOlM8ymjnz spDCv2Khrx51T2socBQa+C7u1tpSgNqv+7CKm9ASomzBw+tCB1Ej4K2fbTdVD1/t mHu1YOmwMoAK7aXS03attdbzlWHyld86/IFqFiPOg== 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-sender:x-me-sender:x-sasl-enc; s=fm2; bh=H5CdWE Modf4vJfP3TWErFFBWSMPn9VbUWkpScHqNoVM=; b=LcIAuaTPQzqvyoxlDGASLu 7g8ZRDoWyVo5uOm0Nfx3BIuI6DpFUYiIlKb9xL/9D8Ic5aLrYwmi2lZFO/F2YFPb NYul9qv2aGnSnC+C1g9GcEldq/qiQQxJ54xSvGWGHPvkECinq5e5cbUEWzcHs8yz 4qEWAkoit6CXJFDgmn70SEiI+OQ/9OpEhe/zfNvCxOZHmnACwOs0kaJvO6nf6ZF4 WmBBt97t7SGd7dNW7gMRj0uWmqg4ehfacVigosrFCzLba0uWqqXW4HBh0cwuNK+h oG+tBWnfOmuLw4UnvxLm9AeLUzefe6pyUW5rMpiudhTNoUwrsTWErEzFL9EVIjqw == X-ME-Sender: Received: from [192.168.1.2] (71-35-123-124.tukw.qwest.net [71.35.123.124]) by mail.messagingengine.com (Postfix) with ESMTPA id EACC77E3C6; Thu, 8 Mar 2018 16:24:59 -0500 (EST) Subject: Re: JDBC connectivity issue To: chris , Postgres General References: From: Adrian Klaver Message-ID: <0175e71d-aa4f-1b9c-6a63-53b2a9dcbd9a@aklaver.com> Date: Thu, 8 Mar 2018 13:24:59 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/08/2018 01:12 PM, chris wrote: > Hi, > > I have a JDBC temping to connect to 2 postgres nodes in a hot standby > configuration. Running postgres 9.4 on centos6. > > What we are trying to accomplish is in an event of a failover, to first > try to connect to the master. If that fails to then reach out to the > standby. > > I looked online and found the suggested way to do this, but it's not > working. > > This is the JDBC line we have: > > /jdbc.url=jdbc:postgresql://10.16.10.12:5432,10.16.10.13:5432/app_db/ That seems to be correct: https://jdbc.postgresql.org/documentation/94/connect.html "Connection Fail-over To support simple connection fail-over it is possible to define multiple endpoints (host and port pairs) in the connection url separated by commas. The driver will try to once connect to each of them in order until the connection succeeds. If none succeed, a normal connection exception is thrown. The syntax for the connection url is: jdbc:postgresql://host1:port1,host2:port2/database" > > Here is the error we are getting:/ > / > > /2018-03-07 13:54:36, 994 ERROR:com.zaxxer.hikari.util.PropertyElf - > failed to set properly port number on target class > org.postgresql.ds.PGSimpleDataSource java.langNumberFormatException:for > input string: "5432,10.16.10.13:5432"/ > > It looks like the first IP address has disappeared or is not set right./ To me it looks whatever code you are using is trying to us "5432,10.16.10.13:5432" as the port number for 10.16.10.12. In other words it is not seeing the ',' as a separator for the two IP's'. Can you provide more information about the JDBC version you are using and the app code you are using? > / > > Thanks in advance for the help. > > > // > > -- Adrian Klaver adrian.klaver@aklaver.com