clickhouse-backup icon indicating copy to clipboard operation
clickhouse-backup copied to clipboard

Proper way of replacing Repliced Merge Tree and aggravated merge tree

Open arikodelabs opened this issue 3 years ago • 4 comments

As I said in my previous post, I made a script which replaces the strings in backups by database and table name , you've said that I had made a mistake in my script but I changed it and will show the results:

So I used sed -i "s#ENGINE = MergeTree[(][)]#ENGINE = ReplicatedMergeTree('/replikimi/$c/shard1/$table', '$2')#g" /var/lib/clickhouse/backup/$1/metadata/$c/$table.json and sed -i "s#ENGINE = AggregatingMergeTree[(][)]#ENGINE = ReplicatedAggregatingMergeTree('/replikimi/$c/shard1/$table', '$2')#g" /var/lib/clickhouse/backup/$1/metadata/$c/$table.json

and the result is = ENGINE = ReplicatedMergeTree('/replikimi/bms_qa_democlient/shard1/point_time_series', 'ck-1') PARTITION BY which means it was successful, and same goes for aggregatingmergetree

ENGINE = ReplicatedAggregatingMergeTree('/replikimi/bms_qa_clientone/shard1/point_time_series_week', 'ck-1') PARTITION BY

Here is the log files upon doing clickhouse-backup restore shard_replica >& outputi.log

outputi.log

arikodelabs avatar Jun 08 '22 12:06 arikodelabs

And some tables are missing such as "point_time_series", but in the backup the json file with the data exists

arikodelabs avatar Jun 08 '22 12:06 arikodelabs

could you try read logs and try to figure out before just share?

2022/06/08 12:11:07.405323  info CREATE TABLE bms_qa_dio.quercus_reservation 
(`connector_id` String, `building_id` String, `reservation_id` String, `user_id` String, `startDate` Nullable(Date), `endDate` Nullable(Date), `parkingSpotId` Nullable(UInt32), `isOvernight` UInt8 DEFAULT toUInt8(0), `requestedParkingType` Nullable(String), `assignedParkingType` Nullable(String), `status` Nullable(String), `isMonthly` UInt8 DEFAULT toUInt8(0), `isEmployee` UInt8 DEFAULT toUInt8(1), `event_time_local` DateTime, `event_time_utc` DateTime('UTC'), `collected_at` DateTime('UTC')) 
ENGINE = ReplicatedMergeTree('/replikimi/bms_qa_dio/shard1/quercus_reservation', 'ck-1') PARTITION BY toYYYYMM(event_time_local) ORDER BY (connector_id, event_time_local) SETTINGS index_granularity = 8192

2022/06/08 12:11:07.672375  warn can't create table 'bms_qa_dio.quercus_reservation': 
code: 253, message: Replica /replikimi/bms_qa_dio/shard1/quercus_reservation/replicas/ck-1 already exists, 
will try again backup=shard_replica operation=restore

Do you use the same zookeeper servers on destination clickhouse server as source clickhouse server?

Slach avatar Jun 08 '22 13:06 Slach

try to use --tables=*point_time_series and look to the log

you don't answer to my question

Slach avatar Jun 08 '22 13:06 Slach

I will keep you updated, working with my colleagues

arikodelabs avatar Jun 08 '22 13:06 arikodelabs

so, is the issue still reasonable for you?

Slach avatar Oct 20 '22 10:10 Slach

close after inactivty

Slach avatar Jan 02 '23 04:01 Slach