How to set up PostgreSQL database to run indexer in Testnet?

I’m trying to set up an indexer in Testnet for searching purposes without having to use API (due to limitation about how many transactions I can search at a time). I have downloaded the binaries file, extract it. But I am currently stuck at the setting up PostgreSQL database part. Here are a few questions I have:

  1. Is it true that I have to create a database, user, role in PostgreSQL prior to run the indexer?
  2. Is there any naming convention I have to follow while creating the above items?
  3. In this command I found from Install the Indexer:
# start with local data directory
$ ./algorand-indexer daemon -P "host=[your-host] port=[your-port] user=[uname] password=[password] dbname=[ledgerdb] sslmode=disable" --algod=~/node/data

# start with networked Algorand node
$ ./algorand-indexer daemon -P "host=[your-host] port=[your-port] user=[uname] password=[password] dbname=[ledgerdb] sslmode=disable" --algod-net="http://[your-host]:[your-port]" ---algod-token="[your-api-token]

what are user name, password? Where do I get these from?
4. Does the indexer file and the node file has to be in the same system user? Or anything about location of the files I should pay attention to?

Thank you,

  1. Yes, that’s better practice
  2. No naming convention
  3. User and password of the postgresql user you created
  4. with the first option “start with local data directory”, indexer and algod need to be on the same computer and running with the same user (or with compatible users). With the second option, there are no such restrictions: indexer and algod can be run from two different VMs, as long as the indexer VM can access the algod endpoint.

Screen Shot 2021-07-05 at 5.45.15 PM
I used the second option and replace the the parameter below:

  • host: the same as the one I got from
  • port: the default port in postgres
  • user and password: from the one I create in postgresSQL using the adduser command
  • algod-net and algod-token I got from and algod.token inside the node/data folder

and when I ran, only the “>” showed up and nothing happened. What can be the issue here?

The last quote is " is not the correct quote character but another similar character.
Replace it by " and it should work.

Oh I see. I fixed that an it ran but I got a different problem. It’s about authentication. I do understand pretty much the error’s saying that the password I provided was not right. But I am pretty sure it’s the one I enter when I created the user in psql.

  1. I got this problem trying to install in indexer in a private network before and have never been able to figured out why. What should I do? I have tried to create a different user and put it in the parameter but it did not work.

  2. Also the user I create in Linux system is different from the user I create in psql, is that correct? I am confused because I remember reading somewhere about using ident based authentication and that the Linux user name and role and database in Postgres should be the same. I am not quite familiar with it.

How did you create the user?
It needs to be a PostgreSQL user, not a Linux user.

I follow this instruction from digitalocean

Also another issue has arisen. When I install a new node, set it to be an archival node without doing fast catchup. The node try to download every block that has been generated in the blockchain. My VM memory is currently full now and I cannot stop the node. What should I do? Should I delete the node file and reinstall it in a different way?

The node needs to be archival, so you need a larger SSD to be able to store everything.
See for the sizes you need.

1 Like