Update README.md Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/838c6a88 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/838c6a88 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/838c6a88
Branch: refs/heads/ignite-7777 Commit: 838c6a88a4b8d65caf5cfe16176c877af78b1546 Parents: b9377b4 Author: alexey-nbl <[email protected]> Authored: Wed May 9 02:31:52 2018 +0300 Committer: GitHub <[email protected]> Committed: Wed May 9 02:31:52 2018 +0300 ---------------------------------------------------------------------- modules/platforms/nodejs/examples/README.md | 86 +++++++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/838c6a88/modules/platforms/nodejs/examples/README.md ---------------------------------------------------------------------- diff --git a/modules/platforms/nodejs/examples/README.md b/modules/platforms/nodejs/examples/README.md index 70245bc..cbf7357 100644 --- a/modules/platforms/nodejs/examples/README.md +++ b/modules/platforms/nodejs/examples/README.md @@ -2,15 +2,97 @@ NodeJS Client for Apache Ignite contains fully workable examples to demonstrate the main behavior of the client. -## Examples Installation ## +## Description ## + +### Cache Put Get Example ### + +Source: [CachePutGetExample.js](./CachePutGetExample.js) + +This example demonstrates basic Cache, Key-Value Queries and Scan Query operations: +- connects to a node +- creates a cache, if it doesn't exist + - specifies key type as Integer +- executes different cache operations with Complex Objects and Binary Objects + - put several objects in parallel + - putAll + - get + - getAll + - ScanQuery +- destroys the cache + +### Sql Query Example ### + +Source: [SqlQueryExample.js](./SqlQueryExample.js) + +This example demonstrates basic Cache, Key-Value Queries and SQL Query operations: +- connects to a node +- creates a cache from CacheConfiguration, if it doesn't exist +- writes data of primitive types into the cache using Key-Value put operation +- reads data from the cache using SQL Query +- destroys the cache + +### Sql Data Processing Example ### + +Source: [SqlDataProcessingExample.js](./SqlDataProcessingExample.js) + +This example demonstrates basic SQL Fields Query operations: +- connects to a node +- creates a cache, if it doesn't exist +- creates tables (CREATE TABLE) +- creates indices (CREATE INDEX) +- writes data of primitive types into the tables (INSERT INTO table) +- reads data from the tables (SELECT ...) +- deletes tables (DROP TABLE) +- destroys the cache + +### Auth Tls Example ### + +Source: [AuthTlsExample.js](./AuthTlsExample.js) + +This example requires [additional setup](#additional-setup-for-authtlsexample). + +This example demonstrates how to establish a secure connection to an Ignite node and use username/password authentication, as well as basic Key-Value Queries operations for primitive types: +- connects to a node using TLS and providing username/password +- creates a cache, if it doesn't exist + - specifies key and value type of the cache +- put data of primitive types into the cache +- get data from the cache +- destroys the cache + +## Installation ## (temporary, while the NPM module is not released on [npmjs](https://www.npmjs.com)) Examples are installed along with the client. Follow the [instructions in the main readme](../README.md#installation). -## Examples Running ## +## Setup and Running ## 1. Run Apache Ignite server - locally or remotely. + 2. If needed, modify `ENDPOINT` constant in an example source file - Ignite node endpoint. The default value is `127.0.0.1:10800`. + 3. Run an example by calling `node <example_file_name>.js`. Eg. `node CachePutGetExample.js` + +## Additional Setup for AuthTlsExample ## + +1. Obtain certificates required for TLS: + - either use pre-generated certificates provided in the [examples/certs](./certs) folder. Password for the files: `123456`. Note, these certificates work for an Ignite server installed locally only. + - or obtain other existing certificates applicable for a concrete Ignite server. + - or generate new certificates applicable for a concrete Ignite server. + + - The following files are needed: + - keystore.jks, truststore.jks - for the server side + - client.key, client.crt, ca.crt - for the client side + +2. Place client.key, client.crt and ca.crt files somewhere locally, eg. into the [examples/certs](./certs) folder. + +3. If needed, modify `TLS_KEY_FILE_NAME`, `TLS_CERT_FILE_NAME` and `TLS_CA_FILE_NAME` constants in the example source file. The default values point to the files in the [examples/certs](./certs) folder. + +4. Setup Apache Ignite server to accept TLS - see appropriate Ignite documentation. Provide the obtained keystore.jks and truststore.jks certificates during the setup. + +5. Switch on and setup authentication in Apache Ignite server - see appropriate Ignite documentation. + +6. If needed, modify `USER_NAME` and `PASSWORD` constants in the example source file. The default values are the default Ignite username/password. + +7. Executes [Setup and Running](#setup-and-running) steps.
