Subject: Writing to Aerospike from Spark with bulk write with user authentication fails

Aerospike Enterprise version if anyone has worked with user authentication!

As far as I know one can create a client with aerospike authentication as
follows that works for single put

import com.aerospike.spark.sql._
import com.aerospike.client.Bin
import com.aerospike.client.Key
import com.aerospike.client.Value
import com.aerospike.client.AerospikeClient
import com.aerospike.client.Host
import com.aerospike.client.policy.ClientPolicy
import com.aerospike.client.policy.WritePolicy

var hosts = {
    new Host("rhes75", 3000)

var dbHost = "rhes75"
var dbPort = "3000"
var dbConnection = "xyz"
var namespace = "trading"
var dbPassword = "xxxxxx"
var dbSet = "testSet"
val policy = new ClientPolicy()
policy.user = dbConnection
policy.password = dbPassword
val client = new AerospikeClient(policy, hosts)
val TEST_COUNT = 100
for (i <- 1 to TEST_COUNT) {
   val key = new Key(namespace, namespace, dbSet, i)
   client.put(null, key,
   new Bin("one", i),
   new Bin("two", "two:"+i),
   new Bin("three", i.toDouble)
However, I have no way passing of user credential when I am doing bulk
write using a dataframe

  df.write.      mode(SaveMode.Overwrite).
format("com.aerospike.spark.sql").      option("aerospike.namespace",
namespace).      option("aerospike.set", dbSet).
option("aerospike.updateByKey", "id").
option("aerospike.keyColumn", "__id").
option("aerospike.batchMax", 5000).      option("aerospike.keyPath",
"/etc/aerospike/features.conf").      save()

when I turn off security in conf file in aerospike this works fine.
Otherwise I get the following error:

Caused by: com.aerospike.client.AerospikeException$Connection: Error -8:
Failed to connect to host(s): rhes75 3000 Error 80: not authenticated

Any ideas how this can be done with user authentication



Dr Mich Talebzadeh

LinkedIn *
*Disclaimer:* Use it at your own risk. Any and all responsibility for any
loss, damage or destruction of data or any other property which may arise
from relying on this email's technical content is explicitly disclaimed.
The author will in no case be liable for any monetary damages arising from
such loss, damage or destruction.