timescale / timescaledb-parallel-copy

A binary for parallel copying of CSV data into a TimescaleDB hypertable

Home Page:https://www.timescale.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Always getting password authentication fail

Lotiara opened this issue · comments

Hi,
I am always getting a password authentication fail, no matter
which account (postgres or others).
I know you can specify the --connection option, but no password can be passed as a parameter.
Wondering what I am doing wrong.
Bye and good job.

I am receiving this as well, however, my issue appears to be tied to the lack of non-default port support. I provided my command and response below.

Am I missing a flag / setting?

CONNECTION="host=$DB_HOST user=$DB_USER password=$DB_PASSWORD port=$DB_PORT sslmode=require"
COLUMNS="active"
timescaledb-parallel-copy --db-name main \
  --table mytable \
  --connection $CONNECTION --reporting-period 2s --columns $COLUMNS \
  --copy-options "CSV NULL ''" --workers 1 --file /tmp/data.csv

Error response with IP address redacted.

panic: dial tcp x.x.x.x:5432: connect: connection timed out
goroutine 19 [running]:
github.com/jmoiron/sqlx.MustConnect(...)
        /go/src/github.com/jmoiron/sqlx/sqlx.go:650
main.processBatches(0xc00008a2a4, 0xc00008e1e0)
        /go/src/github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy/main.go:206 +0xd2f
created by main.main
        /go/src/github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy/main.go:124 +0x181

@blagojts could you have a look?

@Lotiara When trying to connect to the database you need to use the --connection flag, but supply the connection string as a keyword-value type of connection string. More info here https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING, a bit lower in the same link you will find all the supported keywords (Section: 34.1.1.1)

@JD0X I tried the following script

DB_HOST=localhost
DB_USER=postgres
DB_PASSWORD=postgres
DB_PORT=5432
CONNECTION="host=$DB_HOST user=$DB_USER password=$DB_PASSWORD port=$DB_PORT sslmode=require"
echo $CONNECTION
timescaledb-parallel-copy -file k.csv -skip-header -columns a,b,c -connection $CONNECTION -db-name=postgres

And it managed to connect to my local timescale instance.

Can you try the same string "CONNECTION="host=$DB_HOST user=$DB_USER password=$DB_PASSWORD port=$DB_PORT sslmode=require dbname=$DB_NAME" with psql and see if it connects psql $CONNECTION

Sorry for the delay @blagojts, I was traveling last week.

I received the same error as I shared above executing your script. Your testing environment is using the default postgres port (5432). The issue I am running into is due to a custom, non-default postgres port being used.

Do you mind trying this on a custom port and reporting back?

Hi, password can always be passed by String "host=*** user=*** password=***"

Hi @Lotiara and others:

I have made a PR here #20 that will hopefully make this kind of thing easier to do. You can set appropriate environment variables for password, port, whatever like you would with psql and it should end up working.

@JD0X and @Lotiara this has been merged with #20.