sync()

Read(305) Label: nodes, synchronize,

Description:

Synchronize the nodes.

Syntax:  

sync(h,p;z)

Note:  

The function synchronizes file p in data zone z on the current node onto node sequence h. If there isn’t a data zone z in h, ignore the sync action; if there is a newer file p in h, sync the newer one onto all the other nodes.

Parameters:

h

A sequence of nodes

p

The file directory in the zone list on the nodes; all files will be synced if it is absent

z

A data zone named after an integer. The parameter is a sequence when there are multiple zones. It denotes the main directory when not provided

Example:

 

 

A

 

1

=sync(["192.168.1.100:8081","192.168.1.101:8283"]

Sync all files in the main directory on the current node onto node "192.168.1.100:8081" and node "192.168.1.101:8283"

2

=sync(["192.168.1.100:8081","192.168.1.101:8283"],"f1")

Sync folder "f1" in the main directory on the current node onto node "192.168.1.100:8081" and node "192.168.1.101:8283"

3

=sync(["192.168.1.100:8081","192.168.1.101:8283","192.168.1.102:8081"];[1,2,3])

Sync all files in data zones 1, 2, 3 on the current node onto the corresponding data zones on node "192.168.1.100:8081", node "192.168.1.101:8283" and node "192.168.1.102:8081"; as the third node doesn’t have data zone 3, just skip the sync to this zone

4

=sync(["192.168.1.100:8081","192.168.1.101:8283"],"t1";1)

Sync folder "f1" in data zone 1 on the current node onto data zone 1 on both node "192.168.1.100:8081" and node "192.168.1.101:8283"