I am trying to understand the correct way to migrate my old Zabbix PostgreSQL database to a new PostgreSQL server. My attempts to migrate the database have not been successful and I anticipate it has to do with TImescaleDB.
ENVIRONMENT:
SERVER A (old database server)
however I receive numerous warnings about hypertables not being able to be restored
Is there a step that I am missing? Or a parameter that I haven't set in the backup invocation? Absolutely stumped on this and I would appreciate any help anyone can provide!!
ENVIRONMENT:
SERVER A (old database server)
- Zabbix 6.4
- Ubuntu 20.04 LTS
- PostgreSQL 15.5
- TimescaleDB 2.11
- Zabbix 7.0
- Ubuntu 24.04 LTS
- PostgreSQL 16.6
- TimescaleDB 2.17.2
Code:
sudo -u postgres pg_dump -Fc -d zabbix | gzip > zabbix_backup_dump.sql.gz; zcat /mnt/data/zabbix_backup_dump.sql.gz | sudo -u postgres pg_restore -d zabbix;
Code:
pg_restore: error: could not execute query: ERROR: column "replication_factor" of relation "hypertable" does not exist Command was: COPY _timescaledb_catalog.hypertable (id, schema_name, table_name, associated_schema_name, associated_table_prefix, num_dimensions, chunk_sizing_func_schema, chunk_sizing_func_name, chunk_target_size, compression_state, compressed_hypertable_id, replication_factor) FROM stdin; pg_restore: error: COPY failed for table "chunk": ERROR: null value in column "creation_time" of relation "chunk" violates not-null constraint DETAIL: Failing row contains (4101, 8, _timescaledb_internal, compress_hyper_8_4101_chunk, null, f, 0, f, null). CONTEXT: COPY chunk, line 1: "4101 8 _timescaledb_internal compress_hyper_8_4101_chunk \N f" pg_restore: error: COPY failed for table "dimension": ERROR: insert or update on table "dimension" violates foreign key constraint "dimension_hypertable_id_fkey" DETAIL: Key (hypertable_id)=(1) is not present in table "hypertable". pg_restore: error: COPY failed for table "dimension_slice": ERROR: insert or update on table "dimension_slice" violates foreign key constraint "dimension_slice_dimension_id_fkey" DETAIL: Key (dimension_id)=(1) is not present in table "dimension". pg_restore: error: COPY failed for table "chunk_constraint": ERROR: insert or update on table "chunk_constraint" violates foreign key constraint "chunk_constraint_chunk_id_fkey" DETAIL: Key (chunk_id)=(4113) is not present in table "chunk". pg_restore: error: could not execute query: ERROR: relation "_timescaledb_catalog.chunk_data_node" does not exist Command was: COPY _timescaledb_catalog.chunk_data_node (chunk_id, node_chunk_id, node_name) FROM stdin; pg_restore: error: COPY failed for table "chunk_index": ERROR: insert or update on table "chunk_index" violates foreign key constraint "chunk_index_chunk_id_fkey" DETAIL: Key (chunk_id)=(3804) is not present in table "chunk". pg_restore: error: COPY failed for table "compression_chunk_size": ERROR: insert or update on table "compression_chunk_size" violates foreign key constraint "compression_chunk_size_chunk_id_fkey" DETAIL: Key (chunk_id)=(3792) is not present in table "chunk". pg_restore: error: could not execute query: ERROR: column "bucket_width" of relation "continuous_agg" does not exist Command was: COPY _timescaledb_catalog.continuous_agg (mat_hypertable_id, raw_hypertable_id, parent_mat_hypertable_id, user_view_schema, user_view_name, partial_view_schema, partial_view_name, bucket_width, direct_view_schema, direct_view_name, materialized_only, finalized) FROM stdin; pg_restore: error: could not execute query: ERROR: column "experimental" of relation "continuous_aggs_bucket_function" does not exist Command was: COPY _timescaledb_catalog.continuous_aggs_bucket_function (mat_hypertable_id, experimental, name, bucket_width, origin, timezone) FROM stdin; pg_restore: error: could not execute query: ERROR: relation "_timescaledb_catalog.dimension_partition" does not exist Command was: COPY _timescaledb_catalog.dimension_partition (dimension_id, range_start, data_nodes) FROM stdin; pg_restore: error: could not execute query: ERROR: relation "_timescaledb_catalog.hypertable_compression" does not exist Command was: COPY _timescaledb_catalog.hypertable_compression (hypertable_id, attname, compression_algorithm_id, segmentby_column_index, orderby_column_index, orderby_asc, orderby_nullsfirst) FROM stdin; pg_restore: error: could not execute query: ERROR: relation "_timescaledb_catalog.hypertable_data_node" does not exist Command was: COPY _timescaledb_catalog.hypertable_data_node (hypertable_id, node_hypertable_id, node_name, block_chunks) FROM stdin; pg_restore: error: could not execute query: ERROR: relation "_timescaledb_catalog.remote_txn" does not exist Command was: COPY _timescaledb_catalog.remote_txn (data_node_name, remote_transaction_id) FROM stdin; pg_restore: error: COPY failed for table "bgw_job": ERROR: insert or update on table "bgw_job" violates foreign key constraint "bgw_job_hypertable_id_fkey" DETAIL: Key (hypertable_id)=(1) is not present in table "hypertable".
Comment