ALTER SERVER adds, modifies, or deletes the parameters of an existing server. You can query existing servers from the pg_foreign_server system catalog.
Only the owner of a server or a system administrator can run this statement.
1 2 | ALTER SERVER server_name [ VERSION 'new_version' ] [ OPTIONS ( {[ ADD | SET | DROP ] option ['value']} [, ... ] ) ]; |
In OPTIONS, ADD, SET, and DROP are operations to be executed. If these operations are not specified, the ADD operation will be performed by default. option and value are corresponding operation parameters.
Currently, only SET is supported on an HDFS server. ADD and DROP are not supported. The syntax for SET and DROP operations is retained for later use.
1 2 | ALTER SERVER server_name OWNER TO new_owner; |
1 2 | ALTER SERVER server_name RENAME TO new_name; |
1 | ALTER SERVER server_name REFRESH OPTIONS; |
The server parameters to be modified are as follows:
Specifies the name of the server to be modified.
Specifies the new version of the server.
Specifies the endpoint of the OBS service.
Specifies the IP address and port number of the primary and standby nodes of the HDFS cluster.
Specifies the HDFS cluster configuration file.
Specifies whether data is encrypted. This parameter is available only when type is OBS. The default value is off.
Value range:
Indicates the access key (AK) (obtained by users from the OBS page) used for the OBS access protocol. When you create a foreign table, its AK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is OBS.
Indicates the secret access key (SK) (obtained by users from the OBS page) used for the OBS access protocol. When you create a foreign table, its SK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is OBS.
Specifies the endpoint of the DLI service. This parameter is available only when type is DLI.
Specifies the AK (obtained by users from the DLI page) used for the DLI access protocol. When you create a foreign table, its AK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is DLI.
Specifies the SK (obtained by users from the DLI page) used for the DLI access protocol. When you create a foreign table, its SK value is encrypted and saved to the metadata table of the database. This parameter is available only when type is DLI.
Indicates the IP address or domain name of the OBS server. This parameter is available only when type is OBS.
Specifies the database name of a remote cluster to be connected. This parameter is used for collaborative analysis.
Specifies the username of a remote cluster to be connected. This parameter is used for collaborative analysis.
Specifies the user password of a remote cluster to be connected. This parameter is used for collaborative analysis.
Specifies the new owner of the server. To change the owner, you must be the owner of the foreign server and a direct or indirect member of the new owner role, and must have the USAGE permission on the encapsulator of the external server.
Specifies the new name of the server.
Refreshes the HDFS configuration file. This command is executed when the configuration file is modified. If this command is not executed, an access error may be reported.
Change the current name to the IP address of the hdfs_server server.
ALTER SERVER hdfs_server OPTIONS ( SET address '10.10.0.110:25000,10.10.0.120:25000');
Change the current name to hdfscfgpath of the hdfs_server server.
ALTER SERVER hdfs_server OPTIONS ( SET hdfscfgpath '/opt/bigdata/hadoop');