Hi guys, i am trying to have algorand indexer in k8s in HA mode…
I have postgresql in HA mode
So if i turn 3 instances of algorand indexer connected to the same database, I assume that all 3 instances are trying to get sync with the algod server, and only one succeed to insert the block…
However when they try to insert the block and do not succeed they crash
{"error":"AddBlock() err: TxWithRetry() err: attemptTx() err: AddBlock() adding block round 19152593 but next round to account is 19152594","level":"error","msg":"adding block 19152593 to database failed","time":"2022-01-15T11:41:31Z"}
Is there any way how i can turn some indexers just to do the query part to the database and not trying to sync with the algod server? i think that might solve the issue… or perhaps if anybody already resolved the TxWithRetry crash before, can he share his insides please?
Yes, you can have one indexer instance writing and as many as you want reading the database.
Just use the argument --no-algod instead of providing an algod URL/token.
As you discovered, you cannot have multiple indexers writing.
i have setup the indexer in 3 instances in read only mode
however, when i run write instance in single mode, it still fails at
{"error":"AddBlock() err: TxWithRetry() err: attemptTx() err: AddBlock() adding block round 19152593 but next round to account is 19152594","level":"error","msg":"adding block 19152593 to database failed","time":"2022-01-15T11:41:31Z"}
this is causing the indexer to be out of sync very often… any idea how to prevent this error?
the most stable solution for me is to run 2 indexers in write mode, and watch if port 8980 is open every second or so