ankane / dexter

The automatic indexer for Postgres
MIT License
1.9k stars 47 forks source link

Bad Request when installing command line tool on Ubuntu #42

Closed levinotik closed 2 years ago

levinotik commented 2 years ago

I am following the instructions here and am getting a 400. Any ideas on how to resolve that?

root@db:/tmp/hypopg-1.3.1# wget -O /etc/apt/sources.list.d/dexter.list https://dl.packager.io/srv/pghero/dexter/master/installer/ubuntu/$(. /etc/os-release && echo $VERSION_ID).repo
--2022-08-03 19:21:21--  https://dl.packager.io/srv/pghero/dexter/master/installer/ubuntu/9.repo
Resolving dl.packager.io (dl.packager.io)... 178.63.71.248
Connecting to dl.packager.io (dl.packager.io)|178.63.71.248|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2022-08-03 19:21:22 ERROR 400: Bad Request
levinotik commented 2 years ago

Actually, could I just install the command line tool outside of the DB server? In my case, I'm running PG in a Docker container. If I'm able to run the CL tool on the host machine (my Mac), I can just do that.

levinotik commented 2 years ago

make and make install seemed to succeed on the DB server, but then when running dexter on the host machine, I get:

> tail -F -n +1 my-log-file | dexter -h localhost -p 5432 -U # and so on....
Install HypoPG first: https://github.com/ankane/dexter#installation
ankane commented 2 years ago

Hey @levinotik, for the 400 error, it looks like $VERSION_ID is 9 when it should be something like 20.04. What does cat /etc/os-release show?

Also, the command line tool can be run on a separate machine from the database server, but the HypoPG extension needs to be installed on the database server (the make commands need to be run there).

levinotik commented 2 years ago

Thanks for the reply @ankane Looks like 9 is correct though:

root@db:/tmp/hypopg-1.3.1# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

In any event, I did install the CL tool on the host machine and installed HypoPG (seemingly successfully) on the DB server, but still get that error Install HypoPG first: https://github.com/ankane/dexter#installation

ankane commented 2 years ago

It looks like you're on Debian, so you'll want to follow the Debian instructions.

For HypoPG, try using psql to connect to the DB server with same credentials you're passing to Dexter and running the following to verify that it's installed:

SELECT * FROM hypopg_list_indexes;

(should return 0 rows)

levinotik commented 2 years ago

@ankane hah I did realize that after I sent. Hadn't realized that HypoPG was available as a package using the PGDG packages, thanks a lot!

levinotik commented 2 years ago

SELECT * FROM hypopg_list_indexes; does return 0 rows now and everything seems to be setup correctly. When tailing the logs, all I see is Processing 0 new query fingerprints.

Started
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints

Update: installed Dexter on the DB container and seems to be working now!

Started
Processing 0 new query fingerprints
Processing 1 new query fingerprints
No new indexes found
Processing 0 new query fingerprints
ankane commented 2 years ago

Great, glad it's working!