Skip to content
Copy data between Managed ClickHouse® services

Copy data between Managed ClickHouse® services

You can copy data from one ClickHouse® server to another using the remoteSecure() function.

Important

remoteSecure() speaks the ClickHouse native protocol over TLS, so PORT must be the port of the source service clickhouse component, for example 21699. Using the HTTPS port 21700 fails with a protocol error.

Prerequisites

Details of the source (remote) server

  • Hostname
  • Port of the clickhouse component (native protocol over TLS)
  • Username
  • Password

Copy data

  1. From your target server, use the remoteSecure() function to select data from the source server.

    SELECT * FROM remoteSecure('HOSTNAME:PORT', db.remote_engine_table, 'USERNAME', 'PASSWORD') LIMIT 3;
  2. Insert the selected data into the target server.

    INSERT INTO [db.]table [(c1, c2, c3)] SELECT ...

    For details on how to configure and use the INSERT query, see Inserting the Results of SELECT.

Your data has been copied from the remote (source) server to the new (target) server.

Last updated on