Skip to content

Migration from rekuiper 1.x to 2.x ​

This guide describes breaking changes and migration procedures when upgrading from rekuiper 1.x to 2.x.

Breaking Changes ​

SQLite Database Storage Format ​

eKuiper 2.x changes the internal storage schema for streams and tables in the SQLite database (sqliteKV.db):

  • The 2.x engine cannot deserialize stream and table definitions stored by 1.x.
  • Querying 1.x definitions in 2.x triggers deserialization errors: error unmarshall <name>, the data in db may be corrupted.

Storage Format Comparison ​

ResourceeKuiper 1.x SchemaeKuiper 2.x Schema
StreamsPlain SQL text stringJSON object with streamType, streamKind, and statement
TablesPlain SQL text stringJSON object with streamType, streamKind, and statement
RulesJSON object containing triggered fieldJSON object without triggered field

Migration Procedures ​

To start with a clean state:

  1. Export existing configurations from version 1.x:
bash
curl http://localhost:9081/data/export > backup.json
  1. Stop the container or process:
bash
docker stop ekuiper
  1. Remove the legacy database file:
bash
rm -rf /kuiper/data/sqliteKV.db
  1. Start the 2.x engine:
bash
docker start ekuiper
  1. Recreate streams and rules using the REST API, CLI, or ruleset import.

Option 2: Configure a New Database Filename ​

To maintain the legacy database file for rollback:

  1. Update etc/kuiper.yaml before upgrading:
yaml
store:
  sqlite:
    name: sqliteKV-v2.db
  1. Start the 2.x instance. The engine initializes sqliteKV-v2.db without modifying sqliteKV.db.

Option 3: Delete Incompatible Entries via REST API ​

If you upgraded an existing database, delete legacy stream and table entries:

bash
# Delete the legacy stream
curl -X DELETE http://localhost:9081/streams/<stream_name>

# Delete the legacy table
curl -X DELETE http://localhost:9081/tables/<table_name>

# Recreate the stream with 2.x formatting
curl -X POST http://localhost:9081/streams \
  -H "Content-Type: application/json" \
  -d '{"sql": "CREATE STREAM my_stream () WITH (DATASOURCE=\"topic\", FORMAT=\"JSON\", TYPE=\"mqtt\")"}'

Option 4: Direct SQLite Database Cleanup ​

For bulk remediation, execute SQL directly against the SQLite database:

bash
# List stored streams
sqlite3 /kuiper/data/sqliteKV.db "SELECT key FROM stream;"

# Delete a specific legacy stream
sqlite3 /kuiper/data/sqliteKV.db "DELETE FROM stream WHERE key = 'my_stream';"

# Restart the server
docker restart ekuiper

Additional Guidelines ​

  • Clean installations of 2.x are not affected by this schema change.
  • Always create a full backup of the data/ directory before running upgrades.

Cross References ​

Released under the Apache-2.0 / MIT License.