{"id":19643820,"url":"https://github.com/logicalclocks/clusterj-examples","last_synced_at":"2026-06-13T17:31:14.301Z","repository":{"id":141042588,"uuid":"412507831","full_name":"logicalclocks/clusterj-examples","owner":"logicalclocks","description":"Example code for how to use ClusterJ with RonDB","archived":false,"fork":false,"pushed_at":"2021-10-04T06:58:33.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-01-09T20:09:32.004Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logicalclocks.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":"2021-10-01T14:52:21.000Z","updated_at":"2022-08-30T22:54:00.000Z","dependencies_parsed_at":"2023-06-03T16:45:12.141Z","dependency_job_id":null,"html_url":"https://github.com/logicalclocks/clusterj-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicalclocks%2Fclusterj-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicalclocks%2Fclusterj-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicalclocks%2Fclusterj-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicalclocks%2Fclusterj-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logicalclocks","download_url":"https://codeload.github.com/logicalclocks/clusterj-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240950418,"owners_count":19883552,"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":[],"created_at":"2024-11-11T14:24:10.887Z","updated_at":"2026-06-13T17:31:09.259Z","avatar_url":"https://github.com/logicalclocks.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clusterj-examples\n\nThis repository contains a collection of examples using ClusterJ to communicate with [RonDB](https://www.rondb.com\n) cluster. Using ClusterJ bypasses the MySQL server and uses the RonDB API to connect directly to RonDB [datanodes\n](https://docs.rondb.com/rondb_overview_apis).\n\n## Prerequisites\n\n### Java 11\nYou need to have Java runtime installed\n\n### Maven\nThis is a Maven project so you need to install Maven to build it\n\n### Native RonDB API\nClusterJ is a Java client which is internally using JNI to make calls to the native C++ RonDB library. The library is\n needed at **runtime**. Follow the steps below to correctly install the library.\n \n 1. Download the native library tarball from [here](https://repo.hops.works/master/lib-ndb-6.1.0.tgz)\n 2. Extract the tarball\n 3. Copy the content to your Linux distribution default library path, usually `/usr/lib` Otherwise when you run the\n  examples you should override the library path using `-Djava.library.path=PATH_TO_LIBRARY` \n\n### ClusterJ\nTo use ClusterJ from your application you need to include the ClusterJ jar in your classpath. You can download the\n jar file from [here](https://archiva.hops.works/repository/Hops/com/mysql/ndb/clusterj-rondb)\n \n If you are using Maven then you can include it as a dependency in the pom file and add the RonDB repository. Look at\n  `pom.xml` of the current project for details.\n\n### RonDB cluster\nIn order to run the examples in this repository you'll need an existing RonDB cluster. Use [hopsworks.ai](https://www\n.hopsworks.ai)\nto create a Hopsworks cluster or follow the instructions [here](https://docs.rondb.com/cloud_script) to install RonDB.\n\nAs mentioned earlier, ClusterJ uses the native RonDB API so your application **must** be able to reach RonDB\n Management node and RonDB datanodes. Make sure the following ports are open to your firewall/security group.\n \n 1. RonDB management port: 1186\n 2. RonDB datanode port: 10000\n \n## Running the examples\n\n### 1. Create tables\n\nThe examples work on two tables which **must** be created beforehand. For that connect to the MySQL server and\n execute the following\n \n```sql\nCREATE DATABASE clusterj_examples;\n\nCREATE TABLE `customer` (\n  `id` int NOT NULL,\n  `name` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,\n  `age` int NOT NULL,\n  `country` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=ndbcluster\n\nCREATE TABLE `order_status` (\n  `customer_id` int NOT NULL,\n  `order_id` int NOT NULL,\n  `status` varchar(100) COLLATE utf8_unicode_ci NOT NULL,\n  PRIMARY KEY (`customer_id`,`order_id`)\n) ENGINE=ndbcluster\n```\n\n### 2. Prepare connection properties file\nClusterJ needs to know how to connect to RonDB management. This application looks for a configuration file at `$HOME\n/.rondb.props`\n\nThe bare minimum are the following\n```\ncom.mysql.clusterj.connectstring = MANAGEMENT_NODE_IP:1186\ncom.mysql.clusterj.database = clusterj_examples\n```\n\n### 3. Build project\nBuild the current project with `mvn package`\n\n### 4. Run examples\nThere are several examples you can run which show the basic functionality of ClusterJ. There is description on each\n file but we briefly explain below.\n \n 1. `GenerateCustomers`: Load rows in customers table. It **batches** the inserts instead of inserting one by one\n 2. `GenerateOrderStatus`: Similarly to *GenerateCustomers* it loads entries to order_status table\n 3. `CleanCustomers`: Clean customers table performing a select all and delete\n 4. `CleanOrderStatuses`: Same as *CleanCustomers* but for order_status table\n 5. `PrimaryKeyLookUp`: Lookup in customers table based on the primary key\n 6. `CompositePrimaryKeyLookup`: Lookup in order_status table but this time the primary key is composed by **multiple**\n columns \n 7. `FindAndUpdateTx`: Replace a row based on the primary key but in the context of a **transaction**\n 8. `InsertRows`: A simple insert into customer table\n 9. `QueryCustomer`: A more complex range scan on customer table\n 10. `QueryOrderStatus`:  A more complex query on order_status table\n \n To run any of the above examples use the provided runner and replace the class name:\n `java -cp target/rondb-clusterj-1.0-SNAPSHOT-jar-with-dependencies.jar com.logicalclocks.clusterj.Run com.logicalclocks.clusterj.examples.EXAMPLE_CLASS_NAME`\n \n## Next steps\nAs the name suggests this is just example use cases. There are many configuration parameters to\n[tweak](https://docs.rondb.com/rondb_clusterj/#properties-file) and more techniques to improve performance.\n\nYou can find more information at [RonDB documentation](https://docs.rondb.com)\n\nAlso you can contact [sales](mailto:sales@logicalclocks.com) to arrange a demo with Logical Clocks engineers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicalclocks%2Fclusterj-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogicalclocks%2Fclusterj-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicalclocks%2Fclusterj-examples/lists"}