Couchbase spark connecter unable to connect

spark = SparkSession \
    .builder \
    .master('local[*]') \
    .config('spark.jars.packages', 'com.couchbase.client:spark-connector_2.12:3.3.1,com.microsoft.azure:azure-cosmosdb-spark_2.4.0_2.11:1.3.5') \
    .config("spark.couchbase.connectionString", "couchbases://myconnectionstring")\
    .config("spark.couchbase.username", "user")\
    .config("com.couchbase.bucket.travel-sample", "") \
    .config("spark.couchbase.password", "mypass")\
    .getOrCreate() 
    
    
df = spark.read.format("couchbase.query").option("bucket","travel-sample").load()

When i execute this throws error:

23/02/27 18:26:11 ERROR io: [com.couchbase.io][SaslAuthenticationFailedEvent][28ms] Authentication Failure - Potential causes: invalid credentials or if LDAP is enabled ensure PLAIN SASL mechanism is exclusively used on the PasswordAuthenticator (insecure) or TLS is used (recommended) {"circuitBreaker":"DISABLED","coreId":"0xe4be866c00000001","remote":"svc-dqis-node-001.czemkgrfh9uqqdor.cloud.couchbase.com:11207","status":"UNKNOWN","type":"KV","xerror":{"ref":"412f8ccc-2bc5-4c7a-4799-22ba14c9e930"}}

The id and pass are correct as I am able to connect with them on the capella instance and the connectionstring is directly copied from the network tab from couchbase.

This looks like the service name (and not the data node). So it would appear that the DNS SRV lookup is failing. Try connecting with SDK Doctor SDK Doctor | Couchbase Docs and look for clues in the diagnostics.

I executed a DNS-SRV lookup on

nslookup -q=SRV _couchbases._tcp.cb.czemkgrfh9uqqdor.cloud.couchbase.com

and it returned svc-dqis-node-001.czemkgrfh9uqqdor.cloud.couchbase.com, so I think the DNS SRV is working ok and the resolved address is correct. SDK Doctor is a good idea and may shed some light here.

@rusbi the config option for the bucket is .config("spark.couchbase.implicitBucket", "travel-sample") rather than .config("com.couchbase.bucket.travel-sample", ""). I’m not sure if that’s what’s causing your error though.

1 Like

Changing the config did not help. Let me try the SDK doctor.

SDK doctory says.

[WARN] No certificate authority file specified (--tls-ca), skipping server certificate verification for this run.
[ERRO] Failed to fetch configuration via cccp from `svc-dqis-node-001.dw6zqiavq4ah8llj.cloud.couchbase.com:11207` (error: invalid bucket name/password)
[ERRO] All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible

Found multiple issues, see listing above

Although all information is valid and i am not providing a bucketname. User pass are fine I have logged in capella using them.

@rusbi just to check the basics - you aren’t using your email address as the username right? That’s for logging in to the Capella admin UI. You then create a database user and use those credentials from your app.

I have created a database access with username and password with all scopes and and read/write. still the sdk-doctor gives:


Summary:
[WARN] No certificate authority file specified (--tls-ca), skipping server certificate verification for this run.
[ERRO] Failed to fetch configuration via cccp from `svc-dqis-node-001.dw6zqiavq4ah8llj.cloud.couchbase.com:11207` (error: failed to select bucket `` (status: 1))
[ERRO] All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible

Found multiple issues, see listing above.

What happens when you execute

curl --insecure https://svc-dqis-node-001.dw6zqiavq4ah8llj.cloud.couchbase.com:11207

from where your client is? It should give

curl: (52) Empty reply from server

If instead it hangs and eventually gives

curl: (7) Failed to connect to svc-dqis-node-001.dw6zqiavq4ah8llj.cloud.couchbase.com port 11207: Operation timed out

this usually indicates that the ip-address of the client is not allowed. See Configure Allowed IP Addresses | Couchbase Docs

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.