All Products
Search
Document Center

Lindorm:Quick start

Last Updated:May 17, 2024

This topic describes how to use Lindorm Distributed Processing System (LDPS) to read and write data by executing SQL statements.

Prerequisites

Step 1: Make preparations

  1. Download the Spark release package.

  2. Decompress the downloaded Spark release package.

  3. Set the environment variable SPARK_HOME to the path to which the package is decompressed.

    export SPARK_HOME=/path/to/spark/;
  4. Configure parameters in the following configuration file: $SPARK_HOME/conf/beeline.conf.

    • endpoint: Set this parameter to the LDPS endpoint for JDBC. For more information about how to obtain the endpoint, see View the endpoints of LDPS.

    • user: Set this parameter to the password that is used to access LindormTable

    • password: Set this parameter to the password that is used to access LindormTable.

    • shareResource: Specify whether the Spark resources are shared by multiple interactive sessions. The default value of this parameter is true.

  5. Activate Hive Metastore. For more information, see Activate Hive Metastore.

Step 2: Write data to a table

  1. Go to the $SPARK_HOME/bin path and run the ./beeline command.

  2. In the interactive session, execute the following SQL statements:

    -- Create a table.
    CREATE TABLE test (id INT, name STRING);
    
    -- Insert data into the table.
    INSERT INTO test VALUES (0, 'Jay'), (1, 'Edison');

Step 3: Read data from a table

  1. Run the /bin/beeline command.

  2. In the interactive session, execute the following SQL statement:

    SELECT id, name FROM test;