near / near-indexer-for-explorer

Watch NEAR network and store all the data from NEAR blockchain to PostgreSQL database
https://near-indexers.io/docs/projects/near-indexer-for-explorer
GNU General Public License v3.0
123 stars 56 forks source link

OperationalError: FATAL: remaining connection slots are reserved for non-replication superuser connections #289

Closed Bha91 closed 1 year ago

Bha91 commented 1 year ago

Hi when I used this code to connect the database I got the above error :

import psycopg2

# postgres://public_readonly:nearprotocol@35.184.214.98/testnet_explorer
conn = psycopg2.connect(host="104.199.89.51", database="mainnet_explorer", user="public_readonly", password="nearprotocol")

cur = conn.cursor()

Python version: 3.7.13 psycopg2: 2.7.6.1

khorolets commented 1 year ago

Hey @Bha91!

This message means what it says. The database connection slots are over.

From the README:

NOTE: Please, keep in mind that the access to the database is shared across everyone in the world, so it is better to make sure you limit the amount of queries and individual queries are efficient.

Also, the README connections string uses domain instead of IP:

postgres://public_readonly:nearprotocol@testnet.db.explorer.indexer.near.dev/testnet_explorer

I've checked the connection with the command in my terminal:

$ psql "postgres://public_readonly:nearprotocol@testnet.db.explorer.indexer.near.dev/testnet_explorer"

and it works. Try changing.

Though if that does not work with this message, you need to try later when some connection slots are free.

Bha91 commented 1 year ago

change IP to domain solved the issue