{"id":18046825,"url":"https://github.com/kairen/spark-ceph-example","last_synced_at":"2026-01-24T16:45:10.976Z","repository":{"id":91832827,"uuid":"85711836","full_name":"kairen/spark-ceph-example","owner":"kairen","description":"Learning how to integrate Ceph S3 with Spark.","archived":false,"fork":false,"pushed_at":"2019-06-20T18:29:11.000Z","size":19,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T21:52:52.938Z","etag":null,"topics":["ceph","java","librados","rados","spark"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kairen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-21T14:28:10.000Z","updated_at":"2019-12-17T13:12:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2b68a33-1a30-418c-bec1-7313f0b9b222","html_url":"https://github.com/kairen/spark-ceph-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kairen/spark-ceph-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kairen%2Fspark-ceph-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kairen%2Fspark-ceph-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kairen%2Fspark-ceph-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kairen%2Fspark-ceph-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kairen","download_url":"https://codeload.github.com/kairen/spark-ceph-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kairen%2Fspark-ceph-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28732010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ceph","java","librados","rados","spark"],"created_at":"2024-10-30T19:09:27.293Z","updated_at":"2026-01-24T16:45:10.969Z","avatar_url":"https://github.com/kairen.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spark \u0026 Ceph\nThis repo contains a collection of the files for launching a Ceph cluster and learning how to integrate Ceph S3 with Spark.\n\nPrerequisites:\n\n* [Vagrant](https://www.vagrantup.com/downloads.html): \u003e= 2.0.0.\n* [VirtualBox](https://www.virtualbox.org/wiki/Downloads): \u003e= 5.0.0.\n\n## Create a Ceph cluster\nTo create a VM using vagrant with VirtualBox. When the operation is completed, execute `vagrant ssh \u003cname\u003e` command to enter VM:\n```sh\n$ vagrant up\n$ vagrant ssh ceph-aio\n```\n\n## Spark s3a example\nThis guide is talking about Spark get data from S3, you can follow below steps to produce an environment used to testing.\n\nFirst, go to `/vagrant` dir and run:\n```sh\n$ cd /vagrant\n$ ./spark-initial.sh\n$ jps\n22194 SecondaryNameNode\n22437 Jps\n21350 ResourceManager\n21469 NodeManager\n21998 DataNode\n21822 NameNode\n```\n\nAnd then put a data file to S3 using `s3client`:\n```sh\n$ ./create-s3-account.sh\n$ source test-key.sh\n$ ./s3client create files\n$ cat \u003c\u003cEOF \u003e words.txt\nAA A CC AA DD AA EE AE AE\nCC DD AA EE CC AA AA DD AA EE AE AE\nEOF\n\n$ ./s3client upload files words.txt /\nUpload [words.txt] success ...\n```\n\nNow execute `spark-shell` to type the follow step:\n```sh\n$ spark-shell --master yarn\nscala\u003e val textFile = sc.textFile(\"s3a://files/words.txt\")\ntextFile: org.apache.spark.rdd.RDD[String] = s3a://files/words.txt MapPartitionsRDD[1] at textFile at \u003cconsole\u003e:24\n\nscala\u003e val counts = textFile.flatMap(line =\u003e line.split(\" \")).map(word =\u003e (word, 1)).reduceByKey(_ + _)\ncounts: org.apache.spark.rdd.RDD[(String, Int)] = ShuffledRDD[4] at reduceByKey at \u003cconsole\u003e:26\n\nscala\u003e counts.saveAsTextFile(\"s3a://files/output\")\n[Stage 0:\u003e                                                          (0 + 2) / 2]\n```\n\nUse `s3client` command to list output files:\n```sh\n$ ./s3client list files\n---------- [files] ----------\noutput/_SUCCESS     \t0                   \t2017-03-28T17:06:59.775Z\noutput/part-00000   \t35                  \t2017-03-28T17:06:58.413Z\noutput/part-00001   \t6                   \t2017-03-28T17:06:59.056Z\nwords.txt           \t44                  \t2017-03-28T17:04:33.141Z\n```\n\nYou also can use `hdfs` command to list files and display content:\n```sh\n$ hadoop fs -ls s3a://files/output\nFound 3 items\n-rw-rw-rw-   1          0 2017-03-28 17:06 s3a://files/output/_SUCCESS\n-rw-rw-rw-   1         35 2017-03-28 17:06 s3a://files/output/part-00000\n-rw-rw-rw-   1          6 2017-03-28 17:06 s3a://files/output/part-00001\n\n$ hadoop fs -cat s3a://files/output/part-00000\n(DD,2)\n(EE,2)\n(AE,2)\n(CC,3)\n(AA,5)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkairen%2Fspark-ceph-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkairen%2Fspark-ceph-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkairen%2Fspark-ceph-example/lists"}