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 1iDV6G-0004um-UT for pgsql-general@arkaria.postgresql.org; Thu, 26 Sep 2019 14:50:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDV6F-0006fx-7r for pgsql-general@arkaria.postgresql.org; Thu, 26 Sep 2019 14:50:31 +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 1iDV6E-0006K7-1B for pgsql-general@lists.postgresql.org; Thu, 26 Sep 2019 14:50:30 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iDV6B-0002S3-Ei for pgsql-general@lists.postgresql.org; Thu, 26 Sep 2019 14:50:28 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 767292179E; Thu, 26 Sep 2019 10:50:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 26 Sep 2019 10:50:26 -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=fm1; bh=s vbRvTEXXlYsO/U4XxXCyBkLUBktxC0ZOzQlN2m4rN4=; b=c5ptNDn8shbi/k5oG goHcaMWg5XCD4zrmDQj+wScJfgodUtN426vv0qxW7dc8r9n9T/EKsBC2xBgA5bL7 4f+l6mXNDBC+oILP/EnbU8mvIvVUip+YbgdQAMhy6aOIeU3cs/5rrWthD/+srobs xTdErVdRn1XDXriqu2XaTgg/hqRwm4P3rxy9EJh1FNiCU5SRlzSHCKJ9UWr0A1oS DZ+EU/ram0F5A32tsVvJ7NFiEfNk36w9RB9xQL+xZXqGF6GDbHARAMQhXUQ+dKk9 b74kSqQo8iDZSmbMRV1B5zmLn8896CzAxy5pV9mkuAD0gElH32Wo9G/egVmfpVie MMxUA== 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=fm3; bh=svbRvTEXXlYsO/U4XxXCyBkLUBktxC0ZOzQlN2m4r N4=; b=IYoKSg+lN36vbxRGsdpl9Srsbs4mywb62eUp9i5/PRgmTW+KJ9sesX6+2 OiJWQzFmF9Rfo0YSTISvOHIgUWp8P8733NrvXjMITU/315DRoG1t0pnF8kt6QKyG EJUsQ+TuLhokPNTOwo//Ffw9j+Hhzgp/ylZUhWkWZTW/uwLlQ+Wgu1cQTjhXAR4J VPvstKFUj6ZBsChefUiU/JS2mXbM76XP0nEwf0n0/WYXl+tKHPlGi2gZ3oZizXsh 0cVl5j+UQCLWmMKhk5INvnlV48RKjlJlDnAS+M4OKvFFzxpzcwbxVSbB3YEcLIBq +GbFf0933bDJ3kdadlFCWUbihT52A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrfeeggdektdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpedtrddtrddtrddtpdhrvggrughthhgvughotghsrdhiohenucfk phepudejgedrvddurdelfedrudejieenucfrrghrrghmpehmrghilhhfrhhomheprggurh hirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigv pedt X-ME-Proxy: Received: from [192.168.1.3] (174-21-93-176.tukw.qwest.net [174.21.93.176]) by mail.messagingengine.com (Postfix) with ESMTPA id 8D18280062; Thu, 26 Sep 2019 10:50:25 -0400 (EDT) Subject: Re: "Failed to connect to Postgres database" To: Marco Ippolito , Martin Gainty , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <84aea77f-d09e-d938-e904-ed7700856fa3@aklaver.com> Date: Thu, 26 Sep 2019 07:50:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 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 9/26/19 7:21 AM, Marco Ippolito wrote: > In order to restart from a clean situation and configuration, I removed > the previous fabric-ca folder, created a new one, and then initiated the > fabric-ca-server. With the default SQLite everything seem working fine. > But one I try to use the PostgreSQL-11 db I created before, errors appear: > > |(base)marco@pc:~/fabric$rm -rf fabric-ca (base)marco@pc:~/fabric$mkdir > fabric-ca (base)marco@pc:~/fabric$cd > fabric-ca/(base)marco@pc:~/fabric/fabric-ca$fabric-ca-server init -b > admin:adminpw (base)marco@pc:~/fabric/fabric-ca$fabric-ca-server start-b > admin:adminpw 2019/09/2615:48:54[INFO]Created defaultconfiguration > fileat /home/marco/fabric/fabric-ca/fabric-ca-server-config.yaml > 2019/09/2615:48:54[INFO]Starting server inhome > directory:/home/marco/fabric/fabric-ca 2019/09/2615:48:54[INFO]Server > Version:1.4.42019/09/2615:48:54[INFO]Server > Levels:&{Identity:2Affiliation:1Certificate:1Credential:1RAInfo:1Nonce:1}2019/09/2615:48:54[WARNING]&{69The > specified CA certificate file/home/marco/fabric/fabric-ca/ca-cert.pem > does notexist}2019/09/2615:48:54[INFO]generating key:&{A:ecdsa > S:256}2019/09/2615:48:54[INFO]encoded CSR 2019/09/2615:48:54[INFO]signed > certificate withserial number > 1625953039820960683388734809875126848203422536642019/09/2615:48:54[INFO]The > CA keyandcertificate were generated forCA 2019/09/2615:48:54[INFO]The > keywas stored byBCCSP provider 'SW'2019/09/2615:48:54[INFO]The > certificate isat:/home/marco/fabric /fabric-ca/ca-cert.pem > 2019/09/2615:48:54[INFO]Initialized sqlite3 databaseat /home/marco > /fabric/fabric-ca/fabric-ca-server.db 2019/09/2615:48:54[INFO]The issuer > keywas successfully stored.The > publickeyisat:/home/marco/fabric/fabric-ca/IssuerPublicKey,secret > keyisat:/home/marco/fabric/fabric-ca/msp/keystore/IssuerSecretKey > 2019/09/2615:48:54[INFO]Idemix issuer revocation publicandsecret keys > were generated forCA ''2019/09/2615:48:54[INFO]The revocation keywas > successfully stored.The publickeyisat:/home/marco/fabric/fabric- > ca/IssuerRevocationPublicKey,private keyisat:/home/marco/fabric > /fabric-ca/msp/keystore/IssuerRevocationPrivateKey > 2019/09/2615:48:54[INFO]Home directory fordefaultCA:/home/marco > /fabric/fabric-ca 2019/09/2615:48:54[INFO]Operation Server Listening > on127.0.0.1:94432019/09/2615:48:54[INFO]Listening onhttp://0.0.0.0:7054| > > I set the brand-new fabric-ca-server-config.yaml in this way: > > |#db:#type:sqlite3 #datasource:fabric-ca-server.db #tls:#enabled:false > #certfiles:#client:#certfile:#keyfile:db:type:postgres > datasource:host=localhost port=5433user=fabmnet_admin password=password > dbname=fabmnetdb sslmode=verify-full| Shouldn't the TLS info also be there for the Postgres datasource: https://hyperledger-fabric-ca.readthedocs.io/en/release-1.4/users-guide.html#postgresql As to below, you will not get logs as you are never connecting to the database. Those errors get sent to the console. You are fighting two issues, role permissions and SSL certs. I would deal with one a time. Drop the SSL requirement until you can verify a connection and database creation. Then deal with the SSL issues. > > and in /etc/postgresql/11/fabmnet/postgresql.conf : > > |ssl =onssl_cert_file > ='/home/marco/fabric/fabric-ca/ca-cert.pem'ssl_key_file > ='/home/marco/fabric/fabric-ca/msp/keystore /IssuerSecretKey'| > > After systemctl restart postgresql, I tried to start the fabric-ca-server: > > |(base)marco@pc:~/fabric/fabric-ca$fabric-ca-server start-b > admin:adminpw 2019/09/2615:56:50[INFO]Configuration > filelocation:/home/marco /fabric/fabric-ca/fabric-ca-server-config.yaml > 2019/09/2615:56:50[INFO]Starting server inhome > directory:/home/marco/fabric/fabric-ca 2019/09/2615:56:50[INFO]Server > Version:1.4.42019/09/2615:56:50[INFO]Server > Levels:&{Identity:2Affiliation:1Certificate:1Credential:1RAInfo:1Nonce:1}2019/09/2615:56:50[INFO]The > CA keyandcertificate already exist 2019/09/2615:56:50[INFO]The > keyisstored byBCCSP provider 'SW'2019/09/2615:56:50[INFO]The certificate > isat:/home/marco/fabric /fabric-ca/ca-cert.pem > 2019/09/2615:56:50[WARNING]Failed > toconnecttodatabase'fabmnetdb'2019/09/2615:56:50[WARNING]Failed > toconnecttodatabase'postgres'2019/09/2615:56:50[WARNING]Failed > toconnecttodatabase'template1'2019/09/2615:56:50[ERROR]Error occurred > initializing database:Failed toconnecttoPostgres database.Postgres > requires connecting toa specific database,the followingdatabases were > tried:[fabmnetdb postgres template1].Please createone ofthese > databasebefore continuing 2019/09/2615:56:50[INFO]Home directory > fordefaultCA:/home/marco /fabric/fabric-ca > 2019/09/2615:56:50[INFO]Operation Server Listening > on127.0.0.1:94432019/09/2615:56:50[INFO]Listening onhttp://0.0.0.0:7054| > > Before I also removed all the previous content of > /var/log/postgresql/postgresql-11-fabmnet.log to have a clean situation. > But strangely now I do not get any new logging information in > postgresql-11-fabmnet.log > > So. I think there must be something to fix in the interface between > fabric-ca-server and PostgreSQL-11 db. In fabric-ca-server-config.yaml, > in postgresql.conf, in both or somewhere else. > > > > > > > -- Adrian Klaver adrian.klaver@aklaver.com