Error in connecting python client "Exception during establishing a SSL connection: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record" - python-3.x

I am trying to get a python ElasticSearch client to connect to a local OpenSearch server that is running via docker. Am unable to connect and keep getting
opensearch-node1 | [2021-09-25T00:09:09,526][ERROR][o.o.s.s.h.n.SecuritySSLNettyHttpServerTransport] [opensearch-node1] Exception during establishing a SSL connection: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record:
Installed OpenSearch locally sing docker following these instructions https://opensearch.org/downloads.html
Tried various ways to get the python client to connect but all are failing.
# es = Elasticsearch(timeout=600, hosts="http://localhost:9200", http_auth=('admin', 'admin'), use_ssl=False, verify_certs=False)
es = Elasticsearch(timeout=600, hosts=["http://localhost:9200"])
es.ping()
python version: 3.9.7
ElasticSearch python lib: 7.15.0
Has anybody experiences this?
**** Figured it out ****
Need to have a client of at most 7.13.4 as per the docs opensearch.org/docs/clients/index
and as per this issues github.com/opendistro-for-elasticsearch/sample-code/issues/242, have to initiate the client like this for local dev
es = Elasticsearch(['https://admin:admin#localhost:9200/'],
use_ssl=False,
verify_certs=False,
ssl_show_warn=False)

Related

Just installed mongodb cant connect to server on Ubuntu 22.04

I just completed an installation of mongodb in my computer and, after starting and enabling it I keep getting the same error:
MongoDB shell version v4.2.23
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2022-11-10T16:25:32.787+0100 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:353:17
#(connect):2:6
2022-11-10T16:25:32.788+0100 F - [main] exception: connect failed
2022-11-10T16:25:32.788+0100 E - [main] exiting with code 1
I uninstalled and installed multiple times and tried solutions that worked for other people in similar posts but I can not make it work.
I have a feeling it have something to do with the port it is looking for (27017) but I do not know how to check if that is the problem and, if so, how to fix it.
Thanks!
Here are a few things to consider:
Check if the MongoDB process is running (you can verify using ps, netstat (check listen port) command in the server.
See if your MongoDB service runs locally. That is because by default, the listen address of MongoDB is localhost/loopback.
Check if the firewall is running and you have allowed the port.
Verify if you are able to use telnet to command the port 27017 from the application server.

Databricks DBT Runtime Error, cannot connect to Database. Maybe an SSL error?

I have a custom Databricks instance with a Domain name that points to an AWS Load Balancer. When I put that information in using either the HTTP instructions here or the databricks cluster instructions here, I get this response in the DBT CLI:
Connection:
host: https://subdomain.domain.com
port: 443
cluster: 123456-stuff00003
endpoint: None
schema: default
organization: 0
16:40:39.470091 [debug] [MainThread]: Acquiring new spark connection "debug"
16:40:39.471632 [debug] [MainThread]: Using spark connection "debug"
16:40:39.472524 [debug] [MainThread]: On debug: select 1 as id
16:40:39.472953 [debug] [MainThread]: Opening a new connection, currently in state init
Connection test: [ERROR]
1 check failed:
dbt was unable to connect to the specified database.
The database returned the following error:
>Runtime Error
Database Error
failed to connect
Unfortunately, DBT's debugging logs are terrible and I am not entirely sure why it is failing. I do know that when I connect to the cluster via Intellij I have to provide the CA file, the Client Certificate file, and the Client key file, because I am using a self-signed SSL cert (unfortunately, the self signed cert is required). Also, when defining my ~/.databrickscfg file I have to provide the argument insecure = true.
I've encountered this issue recently and I fixed it by installing root certificates by executing the "Install Certificates.command" script in the python home directory used to run dbt.
Laurent

ibm_db for nodejs: using TCP/IP works fine but using SSL reports SQL30081N A communication error "selectForConnectTimeout"

In a Node app with ibm_db, I am trying to connect to Db2 Warehouse on Cloud using ssl connection string.
On CentOS 7.8, using SSL connection string as below works fine.
var connStr = "DATABASE=BLUDB;HOSTNAME=dashdb-xxxxxxxxxxxx.xxxxx.xxx.bluemix.net;PORT=50001;PROTOCOL=TCPIP;UID=XXXXXXXXX;PWD=XXXXXXXXXXX;Security=SSL"
However, on RHEL 7.2, using SSL connection string does not work, SQL30081N is reported. It is same source code working on CentOS 7.8.
[IBM][CLI Driver] SQL30081N A communication error has been detected.
Communication protocol being used: "TCP/IP".
Communication API being used: "SOCKETS".
Location where the error was detected: "XXX.XX.XXX.XXX".
Communication function detecting the error: "selectForConnectTimeout".
Protocol specific error code(s): "115", "*", "*". SQLSTATE=08001\n
As a test, changing SSL connection string to TCP/IP connection string as below, it works on RHEL 7.2.
var connStr = "DATABASE=BLUDB;HOSTNAME=dashdb-xxxxxxxxxxxx.xxxxx.xxx.bluemix.net;UID=XXXXXXXXX;PWD=XXXXXXXXXXX;PORT=50000;PROTOCOL=TCPIP";
On each environment, installed the latest IBM ODBC and CLI Driver via npm install ibm_db.
I think the certificate file for ssl connection is bundled with the driver package and will be used for connections, so ssl configuration does not required manually.
Or, would I need to configure anything else for using SSL on RHEL 7.2 ?

pymongo 3.8 not work with mondob 4 and python 3.5

Connect to mongodb 4 server with pymongo 3.8 but get serverselection timeout error
pymongo.errors.ServerSelectionTimeoutError: IP:host: [Errno 104] Connection reset by peer
I have similar issue.
I could not connect at first then changed to master host.
After that the connection problem fixed. However, I still cannot CRUD or list collections. It throws
OperationFailure: Authentication failed.

Using Firefox on Mac to launch Analytics for Apache Hadoop and receive Secure Connection Failed

Using Firefox on Mac to launch Analytics for Apache Hadoop and receive Secure Connection Failed: An error occurred during a connection to bi-hadoop-prod-2215.services.dal.bluemix.net:9443

Resources