The Remote and RemoteSecure table engines are the persistent counterparts of the remote and remoteSecure table functions.
They accept the same arguments and let you access remote servers without listing a cluster in the server configuration file: the engine builds a Distributed-like storage over an ad-hoc cluster created from the supplied addresses on the fly.
Unlike the table functions, the addresses and credentials are stored in the table definition, so the password is hidden in SHOW CREATE TABLE and the engine is exposed as Distributed in system.tables.engine.
The first argument addresses_expr is a remote server address or an expression that generates several addresses, in the form host or host:port.
The host can be a server name or an IPv4/IPv6 address (an IPv6 address must be specified in []).
The address expression supports globbing patterns such as {a,b,c}, {N..M} and {a|b} to expand into multiple shards and replicas.
If db and table are omitted, system.one is used.
The remaining arguments are user (default: default), password (default: empty) and a sharding_key expression.
The settings of the created storage, such as skip_unavailable_shards, are specified after the engine definition:
ENGINE = Remote('127.0.0.1', system, one) SETTINGS skip_unavailable_shards = 1.
Note that the remote and remoteSecure table functions accept the SETTINGS clause among their arguments instead,
remote('127.0.0.1', system.one, SETTINGS skip_unavailable_shards = 1), because a table function has nowhere else to put it;
the engines do not accept that form.
The target may also be a table function, e.g. Remote('127.0.0.1', numbers(10)). Such a table is read-only: there is no remote table to insert into, so INSERT is rejected with a NOT_IMPLEMENTED error.
RemoteSecure connects over a secure TLS connection using the secure TCP port (tcp_port_secure, 9440 by default) when the port is omitted.
Syntax
ENGINE = RemoteSecure(addresses_expr[, db, table, user[, password], sharding_key]) [SETTINGS name = value, ...]Related
Distributed