Import and Export
Overview
Migrating processing logic between environments—such as moving from a development sandbox to a production edge node—is a core workflow in eKuiper Manager. This section covers how to extract resource definitions (Streams, Rules, and Tables) and deploy them to new eKuiper instances.
Exporting Resources
Because eKuiper Manager provides a fully integrated Swagger API Playground, the most reliable way to export definitions is through the interactive documentation.
Exporting via API Playground
- Navigate to the Swagger API section in the sidebar.
- Locating the resource type:
- For Streams:
GET /streams/{id} - For Rules:
GET /rules/{id}
- For Streams:
- Click Try it out and enter the Resource ID.
- Copy the resulting JSON response body. This JSON contains the complete configuration, including SQL logic and action (sink) settings.
Manual SQL Export
For users preferring a SQL-first approach:
- Open the Rule Management or Stream Management tab.
- Select the desired resource to view its details.
- Copy the SQL definition from the editor. Note that for Rules, you will also need to copy the "Actions" (JSON configuration for sinks).
Importing Resources
Importing involves recreating the definitions on a target server connected to the Manager.
Importing Streams
To recreate a stream in a new environment:
- Navigate to Stream Management -> Create Stream.
- Use the SQL editor to paste the
CREATE STREAMstatement.CREATE STREAM demo_stream ( temp FLOAT, humidity BIGINT ) WITH (FORMAT="JSON", TYPE="mqtt", DATASOURCE="telemetry/data") - Click Submit. The Manager will proxy this request to the active eKuiper instance.
Importing Rules
Rules consist of two parts: the SQL logic and the Actions (Sinks).
- Navigate to Rule Management -> Create Rule.
- ID: Provide a unique identifier for the rule.
- SQL: Paste the transformation logic.
- Actions: Paste the JSON array of sinks exported from your previous environment.
[ { "mqtt": { "server": "tcp://broker.internal:1883", "topic": "alerts/high_temp" } } ]
Migration Best Practices
Handling Environment Dependencies
When migrating between environments, certain parameters often change (e.g., MQTT broker URLs, database credentials, or file paths).
- Shared Connections: If your rules use Shared Connections, ensure the Connection ID exists on the target server before importing the rule.
- Configuration Keys (
confKey): Many sources and sinks reference aconfKeydefined in the eKuiper global configuration files. Ensure these keys are mirrored in the target instance'setc/sourcesoretc/sinksdirectories.
Using the AI Assistant for Transformation
If you are migrating a rule to a target environment with a slightly different stream schema, use the AI Assistant:
- Open the Master Chat.
- Provide the exported Rule JSON and the schema of the new Stream.
- Ask the AI to "Refactor this rule for the new stream schema while maintaining the same filtering logic."
Verification Post-Import
After importing, always perform the following checks:
- Health Check: Use the eKuiper Health Check dashboard to ensure the target server is responsive.
- Rule Tracing: Start the rule and click Trace. Verify that data is flowing through the topology nodes as expected.
- Topology View: Inspect the Rule Topology to confirm that all sources and sinks are correctly mapped in the new environment.
API Reference for Automation
For developers automating migrations, the following internal API proxy endpoints are used by the manager:
| Action | Method | Endpoint |
| :--- | :--- | :--- |
| List All Streams | GET | /api/connections/{id}/ekuiper/streams |
| Create Rule | POST | /api/connections/{id}/ekuiper/rules |
| Get Rule Definition | GET | /api/connections/{id}/ekuiper/rules/{ruleId} |
Note: Replace {id} with the Connection ID of your eKuiper server as managed within the UI.