Propagating external files through a grid

You can copy non-database, external files to the servers within a grid.

About this task

The ifx_grid_copy() procedure copies files from a directory on the source server to a specified destination on all servers in a grid. You specify the source directory on the source server by setting the GRIDCOPY_DIR configuration parameter to the location of the file to copy. You also set the GRIDCOPY_DIR configuration parameters on each of the destination servers to specify the directory to which the file is copied. The source directory can be different than the destination directory.

The file is copied to all of the servers within the grid with the same permissions, owner, and group. The names of the group and owner are transmitted along with the file rather than the group ID and User ID because user and group names might have different group ID and User ID values on different servers.

The grid must exist and you must run the grid routines as an authorized user from an authorized server. Wildcard characters in file names are not supported.

Procedure

  1. On the source server, set the GRIDCOPY_DIR configuration parameter to the location of the file to copy.
  2. On the destination servers, set the GRIDCOPY_DIR configuration parameter to the location of the destination of the file to copy.
  3. Run the ifx_grid_copy() procedure specifying the grid name, the name of the file to send, and, optionally, the file destination.

Examples

Example 1: Copy a file to servers in a grid

The following example copies the file $INFORMIXDIR/tmp/myfile to the other nodes within grid grid1.

EXECUTE PROCEDURE ifx_grid_copy("grid1", "tmp/myfile")

Example 2: Copy a file to servers in a grid and change the name on the destination servers

In the following example, assume that the GRIDCOPY_DIR configuration parameter is set to $INFORMIXDIR/tmp on the source server and on the destination server. The following example copies the file $INFORMIXDIR/tmp/bin/sales-010512.exe on the source server to $INFORMIXDIR/tmp/bin/sales.exe on all servers within the grid mygrid.

EXECUTE PROCEDURE ifx_grid_copy ("mygrid", "bin/sales-010512.exe", "bin/sales.exe");