cpdb - Copy a database across the network

SYNOPSIS

cpdb [-d database] [-h remote-host] [-r remote-database] [-t table]
     [-g|-p] [-l rowlimit] [-v] [options ...]

cpdb               [-h remote-host] [-r remote-database] [-t table]
     {-R|-k}


DESCRIPTION
The cpdb program is an alternative to copydb. It is generally much faster than copydb, and does not require texisd. If cpdb is run with no arguments it will run as a daemon, and wait for a client to connect to it. The daemon can either send or receive tables.

The client can either send (-p) or request (-g) tables from the daemon. The default is to send tables. The -l option only works when the client is sending tables, not when receiving. When requesting a table the -t option must be used.

cpdb cannot append to existing tables, and will always create the table to receive data into. Copying will fail if the destination table already exists. The destination database however must exist before copying, see creatdb.

Typical usage is to create an empty database on the destination machine and run cpdb with no arguments so that it goes into daemon mode. Then on the source machine run cpdb with -d, -h, -r, and maybe -t or -l options to send tables to the destination.

cpdb -d /db/products -h newmachine -r /db/products

Options:

-d database The local database to use. Must already exist.
-h remote-host The remote host where another cpdb daemon is already running. If not specified (and -k not specified either), will run in background as daemon server.
-r database The full path to the database on the remort host. Must already exist.
-t table The table to copy. This option may be repeated to copy multiple tables. Without this option all tables will be copied when sending or no tables will be copied when receiving..
-p Put tables to the remote host. This is the default if -g is not used.
-g Get tables from the remote host. When using this option you must use -t to specify which table(s) to get.
-R Remove (drop) tables. Added in version 5.01.1176747000 20070416.
-l rowlimit Maximum number of rows to transfer per table. Only works when sending tables, not receiving.
-k Kill (terminate) the server at remote-host (default is local host). Added in version 5.01.1176436000 20070412.
-N IP/bits When running as a server, limit peers to given network/netmask (e.g. "1.2.3.4/32" to limit to IP 1.2.3.4 only). Connections from machines outside the given network will be rejected. Added in version 5.01.1176426500 20070412. In version 7.07.1594919277 20200716 and later, the -N option may be given multiple times; connections will be allowed iff they are from any of the given networks.
-D database[*] When running as a server, only allow access to database. If "*" (asterisk) is given at the end, this is a prefix. For example, -D /usr/local/mydbs/* would limit access to just databases under "/usr/local/mydb/". Added in version 5.01.1176426500 20070412.
-v Primarily for debugging and should not generally be used.
--install-dir[-force]=dir Use alternate Texis installation dir. The default is the one set at installation.
--texis-conf=file Use alternate config file.
-? Show most help.
-H Show all help.
-P port Port number (default 10004). Added in version 5.01.1176426500 20070412.

-o logfile Log file for messages. Added in version 5.01.1151367500 20060626.
-M none|simple|pct Show progress meter of given type (default simple). A progress meter can generally only be shown for put (-p) operations. Added in version 5.01.1151547000 20060628.
-x (Debug) Do not trap signals. Not recommended for production use.
-X (Debug) Run single-threaded. Not recommended for production use. Added in version 5.01.1182927000 20070627.
-T n (Debug) Set tracing level n, which is an integer composed of bit flags:

  • 0x00000001: show send row fields

  • 0x00000002: show send row portable buffer

  • 0x00000004: suppress non-print chars in send row fields

  • 0x00000008: show send raw data

  • 0x00010000: show recv row fields

  • 0x00020000: show recv row portable buffer

  • 0x00040000: suppress non-print chars in recv row fields

  • 0x00080000: show recv raw data
These flags may be added to or changed in future releases. Added in version 5.01.1151363125 20060626.
--traceskt n

(Debug) Set socket tracing level n, which is a decimal/hex integer set of bit flags. See Vortex manual for details. Added in version 7.07.1551459000 20190301.

Note: cpdb will only copy tables, not indices. Indices will have to be recreated manually after the tables are transferred.

Note: The cpdb daemon listens on port 10004 and does not require a password. It should not be left running when not in use. Use the -N and/or -D options when starting a daemon, to help secure it. Use cpdb -k to terminate it when finished.

Note: An alternative when source and destination machines are the same OS and CPU type you can copy the raw table files over via ftp, nfs, or whatever network copy method you like, then use addtable to connect the table to the new database. If either OS or CPU type are different you can not use the addtable method since table files are not binary compatible across different types of systems.


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.