Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Error #146

Open
krisnamourt opened this issue Apr 4, 2021 · 6 comments
Open

Connection Error #146

krisnamourt opened this issue Apr 4, 2021 · 6 comments

Comments

@krisnamourt
Copy link

I'm trying to build a docker image with this data wrapper

from postgres:13.2

RUN apt -y update &&  apt -y upgrade
RUN apt-get install -y python python-pip
RUN apt-get install -y postgresql-11-python-multicorn 
RUN apt-get install -y build-essential libcurl4-openssl-dev libpq-dev pkg-config wget
RUN apt-get install -y git cmake make gcc libzstd-dev libssl-dev libsasl2-dev
RUN apt-get install -y python-setuptools
#RUN git clone https://github.com/asya999/yam_fdw.git && cd yam_fdw && python setup.py install
RUN apt-get install -y libmongoc-dev  libbson-dev 
RUN apt install -y postgresql-server-dev-13
RUN git clone https://github.com/EnterpriseDB/mongo_fdw.git --recursive && cd mongo_fdw && sed -i "s|cmake3|cmake|" autogen.sh && ./autogen.sh --with-master && make -f Makefile.meta && make -f Makefile.meta install

Everythins goes fine, and I also able to create the extension, the foreign server and table but when I try to query I got this error

Hint: Mongo error: "Authentication failed."

I'm trying to access another docker container locally

docker run --rm --name some-mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret -d mongo:3.0.15

I tryed by IP 172.17.0.1 and got the Authentication failed

When I tried localhost I got

Hint: Mongo error: "No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on 'localhost:27017']"

and when I tried mongodb+srv://172.17.0.1 I got a new error

Hint: Mongo driver connection error.

I don't know if I missed some configuration or not or if postgres 13 has no support

@vaibhavdalvi93
Copy link

Thanks @krisnamourt for reporting an issue.

The Mongo fdw supports Postgres 13.

Hint: Mongo error: "Authentication failed."
You may get authentication failure due to wrong username and/or password. Please confirm whether you are using 'username' and 'password' options while creating user mapping?. If so then please re-verify once.
To investigate this failure further, MongoDB logs may help. Those are located at '/var/log/mongodb/mongod.log' in CentOS. If possible, please share with us.

Hint: Mongo error: "No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on 'localhost:27017']"
The error message suggests that the driver can’t connect to a MongoDB instance locally, indicating that it isn’t running or isn’t accepting any connections.
Please confirm that you can connect to that address via another method (e.g. mongo shell) and retry. You can use following command to connect to mongo shell:
mongo localhost:27017

Hint: Mongo driver connection error.
This is not the correct way to provide the address. If we give any address with this format then it results into this error.

Also, check if MongoDB is running on mentioned address(172.17.0.1) as well. Kindly, make sure bindIp in mongod.conf is correctly added.

Please let us know the version of MongoDB server.

@krisnamourt
Copy link
Author

Ok, I'm trying to access another container in my manchine
docker run --rm --name some-mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret -d mongo:3.0.15

I was able to access this mongodb from the shell but not from the postgres

@kashifzeeshan
Copy link

I'm trying to build a docker image with this data wrapper

from postgres:13.2

RUN apt -y update &&  apt -y upgrade
RUN apt-get install -y python python-pip
RUN apt-get install -y postgresql-11-python-multicorn 
RUN apt-get install -y build-essential libcurl4-openssl-dev libpq-dev pkg-config wget
RUN apt-get install -y git cmake make gcc libzstd-dev libssl-dev libsasl2-dev
RUN apt-get install -y python-setuptools
#RUN git clone https://github.com/asya999/yam_fdw.git && cd yam_fdw && python setup.py install
RUN apt-get install -y libmongoc-dev  libbson-dev 
RUN apt install -y postgresql-server-dev-13
RUN git clone https://github.com/EnterpriseDB/mongo_fdw.git --recursive && cd mongo_fdw && sed -i "s|cmake3|cmake|" autogen.sh && ./autogen.sh --with-master && make -f Makefile.meta && make -f Makefile.meta install

Everythins goes fine, and I also able to create the extension, the foreign server and table but when I try to query I got this error

Hint: Mongo error: "Authentication failed."

I'm trying to access another docker container locally

docker run --rm --name some-mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret -d mongo:3.0.15

I tryed by IP 172.17.0.1 and got the Authentication failed

When I tried localhost I got

Hint: Mongo error: "No suitable servers found (serverSelectionTryOnce set): [connection refused calling ismaster on 'localhost:27017']"

and when I tried mongodb+srv://172.17.0.1 I got a new error

Hint: Mongo driver connection error.

I don't know if I missed some configuration or not or if postgres 13 has no support

I am not able to build the image in the above mentioned DockerFile and getting the following error

Done
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC --std=c99 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -Ijson-c -DMETA_DRIVER -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o connection.o connection.c
connection.c:15:10: fatal error: postgres.h: No such file or directory
 #include "postgres.h"
          ^~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: connection.o] Error 1
The command '/bin/sh -c git clone https://github.com/EnterpriseDB/mongo_fdw.git --recursive && cd mongo_fdw && sed -i "s|cmake3|cmake|" autogen.sh && ./autogen.sh --with-master && make -f Makefile.meta && make -f Makefile.meta install' returned a non-zero code: 2
[root@kashif-hadoop-hive-image-centos7 mongo_146]# 

can you please check if any thing is missing in the Dockerfile commands.


from postgres:13.2

RUN apt -y update &&  apt -y upgrade
RUN apt-get install -y python python-pip
RUN apt-get install -y postgresql-11-python-multicorn 
RUN apt-get install -y build-essential libcurl4-openssl-dev libpq-dev pkg-config wget
RUN apt-get install -y git cmake make gcc libzstd-dev libssl-dev libsasl2-dev
RUN apt-get install -y python-setuptools
#RUN git clone https://github.com/asya999/yam_fdw.git && cd yam_fdw && python setup.py install
RUN apt-get install -y libmongoc-dev  libbson-dev 
RUN apt install -y postgresql-server-dev-13
RUN git clone https://github.com/EnterpriseDB/mongo_fdw.git --recursive && cd mongo_fdw && sed -i "s|cmake3|cmake|" autogen.sh && ./autogen.sh --with-master && make -f Makefile.meta && make -f Makefile.meta install

@krisnamourt
Copy link
Author

Hi man, I made some Dockerfile version the last one build ok to me, but there's this other version too

from postgres:13.2

RUN apt -y update &&  apt -y upgrade
RUN apt-get install -y python python-pip
RUN apt-get install -y postgresql-11-python-multicorn 
RUN apt-get install -y build-essential libcurl4-openssl-dev libpq-dev pkg-config wget
RUN apt-get install -y git cmake make gcc libzstd-dev libssl-dev libsasl2-dev
RUN apt-get install -y python-setuptools
RUN apt-get install -y libmongoc-dev  libbson-dev 
RUN apt install -y postgresql-server-dev-13
RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.0/mongo-c-driver-1.17.0.tar.gz && tar xzf mongo-c-driver-1.17.0.tar.gz && cd mongo-c-driver-1.17.0 && mkdir cmake-build && cd cmake-build && cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
RUN git clone https://github.com/EnterpriseDB/mongo_fdw.git ss&& cd mongo_fdw && sed -i "s|cmake3|cmake|" autogen.sh && ./autogen.sh --with-master && make -f Makefile.meta && make -f Makefile.meta install

Also build successfully, same erro when I try to configure mongo_fdw

@krisnamourt
Copy link
Author

Hey man, using a docker-compose I was able to get an error message

mongo_1    | 2021-04-11T15:08:25.821+0000 I ACCESS   [conn3] SCRAM-SHA-1 authentication failed for mongoadmin on db from client 172.19.0.1 ; UserNotFound Could not find user mongoadmin@db
mongo_1    | 2021-04-11T15:08:25.822+0000 I NETWORK  [conn3] end connection 172.19.0.1:46002 (1 connection now open)

I have to chance the ecnrypt key?

@krisnamourt
Copy link
Author

Well, I don't know why but if I use another user different from super user works.

@andreasscherbaum andreasscherbaum changed the title Conenction Error Connection Error Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants