Appearance
CREATE REMOTE SERVER
Create a remote server on the source system for replication purposes. The remote server is a reference to the target system.
CREATE [ OR REPLACE ] REMOTE SERVER name
WITH (HOST remote_host_name [, NOHOSTNAMECHECK true | false ] [, SQL_PORT number])
- OR REPLACE
If the remote server exists and is replaced, an implicit
DROP REMOTE SERVER
operation occurs. You cannot drop a remote server that is referenced by an existing replica (regardless of whether replication is running).- HOST
The host name of the remote system is required by default. Typically, the host name is the fully qualified domain name (FQDN) for the host, as specified by the common name (CN) value in the SSL certificate that is used to trust the target system. You can use the IP address for the
HOST
value instead of the host name only if theNOHOSTNAMECHECK
option is set totrue
.- NOHOSTNAMECHECK
Set to
true
, this option disables strict host name checking against installed SSL certificates. In turn, validation will not fail for a wildcard certificate, and an IP address may be specified for the host instead of the host name. For example, if the host name in the installed certificate is*.paly.ybdatabase.com
, but the host name in theCREATE REMOTE SERVER
statement isyb100.paly.ybdatabase.com
, the remote server will still be created successfully and replication operations will operate normally.If you do not specify this option, or specify
false
, strict host name checking occurs and the FQDN must be used for theHOST
option.- SQL_PORT
The default SQL port is
5432
. The port number you specify must be open and configured for use on the remote system. See Opening Network Ports for Clients.
Remote servers are global system objects, not database objects. One remote server can support replication for multiple databases and replicas.
Examples
Specify the host name only:
yellowbrick=# create remote server test_repl_svr
with (host 'yb100.paly.ybdatabase.com');
CREATE REMOTE SERVER
Specify the host name and the SQL port number:
premdb=# create remote server ybd_repl_svr
with (host 'my.target.host.io', sql_port 5432);
CREATE REMOTE SERVER
Use an IP address for the host and disable strict checking for the host name:
premdb=# create or replace remote server replsvr with (host '10.30.22.203', nohostnamecheck true);
CREATE REMOTE SERVER
Attempt to use an IP address for the host when strict checking for the host name is enabled. The error is expected in this case.
premdb=# create or replace remote server yblocal with (host '10.30.22.203');
ERROR: Failed to add remote server
DETAIL: Error validating remote server. The hostname:port 10.30.22.203:5432 specified is configured with a certificate that does not match the hostname provided. Use the correct hostname.