Connect Apache Hadoop and Hive to Mammoth
The Apache Hadoop connector reads your cluster through HiveServer2, the standard SQL interface for Hadoop, and imports a Hive table or HiveQL query result as a dataset. Open it from Data Library > New dataset > Connectors, search for Hadoop and click Apache Hadoop. Project Admins create the connection; Project Editors can start datasets from a connection the project already has. Which connectors you can add depends on your plan.
What you can bring in from Hadoop
- Any Hive table the user can read, grouped by schema.
- The result of your own HiveQL query.
The dataset can refresh daily or only when you ask.
Before you connect Hadoop
You need:
- A Hadoop cluster running HiveServer2, reachable from the internet.
- HiveServer2 set up to accept username and password sign-in.
- A Hive user with
SELECTaccess on the tables you want. - The HiveServer2 hostname, port (default
10000), database name, username and password. - Mammoth's IP address allowed in your cluster's firewall. See Allow Mammoth through your firewall.
Connect Apache Hadoop to Mammoth
- Go to the Data Library, click New dataset, and choose Connectors.
- Search for Hadoop and click the Apache Hadoop tile. The connection form opens.
- Fill in the fields below and click Connect. If the check fails, the error appears at the bottom of the form.
- Once Mammoth has connected, the connector workspace opens on your tables. See Connect a database or app for the shared steps.
| Field | What to enter | Example |
|---|---|---|
| Host URL | Hostname or IP address of your HiveServer2 node | hive.cluster.example.com |
| Port | HiveServer2 TCP port | 10000 (default) |
| Username | Hive user with SELECT access | mammoth_reader |
| Password | Password for the Hive user | |
| Database | Name of the Hive database | analytics |
| Display Name | Optional label for this connection | Hadoop Cluster Prod |
Query a Hive table with HiveQL
- In Tables, click a table. Mammoth opens its rows with the
SELECT *query that read them, shown above the rows. - To write HiveQL instead, click Edit SQL, edit the query, and click Run.
SELECT order_id, customer_id, amount, order_date
FROM analytics.orders
WHERE order_date >= '2024-01-01'
LIMIT 10000
AI query writing (Write SQL) isn't available for Hadoop. Connect a database or app covers the full SQL view.
Save Hadoop data as a dataset
- Click Save as dataset.
- Enter a Name and pick a folder.
- Under Keep it up to date, choose Daily at 06:00 or Only when I ask.
- Next to the sentence that says what each refresh does, click Change and pick an option under On each refresh (see the table below).
- Click Save as dataset.
| On each refresh | What it does |
|---|---|
| Replace all rows | Matches the source after every refresh |
| Add only new rows | Keeps what you have and adds rows above the last value of a Key column |
| Add every row again | Shown instead when the result has no numeric or date column, so each refresh adds a full copy |
| Keep only the newest rows | Empties the dataset, then brings in rows since the last refresh (needs a Key column) |
A key column is a column whose values only ever go up, such as an ID or a date.
Refresh Hadoop data on a schedule
Choosing Daily at 06:00 creates a Dataset Refresh automation that you can reschedule later. After the dataset is saved, you can change what a refresh does in its Update method: Replace all data, Add new rows only or Keep only the newest rows.
Troubleshoot Hadoop connections and slow Hive queries
| Symptom | Likely cause | Fix |
|---|---|---|
| Connection fails | Port 10000 is closed to Mammoth | Open port 10000 inbound from Mammoth's IP address |
| Connection fails | The user can't read the database | Run a test query in Beeline from your cluster to check the user's access |
| Queries are slow | Large Hive scans take time | Use LIMIT while you explore, then remove it before you save so the full result is imported |
Related
- Connect a database or app: the shared connector workspace steps and the full SQL view.
- Allow Mammoth through your firewall: the IP address to allow.
- Manage saved connections: edit, reuse or delete this connection.
- Refresh a dataset: change when the dataset refreshes.
- Speed up pipelines and connectors: strategies for large tables.
Something wrong? support@mammoth.io