{"id":16485857,"url":"https://github.com/masumsoft/cassandra-exporter","last_synced_at":"2025-05-07T03:26:16.440Z","repository":{"id":19093014,"uuid":"86079963","full_name":"masumsoft/cassandra-exporter","owner":"masumsoft","description":"Simple Tool to Export / Import Cassandra Tables into JSON","archived":false,"fork":false,"pushed_at":"2025-03-29T11:22:20.000Z","size":72,"stargazers_count":48,"open_issues_count":4,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T12:24:53.473Z","etag":null,"topics":["cassandra","copy","dump","export","import"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/masumsoft.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-24T15:00:18.000Z","updated_at":"2025-03-29T11:22:18.000Z","dependencies_parsed_at":"2024-06-16T14:43:34.336Z","dependency_job_id":null,"html_url":"https://github.com/masumsoft/cassandra-exporter","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masumsoft%2Fcassandra-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masumsoft%2Fcassandra-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masumsoft%2Fcassandra-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masumsoft%2Fcassandra-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masumsoft","download_url":"https://codeload.github.com/masumsoft/cassandra-exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252805651,"owners_count":21807043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cassandra","copy","dump","export","import"],"created_at":"2024-10-11T13:27:31.020Z","updated_at":"2025-05-07T03:26:16.423Z","avatar_url":"https://github.com/masumsoft.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Tools"],"readme":"# Cassandra Exporter\n\nCassandra exporter is a data export / import tool for cassandra that is simple to use and works for unicode and complex data types. It is developed in Javascript and the exported data is stored in JSON formatted files.\n\n# Why another tool?\n\nCassandra has some great tools for exporting and importing data:\n\n* snapshots\n* sstable2json\n* CQL's COPY FROM/TO\n\nBut the problem is snapshots and sstable2json are not that straight forward to use. They are intended for moving large data sets and to me unnecessarily complicated to use for day to day development.\n\nThe COPY command was intended for development or moving small datasets, but is not reliable. Because it uses csv exports which breaks for complex data types and non ascii encodings if you try to import that data. So for development purposes and for moving small datasets (\u003c few million rows per table) I needed something that works robustly and is simple to use.\n\n# Download\n\nYou can either download the compiled binary for your operating system from the [releases](https://github.com/masumsoft/cassandra-exporter/releases) section or if you have nodejs installed, you can use the source code directly to execute the export / import scripts.\n\n# Usage (Compiled Binary)\n\n## To export all table data from a keyspace\n\n```\nHOST=127.0.0.1 KEYSPACE=from_keyspace_name ./export\n```\n\nIt will create exported json files in the data directory for each table in the keyspace.\n\n## To import all table data into a keyspace\n\n```\nHOST=127.0.0.1 KEYSPACE=to_keyspace_name ./import\n```\n\nIt will process all json files in the data directory and import them to corresponding tables in the keyspace.\n\n## To export/import a single table in a keyspace\n\n```\nHOST=127.0.0.1 KEYSPACE=from_keyspace_name TABLE=my_table_name ./export\n\nHOST=127.0.0.1 KEYSPACE=to_keyspace_name TABLE=my_table_name ./import\n```\n\n## To export/import using authentication\n\n```\nKEYSPACE=from_keyspace_name USER=user1 PASSWORD=pa$$word ./export\n\nKEYSPACE=to_keyspace_name USER=user1 PASSWORD=pa$$word ./import\n```\n\nPlease note that the user requires access to the system tables in order to work properly.\n\n## To export/import using SSL/TLS\n\n```\nKEYSPACE=from_keyspace_name USER=user1 PASSWORD=pa$$word USE_SSL=true ./export\n\nKEYSPACE=from_keyspace_name USER=user1 PASSWORD=pa$$word USE_SSL=true ./import\n```\n\n# Usage (from NodeJS)\n\nIf you already have nodejs installed in your system, then you can execute using the source directly like this:\n\n```\nHOST=127.0.0.1 KEYSPACE=from_keyspace_name TABLE=my_table_name node export.js\n\nHOST=127.0.0.1 KEYSPACE=from_keyspace_name TABLE=my_table_name node import.js\n```\n# Usage (Docker)\n\nThe Dockerfiles provide a volume mounted at /data and expect the environment variables `HOST` and `KEYSPACE`. `Dockerfile.import` provides `import.js` functionality. `Dockerfile.export` provides `export.js` functionality. By using the -v option of `docker run` this provides the facility to store the output/input directory in an arbitrary location. It also allows running cassandra-export from any location. This requires [Docker](https://www.docker.com/) to be installed.\n\n# Running tests\n\nTo run a test in the tests folder, for example `numbers.js`, run the command `node tests/numbers.js` at the root of the repo. A localhost cassandra must be running.\n\nTests use recent node.js features and requires Node.js 8.\n\n# Note\n\nCassandra exporter only export / import data. It expects the tables to be present beforehand. If you need to also export schema and the indexes, then you could easily use cqlsh and the source command to export / import the schema before moving the data.\n\n```\n// To export keyspace schema, use cqlsh like this\ncqlsh -e \"DESC KEYSPACE mykeyspace\" \u003e my_keyspace_schema.cql\n\n// To import keyspace schema open the cqlsh shell\n// in the same directory of `my_keyspace_schema.cql`, then\nsource 'my_keyspace_schema.cql'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasumsoft%2Fcassandra-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasumsoft%2Fcassandra-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasumsoft%2Fcassandra-exporter/lists"}