Made below change to /etc/dse/spark/hive-site.xml on each node in the 4 node cluster.
<property>
<name>fs.s3.awsAccessKeyId</name>
<value>****</value>
</property>
<property>
<name>fs.s3.awsSecretAccessKey</name>
<value>****</value>
</property>
<property>
<name>fs.s3n.awsAccessKeyId</name>
<value>****</value>
</property>
<property>
<name>fs.s3n.awsSecretAccessKey</name>
<value>****</value>
</property>
<property>
<name>fs.s3a.awsAccessKeyId</name>
<value>****</value>
</property>
<property>
<name>fs.s3a.awsSecretAccessKey</name>
<value>****</value>
</property>
Set below ENV variables on the node from where spark thrift server and spark-beeline client runs
export AWS_SECRET_ACCESS_KEY=****
export AWS_ACCESS_KEY_ID=*****
Started Spark thrift server as below
dse -u cassandra -p ***** spark-sql-thriftserver start --conf spark.cores.max=2 --conf spark.executor.memory=2G --conf
spark.driver.maxResultSize=1G --conf spark.kryoserializer.buffer.max=512M --conf spark.sql.thriftServer.incrementalCollect=true
Created a table from Spark Beeline with S3 bucket as source
dse -u cassandra -p ***** spark-beeline --total-executor-cores 2 --executor-memory 2G
The log file is at /home/ubuntu/.spark-beeline.log
Beeline version 1.2.1.2_dse_spark by Apache Hive
beeline> !connect jdbc:hive2://localhost:10000 cassandra
Connecting to jdbc:hive2://localhost:10000
Enter password for jdbc:hive2://localhost:10000: ****************
Connected to: Spark SQL (version 1.6.3)
Driver: Hive JDBC (version 1.2.1.2_dse_spark)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://localhost:10000> CREATE EXTERNAL TABLE test_table (name string,phone string) PARTITIONED BY(day date)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION 's3a://hive-getsimpl/test';
I get the below error
Error: org.apache.spark.sql.execution.QueryExecutionException: FAILED:
Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask.MetaException (message:com.amazonaws.services.s3.model.AmazonS3Exception:
Status Code: 403, AWS Service: Amazon S3, AWS Request ID: 29991E2338CC6B49, AWS Error Code: null,
AWS Error Message: Forbidden, S3 Extended Request ID: kidxZNQI73PBsluGoLQlB4+VEdIx0t82Y/J/q69NA18k8MnSILEyo5riCuj3QcEiGiFRqB4rAbc=) (state=,code=0)
Note: The AWS keys are valid and have been working with other python scripts
the config names used by s3a are different; you need to set fs.s3a.access.key
and fs.s3a.secret.key
. Don't touch the environment vars, as they will only add confusion.