Replication task

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
Can I create a replication sentence so that each time the target data set has the day and month and year of the replication task in the name?
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
Can I create a replication sentence so that each time the target data set has the day and month and year of the replication task in the name?

Yes.

You use the "naming schema" to name the snapshot that will be replicated. Here's an excerpt from the manual:

Naming Schemas
The Naming Schema determines how automated snapshot names are generated. A valid schema requires the %Y (year), %m (month), %d (day), %H (hour), and %M (minute) time strings, but you can add more identifiers to the schema too, using any identifiers from the Python strptime function.

This uses some letters differently from POSIX (Unix) time functions. For example, including %z (time zone) ensures that snapshots do not have naming conflicts when daylight time starts and ends, and %S (second) adds finer time granularity.

Examples:

Naming SchemeSnapshot Names Look Like
replicationsnaps-1wklife-%Y%m%d_%H:%Mreplicationsnaps-1wklife-20210120_00:00, replicationsnaps-1wklife-20210120_06:00
autosnap_%Y.%m.%d-%H.%M.%S-%zautosnap_2021.01.20-00.00.00-EST, autosnap_2021.01.20-06.00.00-EST
When snapshots are to be referenced from a Windows computer, avoid using characters like : that are invalid in a Windows file path. Some applications filename or path length limits, and there may be limitations related to spaces and other characters. Carefully consider future uses and ensure the names given to periodic snapshots are acceptable.

Here's an example from my target machine to which my source machine replicates snapshots. The snapshot name is preserved intact.

In this case it shows the date (yyyy-mm-dd) and time (hh-mm) the snapshot was taken and the life (2 weeks).

1630788035589.png


Look at Snapshots and Replication in the manual for the full description.
 

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
Yes.

You use the "naming schema" to name the snapshot that will be replicated. Here's an excerpt from the manual:

Naming Schemas
The Naming Schema determines how automated snapshot names are generated. A valid schema requires the %Y (year), %m (month), %d (day), %H (hour), and %M (minute) time strings, but you can add more identifiers to the schema too, using any identifiers from the Python strptime function.

This uses some letters differently from POSIX (Unix) time functions. For example, including %z (time zone) ensures that snapshots do not have naming conflicts when daylight time starts and ends, and %S (second) adds finer time granularity.

Examples:

Naming SchemeSnapshot Names Look Like
replicationsnaps-1wklife-%Y%m%d_%H:%Mreplicationsnaps-1wklife-20210120_00:00, replicationsnaps-1wklife-20210120_06:00
autosnap_%Y.%m.%d-%H.%M.%S-%zautosnap_2021.01.20-00.00.00-EST, autosnap_2021.01.20-06.00.00-EST


Here's an example from my target machine to which my source machine replicates snapshots. The snapshot name is preserved intact.

In this case it shows the date (yyyy-mm-dd) and time (hh-mm) the snapshot was taken and the life (2 weeks).

View attachment 49206

Look at Snapshots and Replication in the manual for the full description.
In this way?
rpc.PNG
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
n this way?
Yes, I think that will work, though I have never used replication in this way (where it generates its own snapshots).
 

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
Yes, I think that will work, though I have never used replication in this way (where it generates its own snapshots).
When I have it written this way, an error pops up when I try to replicate and the name of the target file does not contain the date.
rpc1.PNG

error.PNG

Code:
[2021/09/05 10:17:22] ERROR    [replication_task__task_1] [zettarepl.replication.run] For task 'task_1' non-recoverable replication error ReplicationError("Source 'SSD_maszyny/Bazy_danych_Ubuntu-y7ft4' is a volume, but target 'Seagate_IronWolf_odz' already exists and is a filesystem")
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
Check "Recursive" under Siource.

Check "Synchronize destination snapshots with source" under Destination.
 

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
Check "Recursive" under Siource.

Check "Synchronize destination snapshots with source" under Destination.
I marked it, but I still have the error
rpc2.PNG

Code:
Logs
[2021/09/05 15:30:59] ERROR    [replication_task__task_1] [zettarepl.replication.run] For task 'task_1' non-recoverable replication error ReplicationError("Source 'SSD_maszyny/Bazy_danych_Ubuntu-y7ft4' is a volume, but target
'Seagate_IronWolf_odz' already exists and is a filesystem")
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
Expand the Destination file browser and pick a dataset - see this from the manual at https://www.truenas.com/docs/core/tasks/replicationtasks/advanced/:

The destination is where replicated data is stored. Choosing a remote destination requires an SSH Connection to that system. Expanding the file browser shows the current datasets that are available on the destination system. You can click a destination or manually type a path in the field. Adding a name to the end of the path creates a new dataset in that location.
 

adam23450

Contributor
Joined
Feb 19, 2020
Messages
142
Expand the Destination file browser and pick a dataset - see this from the manual at https://www.truenas.com/docs/core/tasks/replicationtasks/advanced/:

The destination is where replicated data is stored. Choosing a remote destination requires an SSH Connection to that system. Expanding the file browser shows the current datasets that are available on the destination system. You can click a destination or manually type a path in the field. Adding a name to the end of the path creates a new dataset in that location.
I understand and want a new dataset to be created and include the date in the name.
 
Top